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