diff options
author | Bill Nottingham <notting@redhat.com> | 2002-03-25 14:26:55 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2002-03-25 14:26:55 +0000 |
commit | 98bb40d50dfe6a790b2fcd99f4e7504e95e49ebc (patch) | |
tree | bcb9edc7e4e940d7c27595c5ebcbed05169ea9a8 | |
parent | 8fd9f7c109df3584b927d86643c95d6353028eb4 (diff) | |
download | initscripts-98bb40d50dfe6a790b2fcd99f4e7504e95e49ebc.tar initscripts-98bb40d50dfe6a790b2fcd99f4e7504e95e49ebc.tar.gz initscripts-98bb40d50dfe6a790b2fcd99f4e7504e95e49ebc.tar.bz2 initscripts-98bb40d50dfe6a790b2fcd99f4e7504e95e49ebc.tar.xz initscripts-98bb40d50dfe6a790b2fcd99f4e7504e95e49ebc.zip |
SRCADDR stuff returns
-rw-r--r-- | sysconfig.txt | 3 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup | 18 |
2 files changed, 17 insertions, 4 deletions
diff --git a/sysconfig.txt b/sysconfig.txt index 5840f8ba..5fc10445 100644 --- a/sysconfig.txt +++ b/sysconfig.txt @@ -506,6 +506,7 @@ Files in /etc/sysconfig/network-scripts/ DEVICE=<name of physical device (except dynamically-allocated PPP devices where it is the "logical name")> IPADDR= + SRCADDR= NETMASK= GATEWAY= ONBOOT=yes|no @@ -520,6 +521,8 @@ Files in /etc/sysconfig/network-scripts/ file if PEERDNS is not set to "no". FIREWALL_MODS=yes|no modify firewall to attempt to allow DNS through. Defaults to 'yes'. + SRCADDR= + use the specified source address for outgoing packets If BOOTPROTO is not "none", then the only other item that must be set is the DEVICE item; all the rest will be determined diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index aeb6a302..219dcfde 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -203,13 +203,23 @@ else else SCOPE= fi - + + if [ -n "$SRCADDR" ]; then + SRC="src $SRCADDR" + else + SRC= + fi + if ! LC_ALL=C ip addr ls ${REALDEVICE} | grep -q "${IPADDR}/${PREFIX}" ; then if ! ip addr add ${IPADDR}/${PREFIX} \ brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then echo $"Error adding address ${IPADDR} for ${DEVICE}." fi fi + + if [ -n "$SRCADDR" ]; then + sysctl -w "net.ipv4.conf.${REALDEVICE}.arp_filter=1" >/dev/null 2>&1 + fi # update ARP cache of neighboring computers arping -q -A -c 1 -I ${REALDEVICE} ${IPADDR} @@ -218,16 +228,16 @@ else # Add a route for the subnet. Replace any existing route. if [ "${ISALIAS}" = no ]; then - ip route replace ${NETWORK}/${PREFIX} dev ${REALDEVICE} + ip route replace ${NETWORK}/${PREFIX} ${SRC} dev ${REALDEVICE} fi # Set a default route. if [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${REALDEVICE}" ]; then # set up default gateway if [ -n "${GATEWAY}" -a "`ipcalc --network ${GATEWAY} ${NETMASK} 2>/dev/null`" = "NETWORK=${NETWORK}" ]; then - ip route add default via ${GATEWAY} + ip route add default via ${GATEWAY} ${SRC} elif [ "${GATEWAYDEV}" = "${DEVICE}" ]; then - ip route add default dev ${REALDEVICE} + ip route add default ${SRC} dev ${REALDEVICE} fi fi fi |