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
)
21 boot_mesg
"Loading firewall modules into the kernel"
22 modprobe iptable_nat || failed
=1
23 for i
in $
(find /lib
/modules
/$
(uname
-r) -name ip_conntrack
*); do
24 modprobe
$i || failed
=1
26 for i
in $
(find /lib
/modules
/$
(uname
-r) -name ip_nat
*); do
27 modprobe
$i || failed
=1
32 boot_mesg
"Setting up firewall"
33 /etc
/rc.d
/init.d
/firewall start
; evaluate_retval
35 boot_mesg
"Setting up traffic accounting"
36 /etc
/rc.d
/helper
/writeipac.pl || failed
=1
37 /usr
/sbin
/fetchipac
-S || failed
=1
41 boot_mesg
"Setting up DMZ pinholes"
42 /usr
/local
/bin
/setdmzholes
; evaluate_retval
44 if [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
45 boot_mesg
"Setting up wireless firewall rules"
46 /usr
/local
/bin
/restartwireless
; evaluate_retval
49 /etc
/rc.d
/init.d
/dnsmasq start
55 if [ -n "${1}" ]; then
57 for i
in green red blue orange
; do
62 for i
in green red blue orange
; do
67 while [ ! $# = 0 ]; do
68 for i
in green red blue orange
; do
69 if [ "${i}" == "${1}" ]; then
78 [ "${ALL}" == "1" ] && init_networking
80 # Starting interfaces...
82 [ "$green" == "1" ] && /etc
/rc.d
/init.d
/networking
/green start
85 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
86 /etc
/rc.d
/init.d
/networking
/blue start
89 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
90 /etc
/rc.d
/init.d
/networking
/orange start
93 if [ "$red" == "1" ]; then
94 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
95 # Remove possible leftover files
96 rm -f /var
/ipfire
/red
/{active
,device
,dial-on-demand
,dns1
,dns2
,local-ipaddress
,remote-ipaddress
,resolv.conf
}
97 [ "$AUTOCONNECT" == "off" ] ||
/etc
/rc.d
/init.d
/networking
/red start
103 # Stopping interfaces...
105 [ "$green" == "1" ] && /etc
/rc.d
/init.d
/networking
/green stop
108 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
109 /etc
/rc.d
/init.d
/networking
/blue stop
112 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
113 /etc
/rc.d
/init.d
/networking
/orange stop
116 if [ "$red" == "1" ]; then
117 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
118 /etc
/rc.d
/init.d
/networking
/red stop
124 for i
in green red blue orange
; do
125 if [ "${!i}" == "1" ]; then
135 echo "Usage: ${0} {start|stop|restart} [device(s)]"
140 # End /etc/rc.d/init.d/network