From 05ad72a6c81027e977bc8566abf770cf0388899f Mon Sep 17 00:00:00 2001 From: Darren Austin Date: Thu, 24 May 2018 01:16:26 -0500 Subject: Fix up setting of IPALIASES and update docs Signed-off-by: Robby Workman --- manpages/rc.inet1.8 | 1 + manpages/rc.inet1.conf.5 | 14 ++++++++++---- netconfig | 5 ++++- rc.inet1 | 12 +++++++++--- rc.inet1.conf | 4 +++- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/manpages/rc.inet1.8 b/manpages/rc.inet1.8 index e78353a..ac8ce6a 100644 --- a/manpages/rc.inet1.8 +++ b/manpages/rc.inet1.8 @@ -105,6 +105,7 @@ The /etc/rc.d/rc.wireless script is not meant to be run on its own by the user! Patrick J. Volkerding Eric Hameleers Robby Workman +Darren 'Tadgy' Austin .SH "SEE ALSO" .BR rc.inet1.conf(5), .BR ip(8), diff --git a/manpages/rc.inet1.conf.5 b/manpages/rc.inet1.conf.5 index 1f790c0..2868317 100644 --- a/manpages/rc.inet1.conf.5 +++ b/manpages/rc.inet1.conf.5 @@ -58,7 +58,7 @@ IPADDR[1]="192.168.3.11" .br NETMASK[1]="255.255.255.0" .br -IPALIASES[1]="192.168.3.100" +IPALIASES[1]="192.168.3.100/24" .br USE_DHCP[1]="" .br @@ -118,9 +118,11 @@ NETMASK[0]="" (255.255.255.0 is common) .TP IPALIASES[0]="" -# Space separated list of additional IP addresses to bind to the -interface after initial configuration is complete. If USE_DHCP is -set to `yes' then additional addresses will only be added if the +# Space separated list of additional IP addresses to bind to the +interface after initial configuration is complete. An optional +netmask may be specified after the IP in the form 1.2.3.4/24. If no +netmask is specified the default of /32 will be used. If USE_DHCP +is set to `yes' then additional addresses will only be added if the dhcp client invocation is successful in obtaining a primary address. .TP USE_DHCP[0]="yes" @@ -145,6 +147,9 @@ MTU[0]="" # The default MTU is 1500, but you might need 1360 when you use NAT'ed IPSec traffic. IPv6 will likely require smaller MTUs as well .TP +PROMISCUOUS[0]="yes" +# Set promiscuous mode on the interface. +.TP DHCP_KEEPRESOLV[0]="yes" # If you do .B not @@ -249,5 +254,6 @@ to the number of network interfaces you wish to use. Patrick J. Volkerding Eric Hameleers Robby Workman +Darren 'Tadgy' Austin .SH "SEE ALSO" .BR rc.inet1(8) diff --git a/netconfig b/netconfig index 8e4abf5..5c5bf8a 100644 --- a/netconfig +++ b/netconfig @@ -128,10 +128,13 @@ DEBUG_ETH_UP="no" ## Config information for wlan0: #IFNAME[4]="wlan0" # Use a different interface name instead of # the default 'eth4' -#IFNAME[4]="eth0:1" # Set up an IP alias. +#IPALIASES[4]="192.168.5.10/24" # Set up an IP alias. A netmask may be given + # with a / after the IP address - if + # not supplied, /32 will be used as default. #HWADDR[4]="00:01:23:45:67:89" # Overrule the card's hardware MAC address #MTU[4]="" # The default MTU is 1500, but you might need # 1360 when you use NAT'ed IPSec traffic. +#PROMISCUOUS[4]="yes" # Set promiscuous mode on the interface. #DHCP_TIMEOUT[4]=15 # The default timeout for the DHCP client to # wait for server resonse is 15 seconds, but # you might want a shorter or longer wait. diff --git a/rc.inet1 b/rc.inet1 index 1f3cb60..cf9da0f 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/bash # /etc/rc.d/rc.inet1 # This script is used to bring up the various network interfaces. # @@ -209,7 +209,10 @@ if_up() { # Add extra IP addresses, if defined, to interface num=0 for ipalias in ${IPALIASES[$i]}; do - /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ; + ip="${ipalias%/*}" + nm="${ipalias#*/}" + [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="32" + /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num} num=$(($num + 1)) done fi @@ -230,7 +233,10 @@ if_up() { if [ -n "${IPALIASES[$i]}" ]; then num=0 for ipalias in ${IPALIASES[$i]}; do - /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ; + ip="${ipalias%/*}" + nm="${ipalias#*/}" + [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="32" + /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num} num=$(($num + 1)) done fi diff --git a/rc.inet1.conf b/rc.inet1.conf index cde99a9..551c4a7 100644 --- a/rc.inet1.conf +++ b/rc.inet1.conf @@ -104,7 +104,9 @@ DEBUG_ETH_UP="no" ## Config information for wlan0: #IFNAME[4]="wlan0" # Use a different interface name instead of # the default 'eth4' -#IFNAME[4]="eth0:1" # Set up an IP alias. +#IPALIASES[4]="192.168.5.10/24" # Set up an IP alias. A netmask may be given + # with a / after the IP address - if + # not supplied, /32 will be used as default. #HWADDR[4]="00:01:23:45:67:89" # Overrule the card's hardware MAC address #MTU[4]="" # The default MTU is 1500, but you might need # 1360 when you use NAT'ed IPSec traffic. -- cgit v1.2.3