summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README9
-rw-r--r--rc.inet118
-rw-r--r--rc.inet1.conf5
3 files changed, 32 insertions, 0 deletions
diff --git a/README b/README
index a92864a..9195deb 100644
--- a/README
+++ b/README
@@ -12,6 +12,15 @@ to a user branch, send me a mail with an ssh pubkey attached.
Current status of master branch:
* Complete feature parity with stock networking scripts
+
* Supports create/destroy of virtual tun/tap interfaces
and adding them to bridges
+* Supports additional IP addresses added to interfaces
+ in a way that's compatible with net-tools
+
+* TODO: IPv6 support ; suggestions welcome, as I really don't know
+ how I want to proceed with that. For home, I basically
+ rewrote (a very simple version of) the network scripts,
+ but that obviously doesn't scale :/
+
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
diff --git a/rc.inet1.conf b/rc.inet1.conf
index 93b3e6c..7fcc9bb 100644
--- a/rc.inet1.conf
+++ b/rc.inet1.conf
@@ -16,24 +16,28 @@
# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
+IPALIASES[0]=""
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""
# Config information for eth1:
IPADDR[1]=""
NETMASK[1]=""
+IPALIASES[1]=""
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""
# Config information for eth2:
IPADDR[2]=""
NETMASK[2]=""
+IPALIASES[2]=""
USE_DHCP[2]=""
DHCP_HOSTNAME[2]=""
# Config information for eth3:
IPADDR[3]=""
NETMASK[3]=""
+IPALIASES[3]=""
USE_DHCP[3]=""
DHCP_HOSTNAME[3]=""
@@ -52,6 +56,7 @@ DEBUG_ETH_UP="no"
#BRNICS[0]="eth0"
#IPADDR[0]="192.168.0.1"
#NETMASK[0]="255.255.255.0"
+#IPALIASES[0]=""
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""