Commit 22608e02 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

software/kvm: correctly setup network inside of the VM

don't add automatic route when adding IP address on interface because
the automatic route doesn't add "via XXXXXX" gateway option.

In KVM setup, the host machine is the gateway. We need to go through the
gateway because we can't reach directly the other VM running on
different slaptap interfaces.
parent 701eeb0b
Pipeline #9185 failed with stage
in 0 seconds
......@@ -19,7 +19,7 @@ md5sum = 092405e2fba77c22d4dc8cefcab677d8
[template-kvm]
filename = instance-kvm.cfg.jinja2
md5sum = 0db4ed796808b892a2e8a0aea704b13e
md5sum = 285558df4686116a92b39250f9e00f07
[template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in
......
......@@ -539,7 +539,8 @@ ipv6-network-info =
recipe = plone.recipe.command
filename = netconfig.sh
path = ${directory:public}/${:filename}
ipv4-add-address = ip -4 address add {{ slap_configuration.get('tap-ipv4-addr') }}/{{ slap_configuration.get('tap-ipv4-netmask') }} dev \$IFACE
ipv4-add-address = ip -4 address add {{ slap_configuration.get('tap-ipv4-addr') }}/{{ slap_configuration.get('tap-ipv4-netmask') }} dev \$IFACE noprefixroute
ipv4-add-gateway-route = ip -4 address add {{ slap_configuration.get('tap-ipv4-gateway') }} dev \$IFACE
{% if nat_restrict == 'true' -%}
ipv4-add-default-route = ip route add default via {{ slap_configuration.get('tap-ipv4-gateway') }} dev \$IFACE
{% elif global_ipv4_prefix -%}
......@@ -556,6 +557,7 @@ command =
ip a | grep eth0: && [ \$IFACE = ens3 ] && IFACE=eth0
ip a | grep eth1: && [ \$IFACE = ens4 ] && IFACE=eth1
${:ipv4-add-address}
${:ipv4-add-gateway-route}
${:ipv4-add-default-route}
${:ipv4-set-link-up}
EOF
......
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