Navigation
Artikel
Stuff
RSS Feeds
|
Tutorials - Routing TutorialSprachenübersicht/Betriebssysteme/Linux/Internet & Netzwerk Keywords: routing, ip forwarding InhaltsverzeichnisVorwort Top
Tipps: Top
sources.list Top
/etc/apt/sources.list: deb http://debian.fabbione.net/debian-ipv6 woody ipv6 deb-src http://debian.fabbione.net/debian-ipv6 woody ipv6 deb http://www.backports.org/debian stable all deb-src http://www.backports.org/debian stable all deb http://ftp.de.debian.org/debian woody main deb-src http://ftp.de.debian.org/debian woody main deb http://ftp.de.debian.org/debian-non-US woody/non-US main deb-src http://ftp.de.debian.org/debian-non-US woody/non-US main deb http://ftp.de.debian.org/debian/ woody-proposed-updates main deb-src http://ftp.de.debian.org/debian/ woody-proposed-updates main deb http://ftp.de.debian.org/debian-non-US/ woody-proposed-updates/non-US main deb-src http://ftp.de.debian.org/debian-non-US/ woody-proposed-updates/non-US main deb http://security.debian.org/ woody/updates main deb-src http://security.debian.org/ woody/updates main #deb cdrom:[Debian GNU/Linux 3.0 r2 _Woody_ - Official i386 Binary-2 (20031201)]/ unstable contrib main non-US/contrib non-US/main #deb cdrom:[Debian GNU/Linux 3.0 r2 _Woody_ - Official i386 Binary-1 (20031201)]/ unstable contrib main non-US/contrib non-US/main # deb http://security.debian.org/ stable/updates main
Code: apt-get update apt-get autoclean apt-get upgrade
Code: #apt-get upgrade Reading Package Lists... Done Building Dependency Tree... Done The following packages have been kept back libcupsys2 libpaperg libsane 0 packages upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Code: apt-get install libcupsys2 libpaperg libsane
DHCP Server Top
/etc/network/interfaces: auto lo eth0 iface lo inet loopback iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255
Code: subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.50 192.168.0.100; option domain-name "Servername.net"; option domain-name-servers 192.168.0.1; option routers 192.168.0.1; option broadcast-address 192.168.0.255; default-lease-time 86400; max-lease-time 604800; }
Code: INTERFACES="eth0"
Code: /etc/init.d/dhcp3-server start
Code: mount -t smbfs -o username=test //pc1/share /windows
Routing Top
/etc/init.d/firewall: #!/bin/sh # # iptables firewall script v0.3 # # get newer versions at www.zleep.org # (c)2003 by mr_abe <cg@zleep.org> # #Gibt EXT_DEV=ppp0 INT_DEV=eth0 INT_NET=192.168.0.0/24 IPTABLES=/sbin/iptables case $1 in start) echo "Activate routing" # load required modules modprobe iptable_nat # flush all tables, an set all connections to accept $IPTABLES -t filter -F INPUT $IPTABLES -t filter -F OUTPUT $IPTABLES -t filter -F FORWARD $IPTABLES -t filter -P INPUT ACCEPT $IPTABLES -t filter -P OUTPUT ACCEPT $IPTABLES -t filter -P FORWARD ACCEPT # set up routing for internal network $IPTABLES -t nat -F POSTROUTING echo 1 > /proc/sys/net/ipv4/ip_forward $IPTABLES -t nat -A POSTROUTING -o $EXT_DEV -s $INT_NET -j MASQUERADE #new echo 1 > /proc/sys/net/ipv4/ip_dynaddr # accept all connections on localhost $IPTABLES -t filter -A INPUT -i lo -s 0/0 -d 0/0 -j ACCEPT #Open a ports #$IPTABLES -t filter -A INPUT -i $EXT_DEV -p tcp --dport 21 --syn -j ACCEPT 80 --syn -j ACCEPT #Forward this Ports to 192.168.0.2 #$IPTABLES -t nat -F PREROUTING #$IPTABLES -t nat -A PREROUTING -i $EXT_DEV -p tcp --dport 4662 -j DNAT --to 192.168.0.2 # don't route this ports/ips #$IPTABLES -t filter -A FORWARD -p tcp -i $INT_DEV -s 10.10.12.21 -j REJECT #$IPTABLES -t filter -A FORWARD -p tcp -i $INT_DEV -s 10.10.12.21 --dport 80 -j REJECT #$IPTABLES -t filter -A FORWARD -p tcp -i $INT_DEV -s 10.10.12.21 --dport 7082 -j REJECT #$IPTABLES -t filter -A FORWARD -p tcp -i $INT_DEV -s 10.10.12.20 -d www.uboot.com -j REJECT #Wir wollen verhindern das Port 21 geroutet wird #$IPTABLES -t filter -A FORWARD -p tcp -i $INT_DEV --dport 21 -j REJECT # set up some logging rules #$IPTABLES -t filter -A INPUT -p tcp -j LOG --log-prefix "INPUT: TCP " #$IPTABLES -t filter -A INPUT -p udp -j LOG --log-prefix "INPUT: UDP " echo "Firewall & Routing activated" ;; stop) $IPTABLES -t filter -F INPUT $IPTABLES -t filter -F OUTPUT $IPTABLES -t filter -F FORWARD $IPTABLES -t nat -F POSTROUTING ;; restart) $0 stop && $0 start ;; *) echo "Usage: $0 {start|stop|restart}" ;; esac
Code: /etc/init.d/firewall start
Anmerkung: Dieses Script macht nur grundlegendes Routing, eine Ausführliche Anleitung für ein eigenes iptables Script finden Sie hier: www.online-tutorials.net/internet-netzwerk/tutorials-29.html
DNS Server Top
Code: apt-get install bind9
/etc/network/interfaces : auto eth0 iface eth0 inet dhcp
Gibt es noch irgendwelche Fragen, oder wollen Sie über den Artikel diskutieren? Sprachenübersicht/Betriebssysteme/Linux/Internet & Netzwerk/Routing Tutorial |