]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/initscripts/init.d/network
Added whatmask
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / network
CommitLineData
3fd5feeb
MT
1#!/bin/sh
2########################################################################
3# Begin $rc_base/init.d/network
4#
5# Description : Network Control Script
6#
7# Authors : Michael Tremer - m.s.tremer@googlemail.com
8#
9c16cd92 9# Version : 01.00
3fd5feeb
MT
10#
11# Notes : Written for IPFire by its team
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. ${rc_functions}
97de2cae
MT
17eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
18eval $(/usr/local/bin/readhash /var/ipfire/dhcp/settings)
19eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings)
20eval $(/usr/local/bin/readhash /var/ipfire/vpn/settings)
069680ac 21
3fd5feeb
MT
22case "${1}" in
23 start)
9c16cd92
MT
24 boot_mesg "Loading iptables helper modules"
25 modprobe iptable_nat || failed=1
26 modprobe ip_conntrack || failed=1
27 modprobe ip_conntrack_ftp || failed=1
28 modprobe ip_nat_ftp || failed=1
29 modprobe ip_conntrack_h323 || failed=1
30 modprobe ip_nat_h323 || failed=1
31 modprobe ip_conntrack_irc || failed=1
32 modprobe ip_nat_irc || failed=1
33 modprobe ip_conntrack_mms || failed=1
34 modprobe ip_nat_mms || failed=1
35 modprobe ip_conntrack_pptp || failed=1
36 modprobe ip_nat_pptp || failed=1
37 modprobe ip_conntrack_sip || failed=1
38 modprobe ip_nat_sip || failed=1
39 (exit ${failed})
40 evaluate_retval
3fd5feeb
MT
41
42 # Remove possible leftover files
9c16cd92
MT
43 rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
44
3fd5feeb 45 boot_mesg "Setting up IPFire firewall rules"
069680ac
MT
46 /etc/rc.d/init.d/firewall start; evaluate_retval
47
3fd5feeb 48 boot_mesg "Setting up IP Accounting"
9c16cd92
MT
49 /etc/rc.d/helper/writeipac.pl || failed=1
50 /usr/sbin/fetchipac -S || failed=1
51 (exit ${failed})
52 evaluate_retval
069680ac 53
3fd5feeb 54 boot_mesg "Setting IPFire DMZ pinholes"
069680ac 55 /usr/local/bin/setdmzholes; evaluate_retval
3fd5feeb 56
9c16cd92 57 if [ "$CONFIG_TYPE" = "4" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
3fd5feeb 58 boot_mesg "Setting up wireless firewall rules"
069680ac 59 /usr/local/bin/restartwireless; evaluate_retval
3fd5feeb 60 fi
9c16cd92
MT
61
62 # Starting interfaces...
63 # GREEN
64 name=green /etc/rc.d/init.d/net/ifup
65
66 # BLUE
67 if [ "$CONFIG_TYPE" = "4" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
68 name=blue /etc/rc.d/init.d/net/ifup
69 fi
70
71 # ORANGE
72 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "7" ]; then
73 name=orange /etc/rc.d/init.d/net/ifup
74 fi
75
76 # RED
77 if [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
78 name=red /etc/rc.d/init.d/net/ifup
79 fi
406f019f 80 ;;
3fd5feeb
MT
81
82 stop)
406f019f
MT
83 # Stopping interfaces...
84 # GREEN
85 name=green /etc/rc.d/init.d/net/ifdown
86
87 # BLUE
88 if [ "$CONFIG_TYPE" = "4" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
89 name=blue /etc/rc.d/init.d/net/ifdown
90 fi
91
92 # ORANGE
93 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "7" ]; then
94 name=orange /etc/rc.d/init.d/net/ifdown
95 fi
96
97 # RED
98 if [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
99 name=red /etc/rc.d/init.d/net/ifdown
100 fi
3fd5feeb
MT
101 ;;
102
103 restart)
104 ${0} stop
105 sleep 1
106 ${0} start
107 ;;
108
109 *)
110 echo "Usage: ${0} {start|stop|restart}"
111 exit 1
112 ;;
113esac
114
115# End /etc/rc.d/init.d/network