[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Debian]:Router Konfigurieren ???



Hallo Leute,

habe es jetzt geschaft, mal meine eth0-3 zu erkennen...
Dazu habe ich folgende Einträge in  /etc/init.d/network

#! /bin/sh
ifconfig lo 127.0.0.1
route add -net 127.0.0.0

# Mein Internet Zugang
# ETHERNET_ADDR=00:A0:24:06:D2:19
IF0_IFNAME=eth2
IF0_IPADDR=212.198.252.88
IF0_NETMASK=255.255.255.0
IF0_NETWORK=212.198.252.0
IF0_BROADCAST=212.198.252.255
IF0_GATEWAY=212.198.252.1

# Mein public Netzwerk
# ETHERNET_ADDR=00:20:AF:21:9B:73
IF1_IFNAME=eth0
IF1_IPADDR=192.168.1.1
IF1_NETMASK=255.255.255.0
IF1_NETWORK=192.168.1.0
IF1_BROADCAST=192.168.1.255
IF1_GATEWAY=xxx.xxx.xxx.xxx     <--- was muß ich hier angeben ???

# Mein private Netzwerk
# ETHERNET_ADDR=00:60:08:4E:1C:46
IF2_IFNAME=eth3
IF2_IPADDR=192.168.2.1
IF2_NETMASK=255.255.255.0
IF2_NETWORK=192.168.2.0
IF2_BROADCAST=192.168.2.255
IF2_GATEWAY=xxx.xxx.xxx.xxx     <--- was muß ich hier angeben ???

# Mein secure Netzwerk
# ETHERNET_ADDR=00:20:AF:3A:61:F3
IF3_IFNAME=eth1
IF3_IPADDR=192.168.3.88
IF3_NETMASK=255.255.255.0
IF3_NETWORK=192.168.3.0
IF3_BROADCAST=192.168.3.255
IF3_GATEWAY=xxx.xxx.xxx.xxx     <--- was muß ich hier angeben ???

# Die nachfolgenden Zeilen habe ich jetzt 4 mal.
# Wie kann ich das Script dazu veranlassen,
# das es IF0 bis IF3 durchzählt ???

ifconfig $IF0_IFNAME ${IF0_IPADDR} netmask ${IF0_NETMASK} broadcast
${IF0_BROADCAST}
route add -net ${IF0_NETWORK}
[ "${IF0_GATEWAY}" ] && route add default gw ${IF0_GATEWAY} metric 1


Die nächste Datei ist jetzt /etc/init.d/netbase mit

#! /bin/sh
#
# start/stop networking daemons.

test -f /sbin/portmap || exit 0

spoofprotect () {
    # This is the best method: turn on Source Address Verification and get
    # spoof protection on all current and future interfaces.
    if [ -e /proc/sys/net/ipv4/conf/all/rp_filter ]; then
	echo -n "Setting up IP spoofing protection..."
	for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
	    echo 1 > $f
	done
	echo "done."
    # rules for linux 2.0.x and 2.1.x (x < 102) kernels
    elif [ -e /proc/net/ip_input ]; then
        echo -n "Setting up IP spoofing protection..."
	# delete and readd entry (this way we don't get duplicate entries)

	# deny incoming packets pretending to be from 127.0.0.1
        ipfwadm -I -d deny -o -P all -S 127.0.0.0/8 -W eth0 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S 127.0.0.0/8 -W eth1 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S 127.0.0.0/8 -W eth2 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S 127.0.0.0/8 -W eth3 -D 0/0
2>/dev/null || true
        ipfwadm -I -i deny -o -P all -S 127.0.0.0/8 -W eth0 -D 0/0 >/dev/null
        ipfwadm -I -i deny -o -P all -S 127.0.0.0/8 -W eth1 -D 0/0 >/dev/null
        ipfwadm -I -i deny -o -P all -S 127.0.0.0/8 -W eth2 -D 0/0 >/dev/null
        ipfwadm -I -i deny -o -P all -S 127.0.0.0/8 -W eth3 -D 0/0 >/dev/null

	# deny incoming packets pretending to be from our own system.
	# set your own IP address below (or use `hostname -i` to set it).
#	my_ip=
	ipfwadm -I -d deny -o -P all -S $IF0_IPADDR -W eth0 -D 0/0 2>/dev/null ||
true
	ipfwadm -I -d deny -o -P all -S $IF0_IPADDR -W eth1 -D 0/0 2>/dev/null ||
true
	ipfwadm -I -d deny -o -P all -S $IF0_IPADDR -W eth2 -D 0/0 2>/dev/null ||
true
	ipfwadm -I -d deny -o -P all -S $IF0_IPADDR -W eth3 -D 0/0 2>/dev/null ||
true
	ipfwadm -I -a deny -o -P all -S $IF0_IPADDR -W eth0 -D 0/0 >/dev/null
	ipfwadm -I -a deny -o -P all -S $IF0_IPADDR -W eth1 -D 0/0 >/dev/null
	ipfwadm -I -a deny -o -P all -S $IF0_IPADDR -W eth2 -D 0/0 >/dev/null
	ipfwadm -I -a deny -o -P all -S $IF0_IPADDR -W eth3 -D 0/0 >/dev/null
	echo "done."
    # rules for linux 2.1.x (x > 101) kernels
    elif [ -e /proc/net/ip_fwchains ]; then
        echo -n "Setting up IP spoofing protection..."
	ipchains -D input -j DENY -l -s 127.0.0.0/8 -i ! lo 2>/dev/null || true
	ipchains -A input -j DENY -l -s 127.0.0.0/8 -i ! lo

	# deny incoming packets pretending to be from our own system.
	# set your own IP address below (or use `hostname -i` to set it).
#	my_ip=192.168.14.1
#	ipchains -D input -j DENY -l -s $my_ip -i ! lo 2>/dev/null || true
#	ipchains -A input -j DENY -l -s $my_ip -i ! lo
	echo "done."
    fi
}


