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 ip_conntrack
*); do
23 modprobe $
(basename $i | cut
-d.
-f1) || failed
=1
25 for i
in $
(find /lib
/modules
/$
(uname
-r) -name ip_nat
*); do
26 modprobe $
(basename $i | cut
-d.
-f1) || failed
=1
31 boot_mesg
"Setting up firewall"
32 /etc
/rc.d
/init.d
/firewall start
; evaluate_retval
34 # boot_mesg "Setting up traffic accounting"
35 # /etc/rc.d/helper/writeipac.pl || failed=1
36 # /usr/sbin/fetchipac -S || failed=1
40 boot_mesg
"Setting up DMZ pinholes"
41 /usr
/local
/bin
/setdmzholes
; evaluate_retval
43 if [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
44 boot_mesg
"Setting up wireless firewall rules"
45 /usr
/local
/bin
/wirelessctrl
; evaluate_retval
48 /etc
/rc.d
/init.d
/dnsmasq start
54 if [ -n "${1}" ]; then
56 for i
in green red blue orange
; do
61 for i
in green red blue orange
; do
66 while [ ! $# = 0 ]; do
67 for i
in green red blue orange
; do
68 if [ "${i}" == "${1}" ]; then
77 [ "${ALL}" == "1" ] && init_networking
79 # Starting interfaces...
81 [ "$green" == "1" ] && /etc
/rc.d
/init.d
/networking
/green start
84 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
85 /etc
/rc.d
/init.d
/networking
/blue start
88 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
89 /etc
/rc.d
/init.d
/networking
/orange start
92 if [ "$red" == "1" ]; then
93 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
94 # Remove possible leftover files
95 rm -f /var
/ipfire
/red
/{active
,device
,dial-on-demand
,dns1
,dns2
,local-ipaddress
,remote-ipaddress
,resolv.conf
}
96 [ "$AUTOCONNECT" == "off" ] ||
/etc
/rc.d
/init.d
/networking
/red start
102 # Stopping interfaces...
104 [ "$green" == "1" ] && /etc
/rc.d
/init.d
/networking
/green stop
107 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
108 /etc
/rc.d
/init.d
/networking
/blue stop
111 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
112 /etc
/rc.d
/init.d
/networking
/orange stop
115 if [ "$red" == "1" ]; then
116 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
117 /etc
/rc.d
/init.d
/networking
/red stop
121 # Stopping dnsmasq if network all networks shutdown
122 [ "${ALL}" == "1" ] && /etc
/rc.d
/init.d
/dnsmasq stop
128 for i
in green red blue orange
; do
129 if [ "${!i}" == "1" ]; then
139 echo "Usage: ${0} {start|stop|restart} [device(s)]"
144 # End /etc/rc.d/init.d/network