diff --git a/patches/systemvm/debian/config/root/ipassoc.sh b/patches/systemvm/debian/config/root/ipassoc.sh index 4f49389bdbb..e967b7f8be1 100644 --- a/patches/systemvm/debian/config/root/ipassoc.sh +++ b/patches/systemvm/debian/config/root/ipassoc.sh @@ -37,7 +37,6 @@ add_nat_entry() { local ipNoMask=$(echo $1 | awk -F'/' '{print $1}') sudo ip link show $ethDev | grep "state DOWN" > /dev/null local old_state=$? - sudo ip link set $ethDev up sudo ip addr add dev $ethDev $pubIp sudo iptables -D FORWARD -i $ethDev -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -D FORWARD -i eth0 -o $ethDev -j ACCEPT @@ -45,16 +44,16 @@ add_nat_entry() { sudo iptables -A FORWARD -i $ethDev -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth0 -o $ethDev -j ACCEPT sudo iptables -t nat -I POSTROUTING -j SNAT -o $ethDev --to-source $ipNoMask ; - sudo arping -c 3 -I $ethDev -A -U -s $ipNoMask $ipNoMask; if [ $? -gt 0 -a $? -ne 2 ] then logger -t cloud "$(basename $0):Failed adding nat entry for ip $pubIp on interface $ethDev" return 1 fi logger -t cloud "$(basename $0):Added nat entry for ip $pubIp on interface $ethDev" - if [ $old_state -eq 0 ] + if [ $old_state -ne 0 ] then - sudo ip link set $ethDev down + sudo ip link set $ethDev up + sudo arping -c 3 -I $ethDev -A -U -s $ipNoMask $ipNoMask; fi return 0 @@ -87,13 +86,12 @@ add_an_ip () { sudo ip link show $ethDev | grep "state DOWN" > /dev/null local old_state=$? - sudo ip link set $ethDev up sudo ip addr add dev $ethDev $pubIp ; - sudo arping -c 3 -I $ethDev -A -U -s $ipNoMask $ipNoMask; - if [ $old_state -eq 0 ] + if [ $old_state -ne 0 ] then - sudo ip link set $ethDev down + sudo ip link set $ethDev up + sudo arping -c 3 -I $ethDev -A -U -s $ipNoMask $ipNoMask; fi return $? diff --git a/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ b/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ index 577f1c1400d..93539422753 100644 --- a/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ +++ b/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ @@ -2,6 +2,6 @@ ifconfig eth2 down && \ ifconfig eth2 hw ether [ETH2MAC] && \ -ifconfig eth2 [ETH2IP] && \ +ifconfig eth2 up && \ ip route add 0/0 via [GATEWAY] && \ service dnsmasq restart