case "$1" in
    start)
	spoofprotect
	echo -n "Starting base networking daemons:"
	echo -n " portmap" ; start-stop-daemon --start --quiet --exec /sbin/portmap
	echo -n " inetd" ; start-stop-daemon --start --quiet --exec /usr/sbin/inetd
	echo "."
	;;
    stop)
	start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid
--exec /usr/sbin/inetd
	start-stop-daemon --stop --quiet --oknodo --exec /sbin/portmap
	;;
    reload)
	start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid
--signal 1 --exec /usr/sbin/inetd
	;;
    restart)
	start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid
--exec /usr/sbin/inetd
	pmap_dump >/var/run/portmap.state
	start-stop-daemon --stop --quiet --oknodo --exec /sbin/portmap
	start-stop-daemon --start --quiet --exec /sbin/portmap
	if [ -f /var/run/portmap.upgrade-state ]; then
	  pmap_set </var/run/portmap.upgrade-state
	elif [ -f /var/run/portmap.state ]; then
	  pmap_set </var/run/portmap.state
	fi
	rm -f /var/run/portmap.upgrade-state /var/run/portmap.state
	start-stop-daemon --start --quiet --exec /usr/sbin/inetd
	;;
    *)
	echo "Usage: /etc/init.d/netbase {start|stop|reload|restart}"
	exit 1
	;;
esac

exit 0


Die Frage ist jetz, WO mach ich meine ipfwadm und ipportfw rein ???

Kann ich da eine extra Datei anlegen wie:

ipfwadm -F -f
ipfwadm -I -f
ipfwadm -O -f
ipfwadm -A -f
echo
############################################################################
###
echo By default DENY all services
#
ipfwadm -F -p deny
echo
############################################################################
###
echo Give me access from all LANs to the Internet
#
echo ...public LAN
ipfwadm -F -a m -S 192.168.1.0/24 -D 212.198.252.88/0
echo ...private LAN
ipfwadm -F -a m -S 192.168.2.0/24 -D  212.198.252.88/0
echo
############################################################################
###
#echo Give me access from my Private-LAN to the Public- and Secure-LAN
#
ipfwadm -F -a m -S 192.168.2.0/24 -D 192.168.1.0/24
#echo
############################################################################
###
echo Forward Webmin connections
#
ipportfw -A -t 212.198.252.88/2002 -R 192.168.1.2/2002		# dns1
ipportfw -A -t 212.198.252.88/2009 -R 192.168.1.9/2009		# virtual1
ipportfw -A -t 212.198.252.88/2010 -R 192.168.1.10/2010		# ftp
ipportfw -A -t 212.198.252.88/2011 -R 192.168.1.11/2011		# mail
echo
############################################################################
###
echo Forward server connections
#
ipportfw -A -t 212.198.252.88/80  -R 192.168.1.9/80		# virtual1
ipportfw -A -t 212.198.252.88/21  -R 192.168.1.9/21		# ftp
ipportfw -A -t 212.198.252.88/25  -R 192.168.1.11/25		# mail
ipportfw -A -t 212.198.252.88/443 -R 192.168.1.128/443		# secure
echo
############################################################################
###
echo Forward DNS traffic
#
ipfwadm -I -a accept -P tcp -S 0/0 -D 0/0 53
ipfwadm -I -a accept -P udp -S 0/0 -D 0/0 53
ipfwadm -I -a accept -P udp -S 0/0 53 -D 0/0 1025:65535
ipportfw -A -t 212.198.252.88/53 -R 192.168.1.2/53		# dns1
ipportfw -A -u 212.198.252.88/53 -R 192.168.1.2/53		# dns1


Danke für eure Hilfe

Michelle

------------------------------------------------
Um sich aus der Liste auszutragen schicken Sie
bitte eine E-Mail an majordomo@jfl.de die im Body
"unsubscribe debian-user-de <deine emailadresse>"
enthaelt.
Bei Problemen bitte eine Mail an: Jan.Otto@jfl.de
------------------------------------------------
Anzahl der eingetragenen Mitglieder:     737


Reply to: