2 ########################################################################
3 # Begin $rc_base/init.d/network
5 # Description : Network Control Script
7 # Authors : Michael Tremer - mitch@ipfire.org
11 # Notes : Written for IPFire by its team
13 ########################################################################
17 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/ethernet
/settings
)
20 boot_mesg
"Loading firewall modules into the kernel"
21 modprobe iptable_nat || failed
=1
22 for i
in $
(find /lib
/modules
/$
(uname
-r) -name nf_conntrack
*); do
23 modprobe $
(basename $i | cut
-d.
-f1) || failed
=1
25 for i
in $
(find /lib
/modules
/$
(uname
-r) -name nf_nat
*); do
26 modprobe $
(basename $i | cut
-d.
-f1) || failed
=1
31 if [ -e /var
/ipfire
/main
/disable_nf_sip
]; then
33 rmmod nf_conntrack_sip
35 rmmod nf_conntrack_h323
38 /etc
/rc.d
/init.d
/dnsmasq start
39 /etc
/rc.d
/init.d
/static-routes start
45 if [ -n "${1}" ]; then
47 for i
in green red blue orange
; do
52 for i
in green red blue orange
; do
57 while [ ! $# = 0 ]; do
58 for i
in green red blue orange
; do
59 if [ "${i}" == "${1}" ]; then
68 [ "${ALL}" == "1" ] && init_networking
70 # Starting interfaces...
72 [ "$green" == "1" ] && /etc
/rc.d
/init.d
/networking
/green start
75 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
76 /etc
/rc.d
/init.d
/networking
/blue start
79 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
80 /etc
/rc.d
/init.d
/networking
/orange start
83 if [ "$red" == "1" ]; then
84 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
85 # Remove possible leftover files
86 rm -f /var
/ipfire
/red
/{active
,device
,dial-on-demand
,dns1
,dns2
,local-ipaddress
,remote-ipaddress
,resolv.conf
}
87 [ "$AUTOCONNECT" == "off" ] ||
/etc
/rc.d
/init.d
/networking
/red start
93 # Stopping interfaces...
95 [ "$green" == "1" ] && /etc
/rc.d
/init.d
/networking
/green stop
98 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
99 /etc
/rc.d
/init.d
/networking
/blue stop
102 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
103 /etc
/rc.d
/init.d
/networking
/orange stop
106 if [ "$red" == "1" ]; then
107 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
108 /etc
/rc.d
/init.d
/networking
/red stop
112 # Stopping dnsmasq if network all networks shutdown
113 [ "${ALL}" == "1" ] && /etc
/rc.d
/init.d
/dnsmasq stop
119 for i
in green red blue orange
; do
120 if [ "${!i}" == "1" ]; then
130 echo "Usage: ${0} {start|stop|restart} [device(s)]"
135 # End /etc/rc.d/init.d/network