sonic-buildimage/files/image_config/interfaces/interfaces.j2
Prince Sunny 72f5d6bcb7 [interfaces]: Change MTU value to 9100 (#967)
* Updated MTU to the widely used value with other devices
2017-09-19 19:29:00 -07:00

112 lines
3.8 KiB
Django/Jinja

#
{% block banner %}
# =============== Managed by SONiC Config Engine DO NOT EDIT! ===============
# generated from /usr/share/sonic/templates/interfaces.j2 using sonic-cfggen
# file: /etc/network/interfaces
#
{% endblock banner %}
{% block loopback %}
# The loopback network interface
auto lo
iface lo inet loopback
# Use command 'ip addr list dev lo' to check all addresses
{% for (name, prefix) in LOOPBACK_INTERFACE %}
iface lo {{ 'inet' if prefix | ipv4 else 'inet6' }} static
address {{ prefix | ip }}
netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }}
#
{% endfor %}
{% endblock loopback %}
{% block mgmt_interface %}
# The management network interface
auto eth0
{% if MGMT_INTERFACE %}
{% for (name, prefix) in MGMT_INTERFACE %}
iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static
address {{ prefix | ip }}
netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }}
########## management network policy routing rules
# management port up rules
up ip route add default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default
up ip rule add from {{ prefix | ip }}/32 table default
{% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %}
up ip rule add to {{ route }} table default
{% endfor %}
# management port down rules
down ip route delete default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default
down ip rule delete from {{ prefix | ip }}/32 table default
{% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %}
down ip rule delete to {{ route }} table default
{% endfor %}
{# TODO: COPP policy type rules #}
{% endfor %}
{% else %}
iface eth0 inet dhcp
{% endif %}
#
{% endblock mgmt_interface %}
{% block front_panel_interfaces %}
# The switch front panel interfaces
{% for (name, prefix) in INTERFACE %}
allow-hotplug {{ name }}
iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static
mtu 9100
address {{ prefix | ip }}
netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }}
#
{% endfor %}
{% if VLAN %}
# "|| true" is added to suppress the error when interface is already a member of VLAN
{% for vlan in VLAN.keys()|sort %}
{% for member in VLAN[vlan]['members'] %}
allow-hotplug {{ member }}
iface {{ member }} inet manual
pre-up ifconfig {{ member }} up mtu 9100
post-up brctl addif {{ vlan }} {{ member }} || true
post-down ifconfig {{ member }} down
#
{% endfor %}
{% endfor %}
{% endif %}
{% if PORTCHANNEL %}
# "|| true" is added to suppress the error when interface is already a member of LAG
# "ip link show | grep -q master" is added to ensure interface is enslaved
{% for pc in PORTCHANNEL.keys()|sort %}
{% for member in PORTCHANNEL[pc]['members'] %}
allow-hotplug {{ member }}
iface {{ member }} inet manual
pre-up teamdctl {{ pc }} port add {{ member }} || true
post-up ip link show {{ member }} | grep -q master && ifconfig {{ member }} up
post-down ifconfig {{ member }} down
#
{% endfor %}
{% endfor %}
{% endif %}
{% endblock front_panel_interfaces %}
{% block vlan_interfaces %}
{% if VLAN_INTERFACE %}
# Vlan interfaces
{% for (name, prefix) in VLAN_INTERFACE.keys() | sort %}
auto {{ name }}
iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static
bridge_ports none
address {{ prefix | ip }}
netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }}
{% endfor %}
#
{% endif %}
{% endblock vlan_interfaces %}
{% block pc_interfaces %}
{% if PORTCHANNEL_INTERFACE %}
# Portchannel interfaces
{% for (name, prefix) in PORTCHANNEL_INTERFACE.keys() | sort %}
allow-hotplug {{ name }}
iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static
mtu 9100
address {{ prefix | ip }}
netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }}
#
{% endfor %}
{% endif %}
{% endblock pc_interfaces %}