3 # manage network interfaces and configure some networking options
5 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
7 if ! [ -x /sbin/ifup ]; then
11 spoofprotect_rp_filter () {
12 # This is the best method: turn on Source Address Verification and get
13 # spoof protection on all current and future interfaces.
15 if [ -e /proc/sys/net/ipv4/conf/all/rp_filter ]; then
16 for f in /proc/sys/net/ipv4/conf/*; do
17 [ -e $f/rp_filter ] && echo 1 > $f/rp_filter
26 echo -n "Setting up IP spoofing protection: "
27 if spoofprotect_rp_filter; then
35 if [ -e /proc/sys/net/ipv4/ip_forward ]; then
36 echo -n "Enabling packet forwarding... "
37 echo 1 > /proc/sys/net/ipv4/ip_forward
43 if [ -e /proc/sys/net/ipv4/tcp_syncookies ]; then
44 echo -n "Enabling TCP/IP SYN cookies... "
45 echo 1 > /proc/sys/net/ipv4/tcp_syncookies
53 opt=`grep "^$optname=" /etc/network/options`
54 if [ -z "$opt" ]; then
55 opt="$optname=$default"
57 optval=${opt#$optname=}
58 if [ "$optval" = "yes" ]; then
65 doopt spoofprotect yes
69 echo -n "Configuring network interfaces... "
74 if sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |
75 grep -q "^/ nfs$"; then
76 echo "NOT deconfiguring network interfaces: / is an NFS mount"
77 elif sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |
78 grep -q "^/ smbfs$"; then
79 echo "NOT deconfiguring network interfaces: / is an SMB mount"
80 elif sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\2/p' /proc/mounts |
81 grep -qE '^(nfs|smbfs|ncp|coda)$'; then
82 echo "NOT deconfiguring network interfaces: network shares still mounted."
84 echo -n "Deconfiguring network interfaces... "
90 echo -n "Reconfiguring network interfaces... "
96 echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}"