Files
nova/nova/virt/interfaces.template
Jialiang 8107e5ced8 Update the file for IPv4-only or IPv6-only network
Clean the interface template file by making both IP versions independent,
including when using LXC containers.

Co-Authored-By: Yongfeng Du <dolpher.du@intel.com>

Change-Id: If0843502fe0a85cbd5eff777d9260c90cea4812a
Closes-Bug:#1355171
2019-10-02 16:54:20 +00:00

47 lines
1.2 KiB
Plaintext

# Injected by Nova on instance boot
#
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
{% for ifc in interfaces %}
auto {{ ifc.name }}
{% if ifc.address %}
iface {{ ifc.name }} inet static
hwaddress ether {{ ifc.hwaddress }}
address {{ ifc.address }}
netmask {{ ifc.netmask }}
broadcast {{ ifc.broadcast }}
{% if ifc.gateway %}
gateway {{ ifc.gateway }}
{% endif %}
{% if ifc.dns %}
dns-nameservers {{ ifc.dns }}
{% endif %}
{% endif %}
{% if use_ipv6 %}
{% if ifc.address_v6 %}
{% if libvirt_virt_type == 'lxc' %}
post-up ip -6 addr add {{ ifc.address_v6 }}/{{ifc.netmask_v6 }} dev ${IFACE}
{% if ifc.gateway_v6 %}
post-up ip -6 route add default via {{ ifc.gateway_v6 }} dev ${IFACE}
{% endif %}
{% else %}
iface {{ ifc.name }} inet6 static
hwaddress ether {{ ifc.hwaddress }}
address {{ ifc.address_v6 }}
netmask {{ ifc.netmask_v6 }}
{% if ifc.gateway_v6 %}
gateway {{ ifc.gateway_v6 }}
{% endif %}
{% if ifc.dns_v6 %}
dns-nameservers {{ ifc.dns_v6 }}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}