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
36 boot_mesg
"Setting up firewall"
37 /etc
/rc.d
/init.d
/firewall start
; evaluate_retval
39 # boot_mesg "Setting up traffic accounting"
40 # /etc/rc.d/helper/writeipac.pl || failed=1
41 # /usr/sbin/fetchipac -S || failed=1
45 boot_mesg
"Setting up DMZ pinholes"
46 /usr
/local
/bin
/setdmzholes
; evaluate_retval
48 if [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
49 boot_mesg
"Setting up wireless firewall rules"
50 /usr
/local
/bin
/wirelessctrl
; evaluate_retval
53 /etc
/rc.d
/init.d
/dnsmasq start
59 if [ -n "${1}" ]; then
61 for i
in green red blue orange
; do
66 for i
in green red blue orange
; do
71 while [ ! $# = 0 ]; do
72 for i
in green red blue orange
; do
73 if [ "${i}" == "${1}" ]; then
82 [ "${ALL}" == "1" ] && init_networking
84 # Starting interfaces...
86 [ "$green" == "1" ] && /etc
/rc.d
/init.d
/networking
/green start
89 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
90 /etc
/rc.d
/init.d
/networking
/blue start
93 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
94 /etc
/rc.d
/init.d
/networking
/orange start
97 if [ "$red" == "1" ]; then
98 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
99 # Remove possible leftover files
100 rm -f /var
/ipfire
/red
/{active
,device
,dial-on-demand
,dns1
,dns2
,local-ipaddress
,remote-ipaddress
,resolv.conf
}
101 [ "$AUTOCONNECT" == "off" ] ||
/etc
/rc.d
/init.d
/networking
/red start
107 # Stopping interfaces...
109 [ "$green" == "1" ] && /etc
/rc.d
/init.d
/networking
/green stop
112 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
113 /etc
/rc.d
/init.d
/networking
/blue stop
116 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
117 /etc
/rc.d
/init.d
/networking
/orange stop
120 if [ "$red" == "1" ]; then
121 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
122 /etc
/rc.d
/init.d
/networking
/red stop
126 # Stopping dnsmasq if network all networks shutdown
127 [ "${ALL}" == "1" ] && /etc
/rc.d
/init.d
/dnsmasq stop
133 for i
in green red blue orange
; do
134 if [ "${!i}" == "1" ]; then
144 echo "Usage: ${0} {start|stop|restart} [device(s)]"
149 # End /etc/rc.d/init.d/network