### Basic Network Interface Configuration Example Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/interfaces.5.rst This example demonstrates a typical /etc/network/interfaces file structure, including loopback, static, DHCP, and sourced configurations. ```shell auto lo eth0 allow-hotplug eth1 iface lo inet loopback source /etc/network/interfaces.d/bridges iface eth0 inet static address 192.168.1.1/24 up flush-mail iface eth1 inet dhcp ``` -------------------------------- ### Install Suggested Dependencies Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/README.rst Install suggested dependencies for ifupdown2, which may enhance its functionality. ```console $ apt-get install ethtool bridge-utils python-gvgen python-mako ``` -------------------------------- ### Build and Install ifupdown2 Deb Package Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/README.rst Navigate to the cloned repository, checkout the master branch, and build the deb package. Then, install the generated deb file. ```console $ cd ifupdown2 && git checkout master && make deb ``` ```console $ dpkg -i ../ifupdown2_1.2.1_all.deb ``` -------------------------------- ### Configure IPv4 and IPv6 Addresses on an Interface Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md This example demonstrates how to configure both IPv4 and IPv6 addresses for the same interface within the `/etc/network/interfaces` file. Ensure the correct address family is specified. ```default auto swp1 iface swp1 address 12.0.0.1/30 address 12.0.0.2/30 address 2001:dee:eeef:2::1/64 ``` -------------------------------- ### Bond Interface Configuration Example Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md This snippet shows the configuration for a bond interface, including IP addresses, slave interfaces, bonding mode, and other relevant parameters. It is typically sourced from a separate file. ```default cumulus@switch:~$ cat /etc/network/interfaces.d/bond0 auto bond0 iface bond0 address 14.0.0.9/30 address 2001:ded:beef:2::1/64 bond-slaves swp25 swp26 bond-mode 802.3ad bond-miimon 100 bond-use-carrier yes bond-lacp-rate 1 bond-min-links 1 bond-xmit-hash-policy layer3+4 ``` -------------------------------- ### Clone and Build Ifupdown2 Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/gettingstarted.md Clone the ifupdown2 repository and navigate into the directory to build the package. Ensure you have the necessary build dependencies installed. ```bash git clone ifupdown2 cd ifupdown2/ifupdown2 ./build.sh ``` -------------------------------- ### Using Globs for Bridge Ports (Multiple Globs) Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md This example demonstrates using multiple `glob` patterns to define bridge ports, including ranges and specific patterns like `swp[1-6]s[0-3].100`. ```default auto br1 iface br1 bridge-ports glob swp7-9.100 swp11.100 glob swp15-18.100 ``` ```default auto br2 iface br2 bridge-ports glob swp[1-6]s[0-3].100 ``` -------------------------------- ### Install Mandatory Dependencies Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/README.rst Install the mandatory dependencies required for building the ifupdown2 deb package using apt-get. ```console $ apt-get install build-essential devscripts dh-systemd fakeroot python-all python-docutils iproute2 python-ipaddr python-setuptools ``` -------------------------------- ### Install Additional Build Dependencies Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/README.rst Install additional packages required for a successful deb file build. ```console $ apt-get install dh-python python3-all python3-setuptools python3-docutils ``` -------------------------------- ### Install Ifupdown2 Package Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/gettingstarted.md Install the generated .deb package for python-ifupdown2 using dpkg. This command installs the built package onto your system. ```bash dpkg -i .deb ``` -------------------------------- ### Using Globs for Bridge Ports (Simple Range) Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md The `glob` keyword allows specifying a range of ports for bridge membership. This example uses a simple range `swp1-6.100` for `bridge-ports`. ```default auto br0 iface br0 bridge-ports glob swp1-6.100 ``` -------------------------------- ### Configure VRF Interfaces Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Configures Virtual Routing and Forwarding for network isolation and management VRF setups. ```bash # /etc/network/interfaces # VRF definition with auto table assignment auto red iface red address 127.0.0.1/8 vrf-table auto # Interface assigned to VRF auto swp10.100 iface swp10.100 address 10.10.0.1/24 vrf red # Management VRF with DHCP auto eth0 iface eth0 inet dhcp vrf mgmt auto mgmt iface mgmt address 127.0.0.1/8 vrf-table auto vrf-default-route no ``` -------------------------------- ### Bridge Interface Configuration with Attributes Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/interfaces.5.rst Example of configuring a bridge interface (br0) with specified ports and Spanning Tree Protocol (STP) enabled. Additional attributes are detailed in ifupdown-addons-interfaces(5). ```shell auto br0 iface br0 address 12.0.0.4/24 address 2000:1000:1000:1000:3::5/128 bridge-ports swp1 swp2 swp3 bridge-stp on ``` -------------------------------- ### Print Interface Dependency List (Single Interface) Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md To see the dependency chain for a specific interface, use the `--print-dependency=list` option followed by the interface name. This is useful for troubleshooting or understanding a particular interface's setup. ```bash cumulus@switch:~$ sudo ifup --print-dependency=list br2001 br2001 : ['bond1.2001', 'bond2.2001'] bond1.2001 : ['bond1'] bond2.2001 : ['bond2'] bond1 : ['swp29', 'swp30'] bond2 : ['swp31', 'swp32'] swp29 : None swp30 : None swp31 : None swp32 : None ``` -------------------------------- ### Enable Debug Output Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/README.rst To get debug output for ifupdown2 commands, use the --debug option. ```console --debug ``` -------------------------------- ### Bring Up All Interfaces Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifdown.8.rst Use 'ifup -a' to activate all network interfaces defined as 'auto' in the configuration file. ```bash ifup -a ``` -------------------------------- ### Sample /etc/network/interfaces File Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/interfaces.5.rst A comprehensive sample configuration file for /etc/network/interfaces, showcasing loopback, DHCP, manual, sourced, and template-based configurations. ```shell auto lo iface lo address 192.168.2.0/24 address 2001:dee:eeee:1::4/128 auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet manual address 192.168.2.0/24 address 2001:dee:eeee:1::4/128 # source files from a directory /etc/network/interfaces.d source /etc/network/interfaces.d/* # Using mako style templates % for v in [11,12]: auto vlan${v} iface vlan${v} inet static address 10.20.${v}.3/24 % endfor ``` -------------------------------- ### Configure Basic Interfaces Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Define loopback, DHCP, and static IP configurations in /etc/network/interfaces. ```bash # /etc/network/interfaces # Loopback interface auto lo iface lo inet loopback # Primary network interface with DHCP auto eth0 iface eth0 inet dhcp # Static IP configuration with multiple addresses auto swp1 iface swp1 address 10.0.0.1/24 address 10.0.0.2/24 address 2001:db8::1/64 gateway 10.0.0.254 mtu 9000 hwaddress 44:38:39:00:27:b8 alias "Production Network" ``` -------------------------------- ### Basic Interface Configuration with Scripts Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Defines a network interface with pre-up, up, post-up, pre-down, down, and post-down scripts for lifecycle management. ```bash auto swp1 iface swp1 address 10.0.0.1/24 pre-up /usr/local/bin/prepare-interface.sh swp1 up /usr/local/bin/configure-routing.sh post-up /usr/local/bin/notify-monitoring.sh up pre-down /usr/local/bin/notify-monitoring.sh down down /usr/local/bin/cleanup-routing.sh post-down /usr/local/bin/cleanup-interface.sh swp1 ``` -------------------------------- ### Configure bridge-hello Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the bridge hello time in seconds. ```text bridge-hello 2 ``` -------------------------------- ### Include External Interface Configuration Files Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md Organize network configurations by using the `source` directive in `/etc/network/interfaces` to include definitions from other files. This promotes modularity and easier management. ```default cumulus@switch:~$ cat /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp source /etc/network/interfaces.d/bond0 ``` -------------------------------- ### Dump interface configuration with dependencies Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifquery.8.rst Display configuration entries including all dependent interfaces. ```bash ifquery br0 --with-depends ``` -------------------------------- ### Source Interface Snippets Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Organizes configuration by sourcing external files or directories. ```bash # /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp # Source single file source /etc/network/interfaces.d/bonds # Source all files in directory source /etc/network/interfaces.d/* # Source with glob pattern source /etc/network/interfaces.d/*.conf ``` ```bash # /etc/network/interfaces.d/bonds auto bond0 iface bond0 address 14.0.0.9/30 bond-slaves swp25 swp26 bond-mode 802.3ad bond-miimon 100 ``` -------------------------------- ### Configure bridge-mcsqi Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the multicast startup query interval in seconds. ```text bridge-mcsqi 31 ``` -------------------------------- ### Print dependency information in list format Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifquery.8.rst Display interface dependency relationships as a list. ```bash ifquery --print-dependency=list -a ``` ```bash ifquery --print-dependency=list br2000 ``` -------------------------------- ### Print Interface Dependency List (All Interfaces) Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md Use this command to view the dependency list for all interfaces managed by ifupdown2. This helps understand the relationships between different network components. ```bash cumulus@switch:~$ sudo ifup --print-dependency=list -a lo : None eth0 : None bond0 : ['swp25', 'swp26'] bond1 : ['swp29', 'swp30'] bond2 : ['swp31', 'swp32'] br0 : ['bond1', 'bond2'] bond1.2000 : ['bond1'] bond2.2000 : ['bond2'] br2000 : ['bond1.2000', 'bond2.2000'] bond1.2001 : ['bond1'] bond2.2001 : ['bond2'] br2001 : ['bond1.2001', 'bond2.2001'] swp40 : None swp25 : None swp26 : None swp29 : None swp30 : None swp31 : None swp32 : None ``` -------------------------------- ### Use Mako Templates Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Generates repetitive interface configurations using Mako-style templating syntax. ```bash # /etc/network/interfaces # Template for multiple VLANs %for v in [11, 12, 13, 14]: auto vlan${v} iface vlan${v} address 10.20.${v}.1/24 bridge-ports glob swp1-4.${v} bridge-stp on %endfor # Template for interface addresses %for i in range(1, 5): auto swp${i} iface swp${i} address 10.0.${i}.1/24 %endfor # Template with variables <% id = 5 vlan = 100 %> %for i in range(0, 4): auto swp${id} iface swp${id} bridge-access ${vlan} mtu 9000 <% id += 1 vlan += 1 %> %endfor ``` -------------------------------- ### Pretty Print Interface Configuration with ifquery Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md Use `ifquery` to display the parsed configuration of a specific interface from the interfaces file. This helps in visualizing the applied settings. ```bash cumulus@switch:~$ sudo ifquery bond0 ``` ```default auto bond0 iface bond0 address 14.0.0.9/30 address 2001:ded:beef:2::1/64 bond-slaves swp25 swp26 bond-mode 802.3ad bond-miimon 100 bond-use-carrier yes bond-lacp-rate 1 bond-min-links 1 bond-xmit-hash-policy layer3+4 ``` -------------------------------- ### Activate Network Interfaces with ifup Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Use the ifup command to bring interfaces up, manage dependencies, or force reconfiguration. ```bash # Bring up a single interface sudo ifup eth0 # Bring up all auto interfaces sudo ifup -a # Bring up interface with all its dependencies sudo ifup --with-depends br2001 # Print dependency list without making changes sudo ifup --print-dependency=list br2001 # Verbose output for debugging sudo ifup -v swp1 # Force interface up even if already configured sudo ifup --force eth0 ``` -------------------------------- ### Configure VLAN-Unaware Bridges Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Set up traditional Linux bridges with STP and port membership. ```bash # /etc/network/interfaces # Bridge ports are automatically created as dependencies auto br0 iface br0 address 192.168.1.1/24 bridge-ports swp1 swp2 swp3 swp4 bridge-stp on bridge-fd 15 bridge-maxage 20 bridge-hello 2 # Bridge with bond members auto br-100 iface br-100 address 10.0.12.2/24 address 2001:dad:beef::3/64 bridge-ports bond1.100 bond2.100 bridge-stp on ``` -------------------------------- ### Bring Up Specific Interfaces Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifdown.8.rst Specify interface names after 'ifup' to bring up only those interfaces. Multiple interfaces can be listed, separated by spaces. ```bash ifup swp1 swp2 ``` -------------------------------- ### Configure VLAN Interfaces Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Sets up VLAN subinterfaces using dot notation, explicit IDs, or 802.1ad double tagging. ```bash # /etc/network/interfaces # VLAN using dot notation (auto-detected) auto swp1.100 iface swp1.100 address 10.100.0.1/24 # VLAN with explicit configuration auto vlan42 iface vlan42 vlan-raw-device swp22 vlan-id 42 vlan-protocol 802.1q address 10.42.0.1/24 # QinQ (802.1ad) double tagging auto swp1.100 iface swp1.100 vlan-protocol 802.1ad ``` -------------------------------- ### Dump interface configuration entries Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifquery.8.rst Display configuration file entries for all interfaces or specific ones. ```bash ifquery -a ``` ```bash ifquery br0 ``` -------------------------------- ### Query Interface Configuration with ifquery Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Display, validate, and check the state of network interfaces using ifquery. ```bash # Pretty print interface configuration sudo ifquery bond0 # Query all configured interfaces sudo ifquery -a # Check running state matches configuration sudo ifquery --check bond0 # Output running state in interfaces format sudo ifquery --running bond0 # JSON format output sudo ifquery --format=json bond0 # Show all supported attributes (syntax help) sudo ifquery --syntax-help # Print dependency graph in dot format sudo ifquery --print-dependency=dot br2001 ``` -------------------------------- ### Print Running Interface State with ifquery --running Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md Use `ifquery --running` to display the current operational state of interfaces, formatted according to the interfaces file syntax. This is useful for comparing live settings against the configuration file. ```bash cumulus@switch:~$ sudo ifquery --running bond0 ``` ```default auto bond0 iface bond0 bond-xmit-hash-policy layer3+4 bond-miimon 100 bond-lacp-rate 1 bond-min-links 1 bond-slaves swp25 swp26 bond-mode 802.3ad address 14.0.0.9/30 address 2001:ded:beef:2::1/64 ``` -------------------------------- ### Configure bridge-mcsqc Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the multicast startup query count. ```text bridge-mcsqc 2 ``` -------------------------------- ### Leaf Switch Configuration: Basic Interfaces Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Configuration for loopback, management, and uplink interfaces on a leaf switch. ```bash # /etc/network/interfaces auto lo iface lo inet loopback address 10.0.0.1/32 auto eth0 iface eth0 inet dhcp vrf mgmt auto mgmt iface mgmt address 127.0.0.1/8 vrf-table auto ``` -------------------------------- ### Configure Tunnel Interfaces Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Sets up GRE, IPIP, and GRE TAP tunnel interfaces. ```bash # /etc/network/interfaces # GRE tunnel auto gre1 iface gre1 tunnel-mode gre tunnel-local 192.168.1.1 tunnel-endpoint 192.168.2.1 tunnel-ttl 64 address 10.255.0.1/30 # IPIP tunnel auto ipip1 iface ipip1 tunnel-mode ipip tunnel-local 10.0.0.1 tunnel-endpoint 10.0.0.2 tunnel-dev eth0 address 172.16.0.1/30 # GRE TAP tunnel (Layer 2) auto gretap1 iface gretap1 tunnel-mode gretap tunnel-local 192.168.1.1 tunnel-endpoint 192.168.2.1 ``` -------------------------------- ### Configure MSTP Hello Time Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the hello time interval for MSTP. The default value is 2. ```bash mstpctl-hello 2 ``` -------------------------------- ### Dump Interface Configuration in JSON Format with ifquery Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md Leverage `ifquery --format=json` to retrieve interface configuration details in a structured JSON format. This is ideal for programmatic parsing and integration with other tools. ```bash cumulus@switch:~$ sudo ifquery --format=json bond0 ``` ```json { "auto": true, "config": { "bond-use-carrier": "yes", "bond-xmit-hash-policy": "layer3+4", "bond-miimon": "100", "bond-lacp-rate": "1", "bond-min-links": "1", "bond-slaves": "swp25 swp26", "bond-mode": "802.3ad", "address": [ "14.0.0.9/30", "2001:ded:beef:2::1/64" ] }, "addr_method": null, "name": "bond0", "addr_family": null } ``` -------------------------------- ### Bring Up Interface with Dependents Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifdown.8.rst Use the '--with-depends' option with 'ifup' to ensure that all interfaces dependent on the specified interface are also brought up. ```bash ifup br0 --with-depends ``` -------------------------------- ### Specify User Commands for Interface Lifecycle Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md User-defined commands can be hooked into the interface bring-up and bring-down sequences using keywords like `up`, `post-up`, `down`, etc., within the interface stanza in `/etc/network/interfaces`. These commands should be network-related. ```default auto swp1 iface swp1 address 12.0.0.1/30 up /sbin/foo bar ``` -------------------------------- ### Dump running state of interfaces Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifquery.8.rst Display the current running state of interfaces formatted as /etc/network/interfaces entries. ```bash ifquery --running br0 ``` ```bash ifquery --running --with-depends br0 ``` ```bash ifquery --running -a ``` -------------------------------- ### Print dependency information in dot format Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifquery.8.rst Display interface dependency relationships in dot format for graph visualization. ```bash ifquery --print-dependency=dot -a ``` ```bash ifquery --print-dependency=dot br2000 ``` -------------------------------- ### Report Operating System Information Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/README.rst When reporting bugs, include your operating system name and version by running 'uname -a'. ```console uname -a ``` -------------------------------- ### Use Globs for Port Lists Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Simplifies bridge port configuration using glob patterns for interface ranges. ```bash # /etc/network/interfaces # Bridge with glob port range auto br0 iface br0 bridge-ports glob swp1-6.100 # Multiple glob patterns auto br1 iface br1 bridge-ports glob swp7-9.100 swp11.100 glob swp15-18.100 # Pattern matching with brackets auto br2 iface br2 bridge-ports glob swp[1-6]s[0-3].100 ``` -------------------------------- ### Configure Ethtool Settings Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Adjusts link parameters like speed, duplex, and hardware offload features. ```bash # /etc/network/interfaces auto swp1 iface swp1 address 10.0.0.1/24 link-speed 10000 link-duplex full link-autoneg off link-fec rs link-lanes 4 # Offload settings auto eth0 iface eth0 address 192.168.1.1/24 gro-offload on tso-offload on gso-offload on ``` -------------------------------- ### Export All Interface Dependencies to DOT file Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md Redirect the DOT format output of all interface dependencies to a file. This allows for offline analysis or integration with external documentation tools. ```bash cumulus@switch:~$ sudo ifup --print-dependency=dot -a >interfaces_all.dot ``` -------------------------------- ### MSTP Configuration Parameters Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Configuration options for MSTP, including port settings, timers, and bridge properties. ```APIDOC ## MSTP Configuration ### Description Configuration options for Multiple Spanning Tree Protocol (MSTP). ### Parameters #### MSTP Settings - **mstpctl-portadminedge** (yes/no) - Enable/disable edge port state for a port. - **mstpctl-portbpdufilter** (yes/no) - Enable/disable BPDU filter on a port. - **mstpctl-fdelay** (integer) - Set forwarding delay time. - **mstpctl-portnetwork** (yes/no) - Enable/disable bridge assurance capability for a port. - **mstpctl-txholdcount** (integer) - Set bridge transmit hold count. - **mstpctl-forcevers** (string) - Force STP version (e.g., rstp). - **mstpctl-portautoedge** (yes/no) - Enable/disable auto transition to/from edge state of the port. - **mstpctl-maxhops** (integer) - Set bridge max hops. - **mstpctl-treeprio** (integer) - Set tree priority for MSTI instance. - **mstpctl-treeportprio** (integer) - Set port priority for MSTI instance. - **mstpctl-portpathcost** (integer) - Set bridge port path cost. - **mstpctl-portrestrtcn** (yes/no) - Enable/disable port ability to propagate received topology change notification. - **mstpctl-maxage** (integer) - Set maximum message age. - **mstpctl-hello** (integer) - Set hello time. - **mstpctl-portrestrrole** (yes/no) - Enable/disable port ability to take root role. - **mstpctl-bpduguard** (yes/no) - Enable/disable BPDU guard. - **mstpctl-ageing** (integer) - Set ageing time. - **mstpctl-treeportcost** (integer) - Set port tree cost. - **mstpctl-portp2p** (yes/no/auto) - Set bridge port P2P detection mode. ### Examples ``` mstpctl-portadminedge swp1=no mstpctl-portbpdufilter swp1=no mstpctl-fdelay 15 mstpctl-portnetwork swp1=no mstpctl-txholdcount 6 mstpctl-forcevers rstp mstpctl-portautoedge swp1=yes mstpctl-maxhops 15 mstpctl-treeprio 32768 mstpctl-treeportprio swp1=128 mstpctl-portpathcost swp1=0 mstpctl-portrestrtcn swp1=no mstpctl-maxage 20 mstpctl-hello 2 mstpctl-portrestrrole swp1=no mstpctl-bpduguard swp1=no mstpctl-ageing 300 mstpctl-treeportcost 0 mstpctl-portp2p swp1=no ``` ``` -------------------------------- ### Reload Network Configuration with ifreload Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Apply configuration changes without a full network restart using ifreload. ```bash # Reload all interface configurations sudo ifreload -a # Reload specific interface sudo ifreload eth0 # Reload with verbose output sudo ifreload -v -a # Dry run - show what would change sudo ifreload -a --syntax-check ``` -------------------------------- ### Configure VXLAN Interfaces Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Defines VXLAN overlay interfaces, including multicast support and bridge integration. ```bash # /etc/network/interfaces # Basic VXLAN interface auto vxlan42 iface vxlan42 vxlan-id 42 vxlan-local-tunnelip 10.0.0.1 vxlan-remoteip 10.0.0.2 vxlan-remoteip 10.0.0.3 vxlan-learning yes vxlan-port 4789 mtu 1500 # VXLAN with multicast auto vxlan100 iface vxlan100 vxlan-id 100 vxlan-local-tunnelip 172.16.20.1 vxlan-mcastgrp 239.1.1.100 vxlan-ttl 64 # VXLAN in bridge auto br-vxlan iface br-vxlan bridge-ports vxlan42 bond2 bridge-stp on mstpctl-portbpdufilter vxlan42=yes mstpctl-bpduguard vxlan42=yes ``` -------------------------------- ### Generate Interface Dependency Graph (DOT format) Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md This command generates a dependency graph for a specified interface in DOT format, which can be rendered by graph visualization tools. It helps in visualizing complex network relationships. ```bash cumulus@switch:~$ sudo ifup --print-dependency=dot br2001 /* Generated by GvGen v.0.9 (http://software.inl.fr/trac/wiki/GvGen) */ digraph G { compound=true; node1 [label="br2001"]; node2 [label="bond1.2001"]; node3 [label="bond2.2001"]; node4 [label="bond1"]; node5 [label="bond2"]; node6 [label="swp29"]; node7 [label="swp30"]; node8 [label="swp31"]; node9 [label="swp32"]; node1->node2; node1->node3; node2->node4; node3->node5; node4->node6; node4->node7; node5->node8; node5->node9; } ``` -------------------------------- ### Check Interface Configuration Match with ifquery --check Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md Employ `ifquery --check` to validate if the current running state of an interface matches its configuration in the interfaces file. It returns an exit code of 0 for a match and 1 otherwise. This is an experimental feature. ```bash cumulus@switch:~$ sudo ifquery --check bond0 ``` ```default iface bond0 bond-mode 802.3ad (✓) bond-miimon 100 (✓) bond-use-carrier yes (✓) bond-lacp-rate 1 (✓) bond-min-links 1 (✓) bond-xmit-hash-policy layer3+4 (✓) bond-slaves swp25 swp26 (✓) address 14.0.0.9/30 (✓) address 2001:ded:beef:2::1/64 (✓) ``` -------------------------------- ### Check interface running state Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifquery.8.rst Verify the current running state of an interface against the configuration file. Returns exit code 0 on success and 1 on error. ```bash ifquery --check br0 ``` ```bash ifquery --check --with-depends br0 ``` ```bash ifquery --check -a ``` -------------------------------- ### Configure ethtool link-speed Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the link speed in Mbps. ```text link-speed 1000 ``` -------------------------------- ### Configure Multiple IP Addresses on an Interface Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md In the `/etc/network/interfaces` file, multiple IP addresses can be assigned to a single interface by listing them under the `iface` stanza using the `address` keyword. This supports both IPv4 and IPv6. ```default auto swp1 iface swp1 address 12.0.0.1/30 address 12.0.0.2/30 ``` -------------------------------- ### Address Configuration Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Configuration for interface IP addresses and hardware settings. ```APIDOC ## Address Configuration ### Parameters - **address** (string) - Optional - ipv4 or ipv6 addresses. Example: 10.0.12.3/24 - **broadcast** (string) - Optional - broadcast address. Example: 10.0.1.255 - **hwaddress** (string) - Optional - hw address. Example: 44:38:39:00:27:b8 - **alias** (string) - Optional - description/alias. Example: testnetwork ``` -------------------------------- ### Configure MSTP Port P2P Detection Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the port point-to-point detection mode for MSTP. Valid options are 'yes', 'no', or 'auto'. ```bash mstpctl-portp2p swp1=no swp2=no ``` -------------------------------- ### Configure MSTP Force Version Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Forces the STP version for the MSTP bridge. The default is 'rstp'. ```bash mstpctl-forcevers rstp ``` -------------------------------- ### Configure bridge-gcint Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the bridge garbage collection interval in seconds. ```text bridge-gcint 4 ``` -------------------------------- ### Declare Switch Port Interfaces with Templates Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md Employ Mako templates to declare switch port interfaces and assign IP addresses. This is useful for repetitive configurations across multiple ports. ```default %for i in [1,12]: auto swp${i} iface swp${i} address 10.20.${i}.3/24 ``` -------------------------------- ### ifquery - Query Network Interface Configuration Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifquery.8.rst The ifquery command parses the interfaces file, queries the running state, or checks the running state of interfaces against the configuration in /etc/network/interfaces. ```APIDOC ## ifquery ### Description Parses interface configuration file, queries running state or checks running state of the interface with configuration in **/etc/network/interfaces** file. ### Method N/A (Command-line utility) ### Endpoint N/A ### Parameters #### Positional Arguments - **IFACE** (string) - Required - Interface list separated by spaces. **IFACE** list and **'-a'** argument are mutually exclusive. #### Optional Arguments - **-h, --help** (boolean) - show this help message and exit - **-a, --all** (boolean) - process all interfaces marked "auto" - **-v, --verbose** (boolean) - verbose output - **-d, --debug** (boolean) - output debug info - **--allow CLASS** (string) - ignore non-"allow-CLASS" interfaces - **-w, --with-depends** (boolean) - run with all dependent interfaces. This option is redundant when -a is specified. When '-a' is specified, interfaces are always executed in dependency order. - **-X EXCLUDEPATS, --exclude EXCLUDEPATS** (string) - Exclude interfaces from the list of interfaces to operate on. Can be specified multiple times. If the excluded interface has dependent interfaces, (e.g. a bridge or a bond with multiple enslaved interfaces) then each dependent interface must be specified in order to be excluded. - **-i INTERFACESFILE, --interfaces INTERFACESFILE** (string) - Use interfaces file instead of default defined in ifupdown2.conf (default /etc/network/interfaces) - **-t {native,json}, --interfaces-format {native,json}** (string) - interfaces file format - **-r, --running** (boolean) - print raw interfaces file entries - **-c, --check** (boolean) - check interface file contents against running state of an interface. Returns exit code 0 on success and 1 on error - **-x, --raw** (boolean) - print raw config file entries - **-o {native,json}, --format {native,json}** (string) - interface display format - **-p, --print-dependency {list,dot}** (string) - print iface dependency in list or dot format - **-s, --syntax-help** (boolean) - print supported interface config syntax. Scans all addon modules and dumps supported syntax from them if provided by the module. ### Request Example ```bash ifquery -a ifquery br0 ifquery br0 --with-depends ifquery --check br0 ifquery --check --with-depends br0 ifquery --check -a ifquery --running br0 ifquery --running --with-depends br0 ifquery --running -a ifquery --print-dependency=list -a ifquery --print-dependency=list br2000 ifquery --print-dependency=dot -a ifquery --print-dependency=dot br2000 ifquery --print-dependency=dot -a > interfaces.dot ``` ### Response Output varies based on the options used. For example, `--running` will print raw interface entries, `--check` will return an exit code, and `--print-dependency` will output in list or dot format. #### Success Response (Exit Code 0) - **Output** (string) - Varies based on options. For `--check`, success is indicated by exit code 0. #### Error Response (Exit Code 1) - **Output** (string) - Varies based on options. For `--check`, error is indicated by exit code 1. ### Known Issues - `ifquery --check` is currently experimental. - `ifquery --check` cannot validate user commands given under pre-up, post-up etc. - There is currently no support to check/validate ethtool iface attributes. ``` -------------------------------- ### ifupdown2 Configuration File Settings Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Main configuration file for ifupdown2, controlling various behaviors like logging, template processing, and addon support. ```ini # /etc/network/ifupdown2/ifupdown2.conf # Enable persistent debug logging enable_persistent_debug_logging=yes # Enable template processing template_enable=1 template_engine=mako template_lookuppath=/etc/network/ifupdown2/templates # Default interfaces file location default_interfaces_configfile=/etc/network/interfaces # Enable addon module syntax checking addon_syntax_check=0 # Support legacy ifupdown scripts addon_scripts_support=1 # Enable Python addon modules addon_python_modules_support=1 # Allow multiple VLAN-aware bridges multiple_vlan_aware_bridge_support=0 # ifquery check output strings ifquery_check_success_str=pass ifquery_check_error_str=fail # Link master owns slave state link_master_slave=1 # ifreload behavior ifreload_down_changed=0 # Auto-adjust MTU for logical devices adjust_logical_dev_mtu=1 # State file directory state_dir=/var/tmp/network/ ``` -------------------------------- ### Configure MSTP Port Admin Edge Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the administrative edge state for MSTP ports. Use 'yes' to enable or 'no' to disable. ```bash mstpctl-portadminedge swp1=no swp2=no ``` -------------------------------- ### Declare VLAN Interfaces with Templates Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md Use Mako templates to dynamically declare multiple VLAN interfaces with specific IP addresses and bridge port configurations. Ensure the Mako engine is processed before parsing. ```default %for v in [11,12]: auto vlan${v} iface vlan${v} address 10.20.${v}.3/24 bridge-ports glob swp19-20.${v} bridge-stp on %endfor ``` -------------------------------- ### Clone ifupdown2 Repository Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/README.rst Use this command to clone the public repository of ifupdown2 from GitHub. ```console $ git clone git://github.com/CumulusNetworks/ifupdown2 ``` -------------------------------- ### Configure Bonded Interfaces and Bridge Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/docs/source/userguide.md Sets up bonded interfaces (LAGs) and a bridge that uses these bonded interfaces. This configuration is useful for link aggregation and high availability. ```default auto bond1 iface bond1 address 100.0.0.2/16 bond-slaves swp29 swp30 bond-mode 802.3ad bond-miimon 100 bond-use-carrier yes bond-lacp-rate 1 bond-min-links 1 bond-xmit-hash-policy layer3+4 auto bond2 iface bond2 address 100.0.0.5/16 bond-slaves swp31 swp32 bond-mode 802.3ad bond-miimon 100 bond-use-carrier yes bond-lacp-rate 1 bond-min-links 1 bond-xmit-hash-policy layer3+4 auto br2001 iface br2001 address 12.0.1.3/24 bridge-ports bond1.2001 bond2.2001 bridge-stp on ``` -------------------------------- ### Configure bridge-fd Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the bridge forward delay in seconds. ```text bridge-fd 15 ``` -------------------------------- ### Generate dependency graph image Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifquery.8.rst Export dependency information to a dot file and convert it to a PNG image using Graphviz. ```bash ifquery --print-dependency=dot -a > interfaces.dot ``` ```bash dot -Tpng interfaces.dot > interfaces.png ``` -------------------------------- ### Configure ethtool link-autoneg Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Enables or disables link autonegotiation. ```text link-autoneg yes ``` -------------------------------- ### Configure MSTP Port Path Cost Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the port path cost for MSTP. The default value is 0. ```bash mstpctl-portpathcost swp1=0 swp2=1 ``` -------------------------------- ### Leaf Switch Configuration: SVIs with Virtual Addresses Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Configuration for Switched Virtual Interfaces (SVIs) with primary and virtual IP addresses, and VRF assignment. ```bash # SVIs auto br0.100 iface br0.100 address 192.168.100.1/24 address-virtual 00:00:5e:00:01:01 192.168.100.254/24 vrf tenant1 auto br0.200 iface br0.200 address 192.168.200.1/24 address-virtual 00:00:5e:00:01:02 192.168.200.254/24 vrf tenant1 ``` -------------------------------- ### Configure VLAN-Aware Bridges Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Define modern VLAN-filtering bridges, access/trunk ports, and SVIs. ```bash # /etc/network/interfaces # VLAN-aware bridge with trunk ports auto br0 iface br0 bridge-vlan-aware yes bridge-ports bond0 bond1 swp5 swp6 swp7 swp8 bridge-vids 8 11-12 100-200 bridge-stp on bridge-mcsnoop 0 mstpctl-treeprio 4096 # Access port (single VLAN) auto swp5 iface swp5 bridge-access 100 mtu 9000 # Trunk port with specific VLANs auto swp7 iface swp7 bridge-vids 5 9-10 100 mtu 9000 # Bridge SVI (VLAN interface on bridge) auto br0.100 iface br0.100 address 10.0.100.1/24 address-virtual 00:00:5e:00:01:01 10.0.100.254/24 ``` -------------------------------- ### Configure bridge-pvid Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the bridge port PVID. ```text bridge-pvid 1 ``` -------------------------------- ### Configure Bond Interfaces Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Defines link aggregation modes including LACP and active-backup, as well as VLAN subinterfaces on bonds. ```bash # /etc/network/interfaces # LACP bond with 802.3ad auto bond0 iface bond0 bond-slaves swp1 swp2 bond-mode 802.3ad bond-miimon 100 bond-use-carrier yes bond-lacp-rate 1 bond-min-links 1 bond-xmit-hash-policy layer3+4 # Active-backup bond auto bond1 iface bond1 address 10.0.0.5/24 bond-slaves swp3 swp4 bond-mode active-backup bond-miimon 100 bond-primary swp3 # Bond with VLAN subinterface auto bond0.100 iface bond0.100 address 192.168.100.1/24 ``` -------------------------------- ### Configure bridge-mcmi Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the multicast membership interval in seconds. ```text bridge-mcmi 260 ``` -------------------------------- ### Enable CLAGD Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Enables or disables CLAGD. Use 'yes' to enable or 'no' to disable. ```bash clagd-enable yes ``` -------------------------------- ### CLAGD Configuration Parameters Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Configuration options for CLAGD, including priority, peer IP, and enablement. ```APIDOC ## CLAGD Configuration ### Description Configuration options for Connectivity Assisted LAG (CLAGD). ### Parameters #### CLAGD Settings - **clagd-priority** (integer) - The priority of this CLAGD switch. - **clagd-backup-ip** (ip_address) - Backup IP address of the CLAGD peer. - **clagd-enable** (yes/no) - Enable CLAGD. - **clag-id** (integer) - Multi-chassis LAG ID. - **clagd-peer-ip** (ip_address) - The IP address of the CLAGD peer. ### Examples ``` clagd-priority 30000 clagd-backup-ip 192.1.1.1 clagd-enable yes clag-id 1 clagd-peer-ip 10.10.10.2 ``` ``` -------------------------------- ### Bond Configuration Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Configuration parameters for bond interfaces. ```APIDOC ## Bond Configuration ### Parameters - **bond-slaves** (string) - Required - bond slaves. Example: swp1 swp2 - **bond-mode** (string) - Optional - bond mode. Default: balance-rr. Valid values: balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, balance-alb - **bond-use-carrier** (string) - Optional - bond use carrier. Default: yes. Valid values: yes, no - **bond-lacp-rate** (string) - Optional - bond lacp rate. Default: 0. Valid values: 0, 1 - **bond-min-links** (integer) - Optional - bond min links. Default: 0 ``` -------------------------------- ### Configure bridge-ageing Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Sets the bridge ageing time in seconds. ```text bridge-ageing 300 ``` -------------------------------- ### Leaf Switch Configuration: Server-facing Bonds Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Configuration for server-facing bonds with MLAG CLAG ID. ```bash # Server-facing bonds auto bond1 iface bond1 bond-slaves swp3 swp4 bond-mode 802.3ad clag-id 1 mtu 9000 ``` -------------------------------- ### Configure MSTP BPDU Guard Source: https://github.com/cumulusnetworks/ifupdown2/blob/master/ifupdown2/man/ifupdown-addons-interfaces.5.rst Enables or disables BPDU Guard for MSTP. Use 'yes' or 'no'. ```bash mstpctl-bpduguard swp1=no swp2=no ``` -------------------------------- ### Leaf Switch Configuration: L3 VRF Source: https://context7.com/cumulusnetworks/ifupdown2/llms.txt Configuration for a Layer 3 VRF instance. ```bash # L3 VRF auto tenant1 iface tenant1 vrf-table auto ```