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
18 . /etc/sysconfig/network
20 if [ "${NETWORKING}" = "" ]; then
24 if [ -f /etc/sysconfig/pcmcia ]; then
25 . /etc/sysconfig/pcmcia
28 if [ -f /etc/sysconfig/network-ip6 ]; then
29 . /etc/sysconfig/network-ip6
33 # Check that networking is up.
34 [ "${NETWORKING}" = "no" ] && exit 0
36 [ -x /sbin/ifconfig ] || exit 0
39 if [ "${IP6NETWORKING}" = "yes" ]; then
40 if [ -r /lib/modules/`uname -r`/ipv6/ipv6.o ]; then
41 /sbin/modprobe net-pf-10
45 # Even if IPX is configured, without the utilities we can't do much
46 [ ! -x /usr/bin/ipx_internal_net -o ! -x /usr/bin/ipx_configure ] && IPX=
48 cd /etc/sysconfig/network-scripts
50 # find all the interfaces besides loopback.
51 # ignore aliases, alternative configurations, and editor backup files
52 interfaces=`ls ifcfg* | egrep -v '(ifcfg-lo|:)' | egrep 'ifcfg-[a-z0-9]+$' | \
57 # Turn IP forwarding on or off. We do this before bringing up the
58 # interfaces to make sure we don't forward when we shouldn't, and
59 # we do it even if networking isn't configured (why not?).
60 if [ -d /proc/sys/net/ipv4 ]; then
61 # people could have left this out of their kernel, which isn't
63 if [ ! -f /proc/sys/net/ipv4/ip_forward ] ; then
64 echo "/proc/sys/net/ipv4/ip_forward is missing --" \
65 "cannot control IP forwarding" >&2
67 if [ "$FORWARD_IPV4" = "no" -o "$FORWARD_IPV4" = "false" ]; then
69 message="Disabling IPv4 packet forwarding"
72 message="Enabling IPv4 packet forwarding"
75 if [ $value != `cat /proc/sys/net/ipv4/ip_forward` ]; then
78 echo "$value" > /proc/sys/net/ipv4/ip_forward
85 ipv4_spoofing_protection ()
87 if [ -d /proc/sys/net/ipv4 ]; then
88 # people could have left this out of their kernel, which isn't
90 if [ ! -f /proc/sys/net/ipv4/conf/all/rp_filter ] ; then
91 echo "/proc/sys/net/ipv4/conf/all/rp_filter is missing --" \
92 "cannot control IP spoofing protection" >&2
94 if [ "$SPOOFING_IPV4" = "no" -o "$SPOOFING_IPV4" = "false" ]; then
96 message="Disabling IPv4 spoofing protection"
99 message="Enabling IPv4 spoofing protection"
102 if [ $value != `cat /proc/sys/net/ipv4/conf/all/rp_filter` ]; then
105 for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
115 ipv4_icmp_echo_ignore_broadcasts ()
117 if [ -d /proc/sys/net/ipv4 ]; then
118 # people could have left this out of their kernel, which isn't
120 if [ ! -f /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts ] ; then
121 echo "/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts is missing --" \
122 "cannot control IP ignoring icmp to broadcasts" >&2
124 if [ "$IGNORE_ICMP_BCAST_IPV4" = "no" -o "$IGNORE_ICMP_BCAST_IPV4" = "false" ]; then
126 message="Disabling IPv4 ign icmp_echo to our bcasts"
129 message="Enabling IPv4 ign icmp_echo to our bcasts"
132 if [ $value != `cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts` ]; then
135 echo "$value" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
143 # See how we were called.
147 ipv4_icmp_echo_ignore_broadcasts
153 /usr/bin/ipx_configure --auto_primary=$IPXAUTOPRIMARY \
154 --auto_interface=$IPXAUTOFRAME
155 /usr/bin/ipx_internal_net add $IPXINTERNALNETNUM $IPXINTERNALNODENUM
159 for i in $interfaces; do
163 ipv4_spoofing_protection
165 touch /var/lock/subsys/network
169 ipv4_spoofing_protection
171 for i in $interfaces; do
176 /usr/bin/ipx_internal_net del
180 show "Disabling IPv4 packet forwarding"
182 echo 0 > /proc/sys/net/ipv4/ip_forward
185 IGNORE_ICMP_BCAST_IPV4=no
186 ipv4_icmp_echo_ignore_broadcasts
188 rm -f /var/lock/subsys/network
191 echo "Configured devices:"
194 echo "Currently active devices:"
195 echo `/sbin/ifconfig | grep ^[a-z] | awk '{print $1}'`
202 echo "Usage: network {start|stop|restart|status}"