3 # network Bring up/down networking
5 # chkconfig: 2345 10 90
6 # description: Activates/Deactivates all network interfaces configured to \
11 # $Id: network,v 1.30 1999/12/30 12:09:45 jajcus Exp $
14 NLS_DOMAIN="rc-scripts"
16 # Source function library.
17 . /etc/rc.d/init.d/functions
18 . /etc/sysconfig/network-scripts/.functions
20 [ ! -f /etc/sysconfig/network ] && exit 0
22 . /etc/sysconfig/network
24 # Check that networking is up.
25 [ "${NETWORKING}" = "no" -o "${NETWORKING}" = "" ] && exit 0
27 [ -x /sbin/ip ] || exit 0
30 # initialize networking:
31 # - check IPv4, IPv6, IPX can be handled by system
32 # - setup default IPv{4,6} interfaces policy like:
34 # - spoofig protection,
35 # - icmp echo ignore broadcasts,
36 # - setup lo interface
39 # Set UP loopback interface
42 # Modprobe needed devices
45 # Spoofing protection && dynamic IP && port range
47 ipv4_dynamic_ip_patch on
48 ipv4_local_port_range on
60 # Set static ARP table
66 # deinitialize networking
67 # - down lo interface.
74 # Spoofing protection && dynamic IP && port range
75 ipv4_anti_spoofing off
76 ipv4_dynamic_ip_patch off
77 ipv4_local_port_range off
82 # Set DOWN loopback interface
91 proc_net ipv4/ip_forward $TODO 1 0 IPV4_FORWARDING "IPv4 forwarding"
93 proc_net ipv6/conf/all/forwarding $TODO 1 0 IPV6_FORWARDING "IPv6 forwarding"
95 proc_net ipv4/conf/all/accept_redirects $TODO 1 0 IPV4_ACCEPT_ICMP_REDIR ""
96 proc_net ipv4/conf/all/accept_source_route $TODO 1 1 IPV4_ACCEPT_SOURCE_ROUTE ""
97 proc_net ipv4/conf/all/log_martians $TODO 1 0 IPV4_LOG_MARTIANS ""
98 proc_net ipv4/conf/all/mc_forwarding $TODO 1 0 IPV4_MULTICAST ""
99 proc_net ipv4/conf/all/proxy_arp $TODO 1 0 IPV4_PROXY_ARP ""
100 proc_net ipv4/conf/all/secure_redirects $TODO 1 1 IPV4_ACCEPT_ICMP_REDIR_GATE ""
101 proc_net ipv4/conf/all/send_redirects $TODO 1 1 IPV4_SEND_ICMP_REDIR ""
102 proc_net ipv4/icmp_echo_ignore_all $TODO 1 0 IPV4_IGN_ALL_ICMP ""
103 proc_net ipv4/icmp_echo_ignore_broadcasts $TODO 1 1 IPV4_IGN_CAST_ICMP ""
104 proc_net ipv4/ip_no_pmtu_disc $TODO 1 0 IPV4_MTU_DISCOVERY ""
105 proc_net ipv4/ip_masq_debug $TODO 1 0 IPV4_MASQ_DEBUGGING ""
106 proc_net ipv4/tcp_retrans_collapse $TODO 0 1 IPV4_RETRANS_COLLAPSE ""
107 proc_net ipv4/tcp_sack $TODO 0 1 IPV4_NO_SELECT_ACK ""
108 proc_net ipv4/tcp_timestamps $TODO 0 1 IPV4_NO_TIMESTAMPS ""
109 proc_net ipv4/tcp_stdurg $TODO 1 0 IPV4_RFC793 ""
110 proc_net ipv4/tcp_syncookies $TODO 1 0 IPV4_SYN_COOKIES ""
111 proc_net ipv4/tcp_window_scaling $TODO 1 0 IPV4_NO_WINDOW_SCALING ""
114 # find all the interfaces besides loopback.
115 # ignore aliases, alternative configurations, and editor backup files
116 interfaces="`(cd /etc/sysconfig/interfaces && ls ifcfg* | \
117 egrep -v '(ifcfg-lo|:)' | egrep 'ifcfg-[a-z0-9]+$' | sed 's/^ifcfg-//g' | xargs) 2> /dev/null`"
118 interfaces_boot="`(cd /etc/sysconfig/interfaces && ls ifcfg* | \
119 egrep -v '(ifcfg-lo|ifcfg-sit|:)' | egrep 'ifcfg-[a-z0-9]+$' | \
120 xargs egrep -l "ONBOOT=[^n][^o]" | sed 's/^ifcfg-//g') 2> /dev/null`"
121 interfaces_sit_boot="`(cd /etc/sysconfig/interfaces && ls ifcfg-sit* | \
122 egrep 'ifcfg-[a-z0-9]+$' | xargs egrep -l "ONBOOT=[^n][^o]" | sed 's/^ifcfg-//g') 2> /dev/null`"
123 tunnels="`(cd /etc/sysconfig/interfaces && ls -1 tnlcfg-* | \
124 xargs egrep -l "ONBOOT=[^n][^o]" | sed 's/^tnlcfg-//g') 2> /dev/null`"
126 # See how we were called.
131 for i in $interfaces_boot $interfaces_sit_boot ; do
135 for i in `find_ldap_interfaces` ; do
139 for i in $tunnels; do
141 /sbin/ifup tnlcfg-$i boot
146 touch /var/lock/subsys/network
149 for i in $tunnels; do
150 /sbin/ifdown tnlcfg-$i boot
151 /sbin/tnldown $i boot
154 for i in `find_ldap_interfaces` ; do
158 for i in $interfaces_sit_boot $interfaces_boot ; do
164 rm -f /var/lock/subsys/network
167 nls "Configured devices:"
168 echo "lo $interfaces"
169 nls "Configured tunnels:"
172 nls "Currently active devices and tunnels:"
173 /sbin/ip link show | egrep '^[^ ].*' |sed 's/[0-9]*: \(.*\):.*/\1/'|xargs
180 echo "Usage: $0 {start|stop|restart|status}"