]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/initscripts/init.d/net/ifdown
Red active wurde nur bei pptp erstellt -> gefixt
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / net / ifdown
CommitLineData
9c16cd92
MT
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#
bf7c473f 11# Version : 01.00
9c16cd92
MT
12#
13# Notes :
14#
15########################################################################
16
17. /etc/sysconfig/rc
18. ${rc_functions}
19eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
20
21if [ "$name" == "green" ]; then
22 DEVICE="${GREEN_DEV}"
23elif [ "$name" == "blue" ]; then
24 DEVICE="${BLUE_DEV}"
25elif [ "$name" == "orange" ]; then
26 DEVICE="${ORANGE_DEV}"
27elif [ "$name" == "red" ]; then
28 DEVICE="${RED_DEV}"
29fi
30
31if ip link show ${DEVICE} > /dev/null 2>&1
32then
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
621b327e
CS
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
9c16cd92
MT
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
621b327e
CS
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
9c16cd92
MT
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
621b327e
CS
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
9c16cd92
MT
62
63 elif [ "$name" == "red" ]; then
64 if [ "${RED_TYPE}" == "PPPOE" ]; then
bf7c473f 65 NAME=${name} /etc/rc.d/init.d/net/red/pppoe ${RED_DEV} down
9c16cd92
MT
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 \
bf7c473f 71 /etc/rc.d/init.d/net/common/dhcpcd ${RED_DEV} down
9c16cd92
MT
72 elif [ "${RED_TYPE}" == "STATIC" ]; then
73 NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK}\
74 NETADDRESS=${RED_NETADDRESS} BROADCAST=${RED_BROADCAST} \
64a42535
MT
75 DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY} \
76 /etc/rc.d/init.d/net/common/ipv4-static ${RED_DEV} down
9c16cd92 77 fi
bf7c473f
MT
78
79 ### Cleanup the system when red goes down ###
77d211a7 80 /usr/local/bin/dialctrl.pl down
bf7c473f
MT
81 rm -f /var/ipfire/red/iface
82
9c16cd92
MT
83 fi
84else
85 boot_mesg "Interface ${DEVICE} doesn't exist." ${WARNING}
86 echo_warning
87fi
88
89link_status=`ip link show $DEVICE 2> /dev/null`
90if [ -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
96fi
97
98# End $network_devices/ifdown