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
13 if [ ! -f /etc/sysconfig/network ]; then
17 . /etc/sysconfig/network
19 if [ -f /etc/sysconfig/pcmcia ]; then
20 . /etc/sysconfig/pcmcia
23 if [ -f /etc/sysconfig/network-ip6 ]; then
24 . /etc/sysconfig/network-ip6
28 # Check that networking is up.
29 [ "${NETWORKING}" = "no" ] && exit 0
31 [ -x /sbin/ifconfig ] || exit 0
34 if [ "${IP6NETWORKING}" = "yes" ]; then
35 if [ -r /lib/modules/`uname -r`/ipv6/ipv6.o ]; then
36 /sbin/modprobe net-pf-10
40 # Even if IPX is configured, without the utilities we can't do much
41 [ ! -x /usr/bin/ipx_internal_net -o ! -x /usr/bin/ipx_configure ] && IPX=
43 cd /etc/sysconfig/network-scripts
45 # find all the interfaces besides loopback.
46 # ignore aliases, alternative configurations, and editor backup files
47 interfaces=`ls ifcfg* | egrep -v '(ifcfg-lo|:)' | egrep 'ifcfg-[a-z0-9]+$' | \
52 # Turn IP forwarding on or off. We do this before bringing up the
53 # interfaces to make sure we don't forward when we shouldn't, and
54 # we do it even if networking isn't configured (why not?).
55 if [ -d /proc/sys/net/ipv4 ]; then
56 # people could have left this out of their kernel, which isn't
58 if [ ! -f /proc/sys/net/ipv4/ip_forward ] ; then
59 echo "/proc/sys/net/ipv4/ip_forward is missing --" \
60 "cannot control IP forwarding" >&2
62 if [ "$FORWARD_IPV4" = "no" -o "$FORWARD_IPV4" = "false" ]; then
64 message="Disabling IPv4 packet forwarding: "
67 message="Enabling IPv4 packet forwarding :"
70 if [ $value != `cat /proc/sys/net/ipv4/ip_forward` ]; then
73 echo "$value" > /proc/sys/net/ipv4/ip_forward
80 ipv4_spoofing_protection ()
82 if [ -d /proc/sys/net/ipv4 ]; then
83 # people could have left this out of their kernel, which isn't
85 if [ ! -f /proc/sys/net/ipv4/conf/all/rp_filter ] ; then
86 echo "/proc/sys/net/ipv4/conf/all/rp_filter is missing --" \
87 "cannot control IP spoofing protection" >&2
89 if [ "$SPOOFING_IPV4" = "no" -o "$SPOOFING_IPV4" = "false" ]; then
91 message="Disabling IPv4 spoofing protection: "
94 message="Enabling IPv4 spoofing protection: "
97 if [ $value != `cat /proc/sys/net/ipv4/conf/all/rp_filter` ]; then
100 for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
110 ipv4_icmp_echo_ignore_broadcasts ()
112 if [ -d /proc/sys/net/ipv4 ]; then
113 # people could have left this out of their kernel, which isn't
115 if [ ! -f /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts ] ; then
116 echo "/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts is missing --" \
117 "cannot control IP ignoring icmp to broadcasts" >&2
119 if [ "$IGNORE_ICMP_BCAST_IPV4" = "no" -o "$IGNORE_ICMP_BCAST_IPV4" = "false" ]; then
121 message="Disabling IPv4 ign icmp_echo to our bcasts: "
124 message="Enabling IPv4 ign icmp_echo to our bcasts: "
127 if [ $value != `cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts` ]; then
130 echo "$value" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
138 # See how we were called.
142 ipv4_icmp_echo_ignore_broadcasts
148 /usr/bin/ipx_configure --auto_primary=$IPXAUTOPRIMARY \
149 --auto_interface=$IPXAUTOFRAME
150 /usr/bin/ipx_internal_net add $IPXINTERNALNETNUM $IPXINTERNALNODENUM
154 for i in $interfaces; do
158 ipv4_spoofing_protection
160 touch /var/lock/subsys/network
164 ipv4_spoofing_protection
166 for i in $interfaces; do
171 /usr/bin/ipx_internal_net del
175 show "Disabling IPv4 packet forwarding: "
177 echo 0 > /proc/sys/net/ipv4/ip_forward
180 IGNORE_ICMP_BCAST_IPV4=no
181 ipv4_icmp_echo_ignore_broadcasts
183 rm -f /var/lock/subsys/network
186 echo "Configured devices:"
189 echo "Currently active devices:"
190 echo `/sbin/ifconfig | grep ^[a-z] | awk '{print $1}'`
197 echo "Usage: network {start|stop|restart|status}"