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
)
22 if [ -n "${1}" ]; then
24 for i
in green red blue orange
; do
29 for i
in green red blue orange
; do
34 while [ ! $# = 0 ]; do
35 for i
in green red blue orange
; do
36 if [ "${i}" == "${1}" ]; then
45 [ "${ALL}" == "1" ] && init_networking
47 # Starting interfaces...
49 [ "$green" == "1" ] && /etc
/rc.d
/init.d
/networking
/green start
52 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
53 /etc
/rc.d
/init.d
/networking
/blue start
56 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
57 /etc
/rc.d
/init.d
/networking
/orange start
60 if [ "$red" == "1" ]; then
61 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
62 # Remove possible leftover files
63 rm -f /var
/ipfire
/red
/{active
,device
,dial-on-demand
,dns1
,dns2
,local-ipaddress
,remote-ipaddress
,resolv.conf
}
64 [ "$AUTOCONNECT" == "off" ] ||
/etc
/rc.d
/init.d
/networking
/red start
70 # Stopping interfaces...
72 [ "$green" == "1" ] && /etc
/rc.d
/init.d
/networking
/green stop
75 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
76 /etc
/rc.d
/init.d
/networking
/blue stop
79 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
80 /etc
/rc.d
/init.d
/networking
/orange stop
83 if [ "$red" == "1" ]; then
84 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
85 /etc
/rc.d
/init.d
/networking
/red stop
91 for i
in green red blue orange
; do
92 if [ "${!i}" == "1" ]; then
102 echo "Usage: ${0} {start|stop|restart} [device(s)]"
109 boot_mesg
"Loading firewall modules into the kernel"
110 modprobe iptable_nat || failed
=1
111 for i
in $
(find /lib
/modules
/$
(uname
-r) -name ip_conntrack
*); do
112 modprobe
$i || failed
=1
114 for i
in $
(find /lib
/modules
/$
(uname
-r) -name ip_nat
*); do
115 modprobe
$i || failed
=1
120 boot_mesg
"Setting up firewall"
121 /etc
/rc.d
/init.d
/firewall start
; evaluate_retval
123 boot_mesg
"Setting up traffic accounting"
124 /etc
/rc.d
/helper
/writeipac.pl || failed
=1
125 /usr
/sbin
/fetchipac
-S || failed
=1
129 boot_mesg
"Setting up DMZ pinholes"
130 /usr
/local
/bin
/setdmzholes
; evaluate_retval
132 if [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
133 boot_mesg
"Setting up wireless firewall rules"
134 /usr
/local
/bin
/restartwireless
; evaluate_retval
137 /etc
/rc.d
/init.d
/dnsmasq start
140 # End /etc/rc.d/init.d/network