General-Fuctions gefixt, da der DHCP-Client die Strings mit einigen Leerstellen davor...
[people/pmueller/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}
bf7c473f 17eval $(/usr/local/bin/readhash /var/ipfire/vpn/settings)
97de2cae 18eval $(/usr/local/bin/readhash /var/ipfire/dhcp/settings)
bf7c473f 19eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
97de2cae 20eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings)
bf7c473f 21
069680ac 22
3fd5feeb
MT
23case "${1}" in
24 start)
9c16cd92
MT
25 boot_mesg "Loading iptables helper modules"
26 modprobe iptable_nat || failed=1
27 modprobe ip_conntrack || failed=1
28 modprobe ip_conntrack_ftp || failed=1
29 modprobe ip_nat_ftp || failed=1
30 modprobe ip_conntrack_h323 || failed=1
31 modprobe ip_nat_h323 || failed=1
32 modprobe ip_conntrack_irc || failed=1
33 modprobe ip_nat_irc || failed=1
34 modprobe ip_conntrack_mms || failed=1
35 modprobe ip_nat_mms || failed=1
36 modprobe ip_conntrack_pptp || failed=1
37 modprobe ip_nat_pptp || failed=1
38 modprobe ip_conntrack_sip || failed=1
39 modprobe ip_nat_sip || failed=1
40 (exit ${failed})
41 evaluate_retval
3fd5feeb
MT
42
43 # Remove possible leftover files
9c16cd92
MT
44 rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
45
3fd5feeb 46 boot_mesg "Setting up IPFire firewall rules"
069680ac
MT
47 /etc/rc.d/init.d/firewall start; evaluate_retval
48
3fd5feeb 49 boot_mesg "Setting up IP Accounting"
9c16cd92
MT
50 /etc/rc.d/helper/writeipac.pl || failed=1
51 /usr/sbin/fetchipac -S || failed=1
52 (exit ${failed})
53 evaluate_retval
069680ac 54
3fd5feeb 55 boot_mesg "Setting IPFire DMZ pinholes"
069680ac 56 /usr/local/bin/setdmzholes; evaluate_retval
3fd5feeb 57
9c16cd92 58 if [ "$CONFIG_TYPE" = "4" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
3fd5feeb 59 boot_mesg "Setting up wireless firewall rules"
069680ac 60 /usr/local/bin/restartwireless; evaluate_retval
3fd5feeb 61 fi
9c16cd92
MT
62
63 # Starting interfaces...
64 # GREEN
65 name=green /etc/rc.d/init.d/net/ifup
66
67 # BLUE
68 if [ "$CONFIG_TYPE" = "4" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
69 name=blue /etc/rc.d/init.d/net/ifup
70 fi
71
72 # ORANGE
73 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "7" ]; then
74 name=orange /etc/rc.d/init.d/net/ifup
75 fi
76
bf7c473f
MT
77 # Start DNSMASQ with defaults
78 killall -KILL dnsmasq 2> /dev/null
79 sleep 1
80 if [ "$DOMAIN_NAME_GREEN" == "" ]; then
81 /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases
82 else
83 /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases -s "$DOMAIN_NAME_GREEN"
84 fi
85
9c16cd92
MT
86 # RED
87 if [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
bf7c473f
MT
88 if [ "$AUTOCONNECT" == "off" ]; then
89 echo -n # Do anything
90 else
91 name=red /etc/rc.d/init.d/net/ifup
92 fi
9c16cd92 93 fi
406f019f 94 ;;
3fd5feeb
MT
95
96 stop)
406f019f
MT
97 # Stopping interfaces...
98 # GREEN
99 name=green /etc/rc.d/init.d/net/ifdown
100
101 # BLUE
102 if [ "$CONFIG_TYPE" = "4" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
103 name=blue /etc/rc.d/init.d/net/ifdown
104 fi
105
106 # ORANGE
107 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "5" -o "$CONFIG_TYPE" = "7" ]; then
108 name=orange /etc/rc.d/init.d/net/ifdown
109 fi
110
111 # RED
112 if [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "6" -o "$CONFIG_TYPE" = "7" ]; then
113 name=red /etc/rc.d/init.d/net/ifdown
114 fi
3fd5feeb
MT
115 ;;
116
117 restart)
118 ${0} stop
119 sleep 1
120 ${0} start
121 ;;
122
123 *)
124 echo "Usage: ${0} {start|stop|restart}"
125 exit 1
126 ;;
127esac
128
129# End /etc/rc.d/init.d/network