summaryrefslogtreecommitdiffstats
path: root/rc.inet1
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackware.com>2017-07-14 00:37:42 -0500
committerRobby Workman <rworkman@slackware.com>2017-07-14 00:37:42 -0500
commit0ecfbbf1c758f94baf6e9345b0655821ec354271 (patch)
treeda60d15f9e207551260804e12b82c3e48e660d47 /rc.inet1
parentcf31861eb7ec40a5102373dadba1ef965bb4e983 (diff)
parent2dc4a206ae514565fbd0d55849731e549f29967c (diff)
downloadslacknetsetup-0ecfbbf1c758f94baf6e9345b0655821ec354271.tar.xz
Merge branch 'ipaliases'
Diffstat (limited to 'rc.inet1')
-rw-r--r--rc.inet118
1 files changed, 18 insertions, 0 deletions
diff --git a/rc.inet1 b/rc.inet1
index 871b38d..091dcfe 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -200,6 +200,15 @@ if_up() {
# 10 seconds should be a reasonable default DHCP timeout. 30 was too much.
echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}" | $LOGGER
/sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}
+ # If the dhcpcd call succeeds, add extra IP addresses, if defined, to interface
+ if [ "$?" == "0" -a ! -z "${IPALIASES[$1]}" ]; then
+ num=0
+ for ipalias in $(echo ${IPALIASES[$i]}); do
+ /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ;
+ num=$(($num + 1))
+ done
+ unset num
+ fi
else # bring up interface using a static IP address
if [ ! "${IPADDR[$i]}" = "" ]; then # skip unconfigured interfaces
# Determine broadcast address from the IP address and netmask:
@@ -211,6 +220,15 @@ if_up() {
if /sbin/ip link show dev ${1} | grep -wq "state DOWN" ; then
/sbin/ip link set dev ${1} up # Bring up interface
fi
+ # Add extra IP addresses, if defined, to interface
+ if [ ! -z "${IPALIASES[$i]}" ]; then
+ num=0
+ for ipalias in $(echo ${IPALIASES[$i]}); do
+ /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ;
+ num=$(($num + 1))
+ done
+ unset num
+ fi
else
if [ "$DEBUG_ETH_UP" = "yes" ]; then
echo "/etc/rc.d/rc.inet1: ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER