mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Bug 14120: Enabling SNAT for all the public NICs.
Summary of changes:
- snat flag is set to true if it is first ip of the NIC.
reviewed-by: Abhi
This commit is contained in:
parent
452fc54c0e
commit
d0a09732d2
@ -208,13 +208,15 @@ add_routing() {
|
||||
return 0;
|
||||
}
|
||||
add_snat() {
|
||||
local pubIp=$1
|
||||
local ipNoMask=$(echo $1 | awk -F'/' '{print $1}')
|
||||
if [ "$sflag" == "0" ]
|
||||
then
|
||||
logger -t cloud "$(basename $0):Remove SourceNAT $pubIp on interface $ethDev if it is present"
|
||||
sudo iptables -t nat -D POSTROUTING -j SNAT -o $ethDev --to-source $ipNoMask ;
|
||||
return 0;
|
||||
fi
|
||||
|
||||
local pubIp=$1
|
||||
local ipNoMask=$(echo $1 | awk -F'/' '{print $1}')
|
||||
logger -t cloud "$(basename $0):Added SourceNAT $pubIp on interface $ethDev"
|
||||
sudo iptables -t nat -D POSTROUTING -j SNAT -o $ethDev --to-source $ipNoMask ;
|
||||
sudo iptables -t nat -A POSTROUTING -j SNAT -o $ethDev --to-source $ipNoMask ;
|
||||
|
||||
@ -2335,6 +2335,10 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
|
||||
boolean add = (ipAddr.getState() == IpAddress.State.Releasing ? false : true);
|
||||
boolean sourceNat = ipAddr.isSourceNat();
|
||||
/* enable sourceNAT for the first ip of the public interface */
|
||||
if (firstIP) {
|
||||
sourceNat = true;
|
||||
}
|
||||
String vlanId = ipAddr.getVlanTag();
|
||||
String vlanGateway = ipAddr.getGateway();
|
||||
String vlanNetmask = ipAddr.getNetmask();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user