From e4dee8f5f614cd522bd3bce345ea23485d0baa01 Mon Sep 17 00:00:00 2001 From: Naredula Janardhana Reddy Date: Wed, 8 Feb 2012 18:51:47 +0530 Subject: [PATCH] Bug 12808: Summary of Changes: - Added Static Nat to use multiple routing tables. Reviewed-By: Kishan --- patches/systemvm/debian/config/root/firewall.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/patches/systemvm/debian/config/root/firewall.sh b/patches/systemvm/debian/config/root/firewall.sh index 9bc72869eb3..331de402f21 100755 --- a/patches/systemvm/debian/config/root/firewall.sh +++ b/patches/systemvm/debian/config/root/firewall.sh @@ -188,9 +188,14 @@ static_nat() { local dev=$(ip_to_dev $publicIp) [ $? -ne 0 ] && echo "Could not find device associated with $publicIp" && return 1 + local tableNo=$(echo $dev | awk -F'eth' '{print $2}') # shortcircuit the process if error and it is an append operation # continue if it is delete + (sudo iptables -t mangle $op PREROUTING -i $dev -d $publicIp \ + -j MARK --set-mark $tableNo) && + (sudo iptables -t mangle $op PREROUTING -i $dev -d $publicIp \ + -m state --state NEW -j CONNMARK --save-mark) && (sudo iptables -t nat $op PREROUTING -i $dev -d $publicIp -j DNAT \ --to-destination $instIp &>> $OUTFILE || [ "$op" == "-D" ]) && (sudo iptables $op FORWARD -i $dev -o eth0 -d $instIp -m state \