]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/initscripts/init.d/net/ifdown
2 ########################################################################
3 # Begin $network_devices/ifdown
5 # Description : Interface Down
7 # Authors : Nathan Coulson - nathan@linuxfromscratch.org
8 # Kevin P. Fleming - kpfleming@linuxfromscratch.org
9 # Michael Tremer - mitch@ipfire.org
15 ########################################################################
19 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/ethernet
/settings
)
21 if [ "$name" == "green" ]; then
23 elif [ "$name" == "blue" ]; then
25 elif [ "$name" == "orange" ]; then
26 DEVICE
="${ORANGE_DEV}"
27 elif [ "$name" == "red" ]; then
31 if ip link show
${DEVICE} > /dev
/null
2>&1
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
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
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
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
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
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
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
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
79 ### Cleanup the system when red goes down ###
80 /usr
/local
/bin
/dialctrl.pl down
81 rm -f /var
/ipfire
/red
/iface
85 boot_mesg
"Interface ${DEVICE} doesn't exist." ${WARNING}
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
98 # End $network_devices/ifdown