]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/net/common/ipv4-static
2 ########################################################################
3 # Begin $network_devices/services/ipv4-static
5 # Description : IPV4 Static Boot Script
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 [ -z "${BROADCAST}" ]; then
22 boot_mesg
"BROADCAST variable missing from input, cannot continue." ${FAILURE}
27 if [ -n "${ADDRESS}" -a -n "${NETMASK}" ]; then
28 PREFIX
=`whatmask ${NETMASK} | grep -e ^CIDR | awk -F': ' '{ print $2 }' | cut -c 2-`
29 args
="${args} ${ADDRESS}/${PREFIX} broadcast ${BROADCAST}"
31 boot_mesg
"ADDRESS and/or NETMASK variable missing from input, cannot continue." ${FAILURE}
38 boot_mesg
"Adding IPv4 address ${ADDRESS} to the ${1} interface..."
39 ip addr add
${args} dev
${1}
42 if [ -n "${GATEWAY}" ]; then
43 if ip route |
grep -q default
; then
44 boot_mesg
"Gateway already setup; skipping." ${WARNING}
47 boot_mesg
"Setting up default gateway..."
48 ip route add default via
${GATEWAY} dev
${1}
55 if [ -n "${GATEWAY}" ]; then
56 boot_mesg
"Removing default gateway..."
61 boot_mesg
"Removing IPv4 address ${ADDRESS} from the ${1} interface..."
62 ip addr del
${args} dev
${1}
67 echo "Usage: ${0} [interface] {up|down}"
72 # End $network_devices/services/ipv4-static