Commit 7c60f7a2 authored by Guido Trotter's avatar Guido Trotter

KVM nic script: use routed link as table

In order to be able to maintain the node network standard routing
untouched while routing instance traffic through a different dedicated
interface (eg: a gre tunnel) we need to specify the instance routing
path inside a separate table, which will also contain different default
gateway values. This patch fixes the kvm default network script to use
the nic link, if present, as a routing table to use instead of the
default one.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent a3db74e4
......@@ -169,7 +169,10 @@ class KVMHypervisor(hv_base.BaseHypervisor):
script.write(" /usr/sbin/brctl addif $BRIDGE $INTERFACE\n")
elif nic.nicparams[constants.NIC_MODE] == constants.NIC_MODE_ROUTED:
script.write(" # Route traffic targeted at the IP to the interface\n")
script.write(" /sbin/ip route add $IP/32 dev $INTERFACE\n")
if nic.nicparams[constants.NIC_LINK]:
script.write(" /sbin/ip route replace $IP/32 table $LINK dev $INTERFACE\n")
else:
script.write(" /sbin/ip route replace $IP/32 dev $INTERFACE\n")
interface_proxy_arp = "/proc/sys/net/ipv4/conf/$INTERFACE/proxy_arp"
script.write(" /bin/echo 1 > %s\n" % interface_proxy_arp)
script.write("fi\n\n")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment