#
# probe: true
-# $Id: network,v 1.48 2001/07/05 15:56:33 baggins Exp $
+# $Id: network,v 1.58 2002/12/17 14:01:10 baggins Exp $
PATH=/sbin:/usr/sbin:/bin:/usr/bin
# Source function library.
. /etc/rc.d/init.d/functions
-. /etc/sysconfig/network-scripts/.functions
+. /etc/sysconfig/network-scripts/functions.network
if [ ! -f /etc/sysconfig/network ]; then
nls "%s is missing. Can't continue." "/etc/sysconfig/network"
# initialize networking:
# - check IPv4, IPv6, IPX can be handled by system
# - setup default IPv{4,6} interfaces policy like:
-# - forwarding,
# - spoofig protection,
# - icmp echo ignore broadcasts,
# - setup lo interface
network_init()
{
+# Modprobe needed devices
+modprobe_net
+
# Kernel network parameters
run_cmd "Setting network parameters" sysctl -p /etc/sysctl.conf
# Set UP loopback interface
set_up_loopback
-# Modprobe needed devices
-modprobe_net
-
# Setup configuration
-setup_forwarding on
setup_nat on
setup_routes on
-
+setup_ip_rules on
# Setup IPX
if is_yes "$IPX"; then
if [ -n $IPXAUTOPRIMARY ] ; then
else
IPXAUTOPRIMARY="off"
fi
- /usr/bin/ipx_configure --auto_primary=$IPXAUTOPRIMARY
+ /sbin/ipx_configure --auto_primary=$IPXAUTOPRIMARY
fi
if [ -n $IPXAUTOFRAME ] ; then
if is_yes "$IPXAUTOFRAME"; then
else
IPXAUTOFRAME="off"
fi
- /usr/bin/ipx_configure --auto_interface=$IPXAUTOFRAME
+ /sbin/ipx_configure --auto_interface=$IPXAUTOFRAME
fi
if [ -n "$IPXINTERNALNETNUM" -a "$IPXINTERNALNETNUM" != "0" ]; then
- /usr/bin/ipx_internal_net add $IPXINTERNALNETNUM $IPXINTERNALNODENUM
+ /sbin/ipx_internal_net add $IPXINTERNALNETNUM $IPXINTERNALNODENUM
fi
fi
}
# - down lo interface.
network_deinit()
{
-setup_forwarding off
setup_routes off
+setup_ip_rules off
# Set down NAT rules
setup_nat off
-
# Set DOWN loopback interface
set_down_loopback
}
# find all the interfaces besides loopback.
# ignore aliases, alternative configurations, and editor backup files
-interfaces=$((cd /etc/sysconfig/interfaces && ls -1 ifcfg* | \
- egrep -v '(ifcfg-lo|:)' | egrep 'ifcfg-[a-z0-9]+$' | \
- awk ' { gsub(/ifcfg-/,NIL); print $0 } ') 2> /dev/null)
-interfaces_boot=$((cd /etc/sysconfig/interfaces && ls -1 ifcfg* | \
- egrep -v '(ifcfg-lo|ifcfg-sit|ifcfg-atm|ifcfg-lec|ifcfg-nas|:)' | egrep 'ifcfg-[a-z0-9\.]+$' | \
- xargs egrep -l "ONBOOT=[^n][^o]" | \
+interfaces_boot=$((
+ . /etc/rc.d/init.d/functions; \
+ cd /etc/sysconfig/interfaces && ls -1 ifcfg* | \
+ egrep -v '(ifcfg-lo|ifcfg-sit|ifcfg-atm|ifcfg-lec|ifcfg-nas|:)' | \
+ egrep 'ifcfg-[a-z0-9\.]+$' | \
+ for i in `cat`; do \
+ ONBOOT=""; . /etc/sysconfig/interfaces/"$i"; is_yes "$ONBOOT" && echo "$i"; \
+ done | \
awk ' { gsub(/ifcfg-/,NIL); print $0 } ') 2> /dev/null)
-interfaces_sit_boot=$((cd /etc/sysconfig/interfaces && ls -1 ifcfg-sit* | \
- egrep 'ifcfg-[a-z0-9]+$' | xargs egrep -l "ONBOOT=[^n][^o]" | \
+interfaces_sit_boot=$((
+ . /etc/rc.d/init.d/functions; \
+ cd /etc/sysconfig/interfaces && ls -1 ifcfg-sit* | \
+ egrep 'ifcfg-[a-z0-9]+$' | \
+ for i in `cat`; do \
+ ONBOOT=""; . /etc/sysconfig/interfaces/"$i"; is_yes "$ONBOOT" && echo "$i"; \
+ done | \
awk ' { gsub(/ifcfg-/,NIL); print $0 } ') 2> /dev/null)
tunnels=$((cd /etc/sysconfig/interfaces && ls -1 tnlcfg-* | \
xargs egrep -l "ONBOOT=[^n][^o]" | \
run_cmd -a "$(nls 'Bringing up interface') $i" /sbin/ifup $i boot
done
- for i in $(find_ldap_interfaces) ; do
- run_cmd -a "$(nls 'Bringing up interface from LDAP') $i" /sbin/ifup $i boot
- done
-
for i in $tunnels; do
run_cmd -a "$(nls 'Setting tunnel') $i" /sbin/tnlup $i boot
run_cmd -a "$(nls 'Bringing up tunnel interface') $i" /sbin/ifup tnlcfg-$i boot
run_cmd -a "$(nls 'Removing tunnel') $i" /sbin/tnldown $i boot
done
- for i in $(find_ldap_interfaces) ; do
- run_cmd -a "$(nls 'Shutting down interface from LDAP') $i" /sbin/ifdown $i boot
- done
-
for i in $interfaces_sit_boot $interfaces_boot ; do
run_cmd -a "$(nls 'Shutting down interface') $i" /sbin/ifdown $i boot
done