11c2e9ee3d
- Why it is required since SONiC master switches ifupdown package to the new implementation (ifupdown2), it is required to change the configuration of a platform-specific interface for wedge100bf_32x and wedge100bf_65x platforms (bc of ifupdown2 doesn't support auto mode for inet6 protocol). Also, need to make some refactoring and remove if platform == smth then.. from the system level scripts. - What I did removed customization of /usr/bin/interfaces-config.sh explicitly created directory /etc/network/interfaces.d added "source" to the /etc/network/interfaces generation template (to include platform-specific interfaces processing) added platform-specific interfaces config itself (for wedge100bf_32x and wedge100bf_65x) fixed testcase in sonic-config-engine - How to verify it build image for wedge100bf_32x perform sudo config reload -y on new installation check the correct configuration of usb0 interface - Description for the changelog Allow configuration of platform-specific interfaces
53 lines
2.3 KiB
Django/Jinja
53 lines
2.3 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 {{ '-4' if prefix | ipv4 else '-6' }} route add default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default
|
|
up ip {{ '-4' if prefix | ipv4 else '-6' }} route add {{ prefix | network }}/{{ prefix | prefixlen }} dev eth0 table default
|
|
up ip {{ '-4' if prefix | ipv4 else '-6' }} rule add from {{ prefix | ip }}/{{ '32' if prefix | ipv4 else '128' }} 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 {{ '-4' if prefix | ipv4 else '-6' }} route delete default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default
|
|
down ip {{ '-4' if prefix | ipv4 else '-6' }} route delete {{ prefix | network }}/{{ prefix | prefixlen }} dev eth0 table default
|
|
down ip {{ '-4' if prefix | ipv4 else '-6' }} rule delete from {{ prefix | ip }}/{{ '32' if prefix | ipv4 else '128' }} 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 %}
|
|
#
|
|
source /etc/network/interfaces.d/*
|
|
#
|
|
{% endblock mgmt_interface %}
|