2 ########################################################################
3 # Begin $rc_base/init.d/network
5 # Description : Network Control Script
7 # Authors : Michael Tremer - m.s.tremer@googlemail.com
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 if [ "${ALL}" == "1" ]; then
46 boot_mesg
"Loading iptables helper modules"
47 modprobe iptable_nat || failed
=1
48 modprobe ip_conntrack || failed
=1
49 modprobe ip_conntrack_ftp || failed
=1
50 modprobe ip_nat_ftp || failed
=1
51 modprobe ip_conntrack_h323 || failed
=1
52 modprobe ip_nat_h323 || failed
=1
53 modprobe ip_conntrack_irc || failed
=1
54 modprobe ip_nat_irc || failed
=1
55 modprobe ip_conntrack_mms || failed
=1
56 modprobe ip_nat_mms || failed
=1
57 modprobe ip_conntrack_pptp || failed
=1
58 modprobe ip_nat_pptp || failed
=1
59 modprobe ip_conntrack_sip || failed
=1
60 modprobe ip_nat_sip || failed
=1
64 boot_mesg
"Setting up IPFire firewall rules"
65 /etc
/rc.d
/init.d
/firewall start
; evaluate_retval
67 boot_mesg
"Setting up IP Accounting"
68 /etc
/rc.d
/helper
/writeipac.pl || failed
=1
69 /usr
/sbin
/fetchipac
-S || failed
=1
73 boot_mesg
"Setting IPFire DMZ pinholes"
74 /usr
/local
/bin
/setdmzholes
; evaluate_retval
76 if [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
77 boot_mesg
"Setting up wireless firewall rules"
78 /usr
/local
/bin
/restartwireless
; evaluate_retval
81 # Start DNSMASQ with defaults
82 killall
-KILL dnsmasq
2> /dev
/null
84 if [ "$DOMAIN_NAME_GREEN" == "" ]; then
85 /usr
/sbin
/dnsmasq
-l /var
/state
/dhcp
/dhcpd.leases
87 /usr
/sbin
/dnsmasq
-l /var
/state
/dhcp
/dhcpd.leases
-s "$DOMAIN_NAME_GREEN"
91 # Starting interfaces...
93 if [ "$green" == "1" ]; then
94 name
=green
/etc
/rc.d
/init.d
/net
/ifup
98 if [ "$blue" == "1" ]; then
99 if [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
100 name
=blue
/etc
/rc.d
/init.d
/net
/ifup
105 if [ "$orange" == "1" ]; then
106 if [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ]; then
107 name
=orange
/etc
/rc.d
/init.d
/net
/ifup
112 if [ "$red" == "1" ]; then
113 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
114 # Remove possible leftover files
115 rm -f /var
/ipfire
/red
/{active
,device
,dial-on-demand
,dns1
,dns2
,local-ipaddress
,remote-ipaddress
,resolv.conf
}
116 if [ "$AUTOCONNECT" == "off" ]; then
117 echo -n # Do anything
119 name
=red
/etc
/rc.d
/init.d
/net
/ifup
124 boot_mesg
"Setting OVPN Rules if enabled"
125 /etc
/rc.d
/init.d
/firewall startovpn
; evaluate_retval
129 # Stopping interfaces...
131 if [ "$green" == "1" ]; then
132 name
=green
/etc
/rc.d
/init.d
/net
/ifdown
136 if [ "$blue" == "1" ]; then
137 if [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
138 name
=blue
/etc
/rc.d
/init.d
/net
/ifdown
143 if [ "$orange" == "1" ]; then
144 if [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ]; then
145 name
=orange
/etc
/rc.d
/init.d
/net
/ifdown
150 if [ "$red" == "1" ]; then
151 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
152 name
=red
/etc
/rc.d
/init.d
/net
/ifdown
156 boot_mesg
"Deleting OVPN Rules if enabled"
157 /etc
/rc.d
/init.d
/firewall stopovpn
; evaluate_retval
161 for i
in green red blue orange
; do
162 if [ "${!i}" == "1" ]; then
172 echo "Usage: ${0} {start|stop|restart}"
177 # End /etc/rc.d/init.d/network