diff --git a/netsim/ansible/templates/initial/linux/ubuntu.j2 b/netsim/ansible/templates/initial/linux/ubuntu.j2 index 1b2fff83e..c33df24bf 100644 --- a/netsim/ansible/templates/initial/linux/ubuntu.j2 +++ b/netsim/ansible/templates/initial/linux/ubuntu.j2 @@ -158,9 +158,9 @@ network: transmit-hash-policy: encap3+4 {% else %} {{ l.ifname }}: -{% if l.mtu is defined %} +{% if l.mtu is defined %} mtu: {{ l.mtu }} -{% endif %} +{% endif %} {% endif %} {% if l.dhcp.client.ipv4|default(False) %} dhcp4: true @@ -168,7 +168,7 @@ network: {% if l.dhcp.client.ipv6|default(False) %} dhcp6: true {% endif %} -{% for af in ('ipv4','ipv6') if af in l %} +{% for af in ('ipv4','ipv6') if af in l and l[af] is string %} {% if loop.first %} addresses: {% endif %} diff --git a/netsim/ansible/templates/initial/linux/vanilla.j2 b/netsim/ansible/templates/initial/linux/vanilla.j2 index e55d2772d..db0e5a68a 100644 --- a/netsim/ansible/templates/initial/linux/vanilla.j2 +++ b/netsim/ansible/templates/initial/linux/vanilla.j2 @@ -33,13 +33,13 @@ ip -6 addr add {{ loopback.ipv6 }} dev lo {{ create_bond_dev(l,node_provider) }} {% endif %} ip link set dev {{ l.ifname }} up -{% if l.ipv4 is defined %} +{% if l.ipv4 is defined and l.ipv4 is string %} set +e ip addr del {{ l.ipv4 }} dev {{ l.ifname }} 2>/dev/null set -e ip addr add {{ l.ipv4 }} dev {{ l.ifname }} {% endif %} -{% if l.ipv6 is defined %} +{% if l.ipv6 is defined and l.ipv6 is string %} sysctl -w net.ipv6.conf.{{ l.ifname }}.disable_ipv6=0 set +e ip -6 addr del {{ l.ipv6 }} dev {{ l.ifname }} 2>/dev/null