3 # network Bring up/down networking
5 # chkconfig: 2345 10 90
6 # description: Activates/Deactivates all network interfaces configured to \
10 # Source function library.
11 . /etc/rc.d/init.d/functions
12 . /etc/rc.d/init.d/functions.network
14 [ ! -f /etc/sysconfig/network ] && exit 0
16 . /etc/sysconfig/network
18 # Check that networking is up.
19 [ "${NETWORKING}" == "no" -o "${NETWORKING}" == "" ] && exit 0
21 [ -x /sbin/ip ] || exit 0
24 # initialize networking:
25 # - check IPv4, IPv6, IPX can be handled by system
26 # - setup default IPv{4,6} interfaces policy like:
28 # - spoofig protection,
29 # - icmp echo ignore broadcasts,
30 # - setup lo interface
33 [ -f /etc/sysconfig/interfaces/ifcfg-lo ] && /sbin/ifup lo boot
40 proc_net ipv4/ip_forward start 1 0 IPV4_FORWARDING "IPv4 forwarding"
45 # deinitialize networking
46 # - down lo interface.
51 proc_net ipv4/ip_forward stop 1 0 IPV4_FORWARDING "IPv4 forwarding"
54 ipv4_anti_spoofing off
56 [ -f /etc/sysconfig/interfaces/ifcfg-lo ] && /sbin/ifdown lo boot
60 interfaces="`(cd /etc/sysconfig/interfaces && ls -1 ifcfg-* | grep -v ifcfg-lo | xargs ) 2> /dev/null`"
61 tunnels="`(cd /etc/sysconfig/interfaces && ls -1 tnlcfg-* | xargs ) 2> /dev/null`"
63 # See how we were called.
68 [ -f /etc/sysconfig/interfaces/$i ] && /sbin/tnlup $i boot
71 for i in $interfaces; do
72 [ -f /etc/sysconfig/interfaces/$i ] && /sbin/ifup $i boot
75 touch /var/lock/subsys/network
78 for i in $interfaces; do
79 [ -f /etc/sysconfig/interfaces/$i ] && /sbin/ifdown $i boot
83 [ -f /etc/sysconfig/interfaces/$i ] && /sbin/tnldown $i boot
87 rm -f /var/lock/subsys/network
90 echo "Configured devices:"
93 echo "Currently active devices:"
94 echo "`/sbin/ifconfig | grep ^[a-z] | awk '{print $1}'`"
96 echo "Configured tunnels:"
99 echo "Currently active tunnels:"
100 echo "`/sbin/ip tunnel show | egrep -v "^sit0|^tunl0" | cut -d":" -f1 | xargs`"
107 echo "Usage: network {start|stop|restart|status}"