]> git.ipfire.org Git - ipfire-2.x.git/blob - src/initscripts/init.d/net/ifdown
Red active wurde nur bei pptp erstellt -> gefixt
[ipfire-2.x.git] / src / initscripts / init.d / net / ifdown
1 #!/bin/sh
2 ########################################################################
3 # Begin $network_devices/ifdown
4 #
5 # Description : Interface Down
6 #
7 # Authors : Nathan Coulson - nathan@linuxfromscratch.org
8 # Kevin P. Fleming - kpfleming@linuxfromscratch.org
9 # Michael Tremer - mitch@ipfire.org
10 #
11 # Version : 01.00
12 #
13 # Notes :
14 #
15 ########################################################################
16
17 . /etc/sysconfig/rc
18 . ${rc_functions}
19 eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
20
21 if [ "$name" == "green" ]; then
22 DEVICE="${GREEN_DEV}"
23 elif [ "$name" == "blue" ]; then
24 DEVICE="${BLUE_DEV}"
25 elif [ "$name" == "orange" ]; then
26 DEVICE="${ORANGE_DEV}"
27 elif [ "$name" == "red" ]; then
28 DEVICE="${RED_DEV}"
29 fi
30
31 if ip link show ${DEVICE} > /dev/null 2>&1
32 then
33 if [ "$name" == "green" ]; then
34 NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK}\
35 NETADDRESS=${GREEN_NETADDRESS} BROADCAST=${GREEN_BROADCAST} \
36 /etc/rc.d/init.d/net/common/ipv4-static ${GREEN_DEV} down
37
38 if [ "${ENABLE_GREEN}" == "on" ]; then
39 boot_mesg "Bringing up dhcpd on device ${DEVICE}."
40 /etc/rc.d/init.d/net/common/dhcpd ${GREEN_DEV} down
41 fi
42
43 elif [ "$name" == "blue" ]; then
44 NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK}\
45 NETADDRESS=${BLUE_NETADDRESS} BROADCAST=${BLUE_BROADCAST} \
46 /etc/rc.d/init.d/net/common/ipv4-static ${BLUE_DEV} down
47
48 if [ "${ENABLE_BLUE}" == "on" ]; then
49 boot_mesg "Bringing up dhcpd on device ${DEVICE}."
50 /etc/rc.d/init.d/net/common/dhcpd ${BLUE_DEV} down
51 fi
52
53 elif [ "$name" == "orange" ]; then
54 NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK}\
55 NETADDRESS=${ORANGE_NETADDRESS} BROADCAST=${ORANGE_BROADCAST} \
56 /etc/rc.d/init.d/net/common/ipv4-static ${ORANGE_DEV} down
57
58 if [ "${ENABLE_ORANGE}" == "on" ]; then
59 boot_mesg "Bringing up dhcpd on device ${DEVICE}."
60 /etc/rc.d/init.d/net/common/dhcpd ${ORANGE_DEV} down
61 fi
62
63 elif [ "$name" == "red" ]; then
64 if [ "${RED_TYPE}" == "PPPOE" ]; then
65 NAME=${name} /etc/rc.d/init.d/net/red/pppoe ${RED_DEV} down
66 elif [ "${RED_TYPE}" == "PPTP" ]; then
67 echo
68 elif [ "${RED_TYPE}" == "DHCP" ]; then
69 NAME=${name} DHCP_HOSTNAME=${RED_DHCP_HOSTNAME} \
70 PRINTIP=yes PRINTALL=yes \
71 /etc/rc.d/init.d/net/common/dhcpcd ${RED_DEV} down
72 elif [ "${RED_TYPE}" == "STATIC" ]; then
73 NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK}\
74 NETADDRESS=${RED_NETADDRESS} BROADCAST=${RED_BROADCAST} \
75 DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY} \
76 /etc/rc.d/init.d/net/common/ipv4-static ${RED_DEV} down
77 fi
78
79 ### Cleanup the system when red goes down ###
80 /usr/local/bin/dialctrl.pl down
81 rm -f /var/ipfire/red/iface
82
83 fi
84 else
85 boot_mesg "Interface ${DEVICE} doesn't exist." ${WARNING}
86 echo_warning
87 fi
88
89 link_status=`ip link show $DEVICE 2> /dev/null`
90 if [ -n "${link_status}" ]; then
91 if echo "${link_status}" | grep -q UP; then
92 boot_mesg "Bringing down the ${DEVICE} interface..."
93 ip link set ${DEVICE} down
94 evaluate_retval
95 fi
96 fi
97
98 # End $network_devices/ifdown