2017-01-29 13:33:33 -06:00
|
|
|
#
|
|
|
|
{% block banner %}
|
2017-03-16 13:22:40 -05:00
|
|
|
# =============== Managed by SONiC Config Engine DO NOT EDIT! ===============
|
|
|
|
# generated from /usr/share/sonic/templates/interfaces.j2 using sonic-cfggen
|
|
|
|
# file: /etc/network/interfaces
|
2017-01-29 13:33:33 -06:00
|
|
|
#
|
2017-03-16 13:22:40 -05:00
|
|
|
{% endblock banner %}
|
2017-01-29 13:33:33 -06:00
|
|
|
{% block loopback %}
|
|
|
|
# The loopback network interface
|
|
|
|
auto lo
|
|
|
|
iface lo inet loopback
|
|
|
|
# Use command 'ip addr list dev lo' to check all addresses
|
|
|
|
{% for minigraph_lo_interface in minigraph_lo_interfaces %}
|
|
|
|
iface lo {{ 'inet' if minigraph_lo_interface['addr'] | ipv4 else 'inet6' }} static
|
|
|
|
address {{ minigraph_lo_interface['addr'] }}
|
|
|
|
netmask {{ minigraph_lo_interface['mask'] }}
|
|
|
|
#
|
|
|
|
{% endfor %}
|
|
|
|
{% endblock loopback %}
|
|
|
|
{% block mgmt_interface %}
|
|
|
|
# The management network interface
|
|
|
|
auto eth0
|
|
|
|
{% if minigraph_mgmt_interface['addr'] %}
|
|
|
|
iface eth0 inet static
|
|
|
|
address {{ minigraph_mgmt_interface['addr'] }}
|
|
|
|
netmask {{ minigraph_mgmt_interface['mask'] }}
|
2017-03-16 13:22:40 -05:00
|
|
|
########## management network policy routing rules
|
|
|
|
# management port up rules
|
2017-01-29 13:33:33 -06:00
|
|
|
up ip route add default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default
|
|
|
|
up ip rule add from {{ minigraph_mgmt_interface['addr'] }}/32 table default
|
2017-03-22 22:13:55 -05:00
|
|
|
{% for prefix in forced_mgmt_routes %}
|
|
|
|
up ip route add {{ prefix }} via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0
|
|
|
|
{% endfor %}
|
2017-03-16 13:22:40 -05:00
|
|
|
# management port down rules
|
2017-01-29 13:33:33 -06:00
|
|
|
down ip route delete default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default
|
|
|
|
down ip rule delete from {{ minigraph_mgmt_interface['addr'] }}/32 table default
|
2017-03-22 22:13:55 -05:00
|
|
|
{% for prefix in forced_mgmt_routes %}
|
|
|
|
down ip route delete {{ prefix }} via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0
|
|
|
|
{% endfor %}
|
2017-01-29 13:33:33 -06:00
|
|
|
{# TODO: COPP policy type rules #}
|
|
|
|
{% else %}
|
|
|
|
iface eth0 inet dhcp
|
|
|
|
{% endif %}
|
|
|
|
#
|
2017-03-16 13:22:40 -05:00
|
|
|
{% endblock mgmt_interface %}
|
|
|
|
{% block front_panel_interfaces %}
|
2017-01-29 13:33:33 -06:00
|
|
|
# The switch front panel interfaces
|
|
|
|
{% for interface in minigraph_interfaces %}
|
|
|
|
auto {{ interface['alias'] }}
|
2017-03-16 13:22:40 -05:00
|
|
|
allow-hotplug {{ interface['alias'] }}
|
2017-01-29 13:33:33 -06:00
|
|
|
iface {{ interface['alias'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static
|
|
|
|
address {{ interface['addr'] }}
|
|
|
|
netmask {{ interface['mask'] }}
|
|
|
|
#
|
|
|
|
{% endfor %}
|
2017-03-16 13:22:40 -05:00
|
|
|
{% for vlan_interface in minigraph_vlan_interfaces|unique_name %}
|
|
|
|
{% for interface in vlan_interface['members'] %}
|
|
|
|
auto {{ interface }}
|
|
|
|
allow-hotplug {{ interface }}
|
|
|
|
iface {{ interface }} inet manual
|
|
|
|
pre-up ifconfig {{ interface }} up
|
|
|
|
post-up brctl addif {{ vlan_interface['name'] }} {{ interface }}
|
|
|
|
post-down ifconfig {{ interface }} down
|
|
|
|
#
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
# Add || true to suppress the error when docker-teamd starts after docker-swss
|
|
|
|
{% for pc_interface in minigraph_portchannel_interfaces|unique_name %}
|
|
|
|
{% for interface in pc_interface['members'] %}
|
|
|
|
{% if pc_interface['name'] not in pc_set %}
|
|
|
|
auto {{ interface }}
|
|
|
|
allow-hotplug {{ interface }}
|
|
|
|
iface {{ interface }} inet manual
|
|
|
|
pre-up teamdctl {{ pc_interface['name'] }} port add {{ interface }} || true
|
|
|
|
post-down ifconfig {{ interface }} down
|
|
|
|
#
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endblock front_panel_interfaces %}
|
|
|
|
{% block vlan_interfaces %}
|
|
|
|
{% for vlan_interface in minigraph_vlan_interfaces %}
|
|
|
|
auto {{ vlan_interface['name'] }}
|
|
|
|
iface {{ vlan_interface['name'] }} {{ 'inet' if vlan_interface['addr'] | ipv4 else 'inet6' }} static
|
2017-03-20 23:39:09 -05:00
|
|
|
bridge_ports none
|
2017-03-16 13:22:40 -05:00
|
|
|
address {{ vlan_interface['addr'] }}
|
|
|
|
netmask {{ vlan_interface['mask'] }}
|
|
|
|
#
|
|
|
|
{% endfor %}
|
|
|
|
{% endblock vlan_interfaces %}
|
|
|
|
{% block pc_interfaces %}
|
|
|
|
{% for pc_interface in minigraph_portchannel_interfaces %}
|
|
|
|
auto {{ pc_interface['name'] }}
|
|
|
|
allow-hotplug {{ pc_interface['name'] }}
|
|
|
|
iface {{ pc_interface['name'] }} {{ 'inet' if pc_interface['addr'] | ipv4 else 'inet6' }} static
|
|
|
|
address {{ pc_interface['addr'] }}
|
|
|
|
netmask {{ pc_interface['mask'] }}
|
|
|
|
#
|
|
|
|
{% endfor %}
|
|
|
|
{% endblock pc_interfaces %}
|