IP-LINK(8)

ok so bestie, come sit, hydrate, because this is ip-link, straight outta the Linux manual, section 8 ๐Ÿซถ. It's the group chat where every network device you own hangs out โ€” making them, deleting them, flipping them up or down, renaming them, showing them off. Iconic behavior honestly. Everything below is the real deal, no cap ๐Ÿ’–


๐ŸŒธ NAME ๐ŸŒธ

ip-link โ€” network device configuration โœจ


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

The general vibe:

ip link  { COMMAND | help }
ip link add [ link DEVICE ] [ name ] NAME
        [ txqueuelen PACKETS ]
        [ address LLADDR ] [ broadcast LLADDR ]
        [ mtu MTU ] [ index IDX ]
        [ numtxqueues QUEUE_COUNT ] [ numrxqueues QUEUE_COUNT ]
        [ gso_max_size BYTES ] [ gso_ipv4_max_size BYTES ] [ gso_max_segs SEGMENTS ]
        [ gro_max_size BYTES ] [ gro_ipv4_max_size BYTES ]
        [ netns { PID | NETNSNAME | NETNSFILE } ]
        type TYPE [ ARGS ]
ip link delete { DEVICE | group GROUP } type TYPE [ ARGS ]
ip link { set | change } { DEVICE | group GROUP }
        [ { up | down } ]
        [ type ETYPE TYPE_ARGS ]
        [ arp { on | off } ]
        [ dynamic { on | off } ]
        [ multicast { on | off } ]
        [ allmulticast { on | off } ]
        [ promisc { on | off } ]
        [ protodown { on | off } ]
        [ protodown_reason PREASON { on | off } ]
        [ trailers { on | off } ]
        [ txqueuelen PACKETS ]
        [ gso_max_size BYTES ] [ gso_ipv4_max_size BYTES ] [ gso_max_segs SEGMENTS ]
        [ gro_max_size BYTES ] [ gro_ipv4_max_size BYTES ]
        [ name NEWNAME ]
        [ address LLADDR ]
        [ broadcast LLADDR ]
        [ mtu MTU ]
        [ netns { PID | NETNSNAME | NETNSFILE } ]
        [ link-netnsid ID ]
        [ alias NAME ]
        [ vf NUM [ mac LLADDR ]
                 [ VFVLAN-LIST ]
                 [ rate TXRATE ]
                 [ max_tx_rate TXRATE ]
                 [ min_tx_rate TXRATE ]
                 [ spoofchk { on | off } ]
                 [ query_rss { on | off } ]
                 [ state { auto | enable | disable } ]
                 [ trust { on | off } ]
                 [ node_guid eui64 ]
                 [ port_guid eui64 ] ]
        [ { xdp | xdpgeneric | xdpdrv | xdpoffload } { off |
                object FILE [ { section | program } NAME ] [ verbose ] |
                pinned FILE } ]
        [ master DEVICE ]
        [ nomaster ]
        [ vrf NAME ]
        [ addrgenmode { eui64 | none | stable_secret | random } ]
        [ inet [ { forwarding | proxy_arp | accept_redirects |
                secure_redirects | send_redirects | shared_media |
                accept_source_route | bootp_relay | log_martians |
                arp_filter | disable_xfrm | disable_policy |
                promote_secondaries | arp_notify | accept_local |
                src_vmark | proxy_arp_pvlan | route_localnet |
                bc_forwarding | ignore_routes_with_linkdown |
                drop_unicast_in_l2_multicast |
                drop_gratuitous_arp | arp_evict_nocarrier } { on | off }
                ]
                [ rp_filter { 0 | 1 | 2 } ]
                [ arp_announce { 0 | 1 | 2 } ]
                [ arp_ignore { 0 | 1 | ... | 8 } ]
                [ arp_accept { 0 | 1 | 2 } ]
                [ force_igmp_version { 0 | 1 | 2 | 3 } ]
                [ tag TAG ] [ medium_id ID ]
                [ igmpv2_unsolicited_report_interval INTERVAL ]
                [ igmpv3_unsolicited_report_interval INTERVAL ] ]
        [ macaddr [ MACADDR ]
                  [ { flush | add | del } MACADDR ]
                  [ set MACADDR ] ]
ip link show [ DEVICE | group GROUP ] [ { up | down } ] [ master DEVICE ]
        [ type ETYPE ] [ vrf NAME ] [ nomaster ] [ novf ]

๐Ÿ“Š the stats & help corner

ip link xstats type TYPE [ ARGS ]

ip link afstats [ dev DEVICE ]

ip link help [ TYPE ]

๐Ÿงš the type cheat-sheet (iykyk)

TYPE := [ amt | bareudp | bond | bridge | can | dsa | dummy |
        erspan | geneve | gre | gretap | gtp | hsr | ifb |
        ip6erspan | ip6gre | ip6gretap | ip6tnl | ipip | ipoib
        | ipvlan | ipvtap | lowpan | macsec | macvlan |
        macvtap | netdevsim | netkit | nlmon | ovpn | pfcp |
        rmnet | sit | vcan | veth | virt_wifi | vlan | vrf |
        vti | vxcan | vxlan | xfrm ]

ETYPE := [ TYPE | bridge_slave | bond_slave ]

VFVLAN-LIST := [ VFVLAN-LIST ] VFVLAN

VFVLAN := [ vlan VLANID [ qos VLAN-QOS ] [ proto VLAN-PROTO ]
        ]

๐Ÿท๏ธ property things

ip link property add dev DEVICE [ altname NAME .. ]

ip link property del dev DEVICE [ altname NAME .. ]

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

  • link DEVICE โ€” tells it which physical device we're operating on, bestie.

NAME is literally the name you're giving your brand-new virtual device ๐Ÿ’–

TYPE is the type of new device you want.

Link types: (the whole squad, no skips)

amt - Automatic Multicast Tunneling (AMT)

bareudp - Bare UDP L3 encapsulation support

bond - Bonding device

bridge - Ethernet Bridge device

can - Controller Area Network

dsa - Distributed Switch Architecture

dummy - Dummy network interface

erspan - Encapsulated Remote SPAN over GRE and IPv4

geneve - GEneric NEtwork Virtualization Encapsulation

gre - Virtual tunnel interface GRE over IPv4

gretap - Virtual L2 tunnel interface GRE over IPv4

gtp - GPRS Tunneling Protocol

hsr - High-availability Seamless Redundancy device

ifb - Intermediate Functional Block device

ip6erspan - Encapsulated Remote SPAN over GRE and IPv6

ip6gre - Virtual tunnel interface GRE over IPv6

ip6gretap - Virtual L2 tunnel interface GRE over IPv6

ip6tnl - Virtual tunnel interface IPv4|IPv6 over IPv6

ipip - Virtual tunnel interface IPv4 over IPv4

ipoib - IP over Infiniband device

ipvlan - Interface for L3 (IPv6/IPv4) based VLANs

ipvtap - Interface for L3 (IPv6/IPv4) based VLANs and TAP

lowpan - Interface for 6LoWPAN (IPv6) over IEEE 802.15.4 / Bluetooth

macsec - Interface for IEEE 802.1AE MAC Security (MACsec)

macvlan - Virtual interface base on link layer address (MAC)

macvtap - Virtual interface based on link layer address (MAC) and TAP.

netdevsim - Interface for netdev API tests

netkit - BPF-programmable network device

nlmon - Netlink monitoring device

ovpn - OpenVPN Data Channel Offload device

pfcp - Packet Forwarding Control Protocol device

rmnet - Qualcomm rmnet device

sit - Virtual tunnel interface IPv6 over IPv4

vcan - Virtual Controller Area Network interface

veth - Virtual ethernet interface

virt_wifi - rtnetlink wifi simulation device

vlan - 802.1q tagged virtual LAN interface

vrf - Interface for L3 VRF domains

vti - Virtual tunnel interface

vxcan - Virtual Controller Area Network tunnel interface

vxlan - Virtual eXtended LAN

xfrm - Virtual xfrm interface


ok now the rest of the add options, one by one, no skipping โœ‹

  • numtxqueues QUEUE_COUNT โ€” sets how many transmit queues your new device gets ๐Ÿ’ซ
  • numrxqueues QUEUE_COUNT โ€” same energy, but for receive queues โœจ
  • gso_max_size BYTES โ€” the recommended max size of a Generic Segment Offload packet your new device should accept. It's also what turns on BIG TCP for IPv6 on this device, when the size is greater than 65536 ๐Ÿ”ฅ
  • gso_ipv4_max_size BYTES โ€” the recommended max size of an IPv4 Generic Segment Offload packet the new device should accept. This one is specifically what enables BIG TCP for IPv4 on this device โ€” set it bigger than 65536. And listen: gso_max_size has to be set to a size greater than or equal to gso_ipv4_max_size for BIG TCP for IPv4 to actually turn on ๐Ÿ‘‘
  • gso_max_segs SEGMENTS โ€” the recommended max number of Generic Segment Offload segments the new device should accept ๐Ÿ“
  • gro_max_size BYTES โ€” the max size of a packet the GRO stack builds on this device. Also used for BIG TCP, so a merged IPv6 GSO packet on this device can go bigger than 65536 ๐ŸŒˆ
  • gro_ipv4_max_size BYTES โ€” the max size of an IPv4 packet built by the GRO stack on this device. Especially for BIG TCP, letting a merged IPv4 GSO packet on this device be bigger than 65536 ๐Ÿ’ซ
  • index IDX โ€” the index you want your new virtual device to have. Heads up: link creation fails if the index is busy ๐Ÿ’€
  • netns { PID | NETNSNAME | NETNSFILE } โ€” makes the device inside the network namespace that belongs to process PID, or to the name NETNSNAME, or to the file NETNSFILE ๐Ÿงš

๐ŸŒท VLAN Type Support

If your link is type VLAN, you get these extra arguments, and they're lowkey so good:

ip link add link DEVICE name NAME type vlan [ protocol VLAN_PROTO ] id VLANID
        [ reorder_hdr { on | off } ] [ gvrp { on | off } ] [ mvrp { on | off } ]
        [ loose_binding { on | off } ] [ bridge_binding { on | off } ]
        [ ingress-qos-map QOS-MAP ] [ egress-qos-map QOS-MAP ]
  • protocol VLAN_PROTO โ€” either 802.1Q or 802.1ad ๐Ÿ’…
  • id VLANID โ€” the VLAN Identifier to use. Note: numbers with a leading " 0 " or " 0x " get read as octal or hexadecimal respectively, so don't play yourself ๐Ÿ™ˆ
  • reorder_hdr { on | off } โ€” says whether ethernet headers get reordered or not, and the default is on โœจ

If reorder_hdr is on, then the VLAN header does not get inserted immediately โ€” only right before the packet passes to the physical device (that's if this device doesn't support VLAN offloading). Same situation on the RX direction: by default, the packet gets untagged before the VLAN device receives it. Reordering lets you speed up tagging on egress, and hides the VLAN header on ingress so the packet looks like a regular Ethernet packet. BUT โ€” it can be confusing for packet capture, because the VLAN header does not exist within the packet ๐Ÿซ 

You can check VLAN offloading with ethtool(8):

okay so before anyone touches a VLAN device, vibe-check the NIC first: โœจ

ethtool -k <phy_dev> | grep tx-vlan-offload

where &lt;phy_dev&gt; is the physical device that your VLAN device is chained to. no cap. ๐Ÿซถ

  • gvrp { on | off } โ€” decides whether this VLAN gets registered via GARP VLAN Registration Protocol. bestie's either in the GARP group chat or she isn't ๐Ÿ’…
  • mvrp { on | off } โ€” same energy but for Multiple VLAN Registration Protocol. more registration, more friends ๐ŸŽ€
  • loose_binding { on | off } โ€” says whether the VLAN device's state is tied to the physical device's state. on = they're attached at the hip, off = independent queen ๐Ÿ’–
  • bridge_binding { on | off } โ€” says whether the VLAN device's link state follows the state of bridge ports that are members of the VLAN. ๐Ÿฆ‹
  • ingress-qos-map QOS-MAP โ€” maps the VLAN header prio field over to the Linux internal packet priority for incoming frames. format is FROM:TO, and if you've got several mappings you just separate them with spaces. ๐ŸŒธ
  • egress-qos-map QOS-MAP โ€” same mapping deal but backwards and for outgoing frames: Linux internal packet priority โ†’ VLAN header prio field. format is identical to ingress-qos-map. ๐Ÿ”ฅ

side quest, because Linux packet priority can be set by iptables(8):

iptables -t mangle -A POSTROUTING [...] -j CLASSIFY --set-class 0:4

and that "4" priority can then be used in the egress qos mapping to set VLAN prio "5", like so:

ip link set veth0.10 type vlan egress 4:5

๐ŸŒˆ VXLAN Type Support ๐ŸŒˆ

for a link of type VXLAN, these are the extra little arguments it accepts:

ip link add DEVICE type vxlan id VNI [ dev PHYS_DEV  ] [ { group | remote } IPADDR ] [ local { IPADDR | any } ] [ ttl TTL ] [ tos TOS ] [ df DF ] [ flowlabel FLOWLABEL ] [ dstport PORT ] [ srcport MIN MAX ] [ reserved_bits VALUE ] [ [no]learning ] [ [no]proxy ] [ [no]rsc ] [ [no]l2miss ] [ [no]l3miss ] [ [no]udpcsum ] [ [no]udp6zerocsumtx ] [ [no]udp6zerocsumrx ] [ [no]localbypass ] [ ageing SECONDS ] [ maxaddress NUMBER ] [ [no]external ] [ gbp ] [ gpe ] [ [no]vnifilter ] [ [no]mcroute ]
  • id VNI โ€” the VXLAN Network Identifier (a.k.a. VXLAN Segment Identifier) you wanna use. the ID card of your tunnel ๐Ÿชช
  • dev PHYS_DEV โ€” the physical device used for tunnel endpoint communication. ๐Ÿงš
  • group IPADDR โ€” the multicast IP address to join. โš ๏ธ cannot be used together with the remote parameter, pick a lane bestie
  • remote IPADDR โ€” the unicast destination IP address that outgoing packets use when the destination link layer address isn't known in the VXLAN device forwarding database. โš ๏ธ cannot be used together with the group parameter
  • local IPADDR โ€” the source IP address for outgoing packets. ๐Ÿ’œ
  • ttl TTL โ€” the TTL value for outgoing packets. โณ
  • tos TOS โ€” the TOS value for outgoing packets.
  • df DF โ€” controls the Don't Fragment (DF) bit in outgoing packets with IPv4 headers. inherit copies the bit from the original IP header; unset and set force the bit to always be unset or always be set respectively. by default, the bit is not set. ๐Ÿšซโœ‚๏ธ
  • flowlabel FLOWLABEL โ€” the flow label to use in outgoing packets. ๐ŸŒŠ
  • dstport PORT โ€” the UDP destination port to communicate to the remote VXLAN tunnel endpoint.
  • srcport MIN MAX โ€” the range of port numbers to use as UDP source ports when talking to the remote VXLAN tunnel endpoint. ๐ŸŽฏ
  • reserved_bits VALUE โ€” by default the kernel straight up rejects packets that have bits set outside of the fields required by the features enabled on the VXLAN netdevice. reserved_bits is a 64-bit quantity saying which bits it should be possible to set in a VXLAN header. every bit set in the value = a tolerated bit set in a packet. ๐Ÿ™ˆ
  • [no]learning โ€” whether unknown source link layer addresses and IP addresses get entered into the VXLAN device forwarding database. ๐Ÿ“š
  • [no]rsc โ€” whether route short circuit is turned on.
  • [no]proxy โ€” whether ARP proxy is turned on.
  • [no]l2miss โ€” whether netlink LLADDR miss notifications get generated.
  • [no]l3miss โ€” whether netlink IP ADDR miss notifications get generated.
  • [no]udpcsum โ€” whether the UDP checksum is calculated for transmitted packets over IPv4. โœ…
  • [no]udp6zerocsumtx โ€” skips UDP checksum calculation for transmitted packets over IPv6.
  • [no]udp6zerocsumrx โ€” allows incoming UDP packets over IPv6 that have a zero checksum field. 0๏ธโƒฃ
  • [no]localbypass โ€” if the FDB destination is local and you've got nolocalbypass set, encapsulated packets get forwarded to the userspace network stack. if some userspace process is listening for those packets, it gets a chance to process them. if localbypass is active (this is the default), the kernel network stack gets bypassed entirely and the packets get injected into the target VXLAN device, assuming one exists. ๐Ÿ’ซ
  • ageing SECONDS โ€” how long, in seconds, FDB entries learnt by the kernel stick around. โฐ
  • maxaddress NUMBER โ€” the maximum number of FDB entries.
  • [no]external โ€” whether an external control plane (e.g. ip route encap) is used, or the internal FDB. ๐Ÿ”€
  • [no]vnifilter โ€” whether the vxlan device can do vni filtering. only works on a vxlan device with the external flag set ๐Ÿซ  once enabled, the bridge vni command manages the vni filtering table on the device. the device can then only receive packets with vni's configured in that vni filtering table. gatekeeping, but make it networking ๐Ÿ’…
  • [no]mcroute โ€” when the VXLAN tunnel has a multicast remote: should the underlay packets be sent directly to the physical device (this is the default), or should they be multicast-routed? in the multicast-routed case, for the purposes of matching a multicast route, (S,G) are respectively the local and remote address of the tunnel, and iif is the tunnel physical device. ๐Ÿ›ฐ๏ธ
  • gbp โ€” enables the Group Policy extension (VXLAN-GBP). ๐Ÿ‘‘

and here's the tea on gbp: it lets you transport group policy context across VXLAN network peers ๐ŸŒ if it's enabled, the mark of a packet gets included in the VXLAN header for outgoing packets, and the packet mark gets filled in based on what's found in the VXLAN header for incoming packets.

format of the upper 16 bits of the packet mark (flags):

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|-|-|-|-|-|-|-|-|-|D|-|-|A|-|-|-|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  • D := the Don't Learn bit. when it's set, this bit says the egress VTEP MUST NOT learn the source address of the encapsulated frame. ๐Ÿšซ
  • A := says the group policy has already been applied to this packet. policies MUST NOT be applied by devices when the A bit is set. โœ‹

format of the lower 16 bits of the packet mark (policy ID):

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Group Policy ID        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

example โœจ:

iptables -A OUTPUT [...] -j MARK --set-mark 0x800FF
  • gpe โ€” enables the Generic Protocol extension (VXLAN-GPE). currently this is only supported together with the external keyword. โš ๏ธ

๐ŸŽ€ VETH, VXCAN Type Support ๐ŸŽ€

for a link of types VETH/VXCAN, these are the extra arguments:

ip link add DEVICE type { veth | vxcan } [ peer name NAME ]
  • peer name NAME โ€” the virtual pair device name of the VETH/VXCAN tunnel. twinsies fr fr ๐Ÿ‘ฏ

๐Ÿฆ‹ netkit Type Support ๐Ÿฆ‹

for a link of type netkit, these extra arguments are supported:

ip link add DEVICE type netkit [ mode MODE ] [ scrub SCRUB ] [ POLICY ] [ peer [ scrub SCRUB ] [ POLICY ] [ NAME ] ]
  • mode MODE โ€” the operation mode of the netkit device; possible values are "l3" and "l2". default option is "l3". ๐ŸŽš๏ธ
  • scrub SCRUB โ€” the scrub behavior of the netkit device; possible values are "default" and "none". with "default", the device zeroes the skb->{mark,priority} fields before invoking the attached BPF program when its peer device resides in a different network namespace. with "none", the device leaves clearing skb->{mark,priority} up to the BPF program. default option is "default". ๐Ÿงผ and listen: specifying scrub before the peer option refers to the primary device, after the peer option refers to the peer device.
  • POLICY โ€” the default device policy when no BPF programs are attached; possible values are "forward" and "blackhole". default option is "forward". same positional rule: before peer = primary device, after peer = peer device. ๐Ÿ•ณ๏ธ
  • NAME โ€” the device name of the peer device. ๐Ÿ“›

๐ŸŒธ IPIP, SIT Type Support ๐ŸŒธ

for a link of type IPIPorSIT the following additional arguments are supported:

(and yes bestie that's literally how it's spelled, we do not fix the spelling, we respect the spelling ๐Ÿ’–)

ip link add DEVICE type { ipip | sit } remote ADDR local ADDR [ encap { fou | gue | none } ] [ encap-sport { PORT | auto } ] [ encap-dport PORT ] [ [no]encap-csum ] [ [no]encap-remcsum ] [ mode { ip6ip | ipip | mplsip | any } ] [ external ]
  • remote ADDR โ€” the far end of your tunnel, bestie. That's the address you're tunneling to ๐Ÿ’ซ
  • local ADDR โ€” the fixed local address for tunneled packets. Heads up: it has to be an address that already lives on another interface on this host, no exceptions โœ‹
  • encap { fou | gue | none } โ€” picks the type of secondary UDP encapsulation. fou = Foo-Over-UDP, gue = Generic UDP Encapsulation ๐ŸŽ
  • encap-sport { PORT | auto } โ€” the source port for UDP encapsulation. Give it a PORT by number, or say auto and the kernel will choose it for you (it picks a flow based on the flow hash of the encapsulated packet, very demure, very mindful) ๐Ÿ™ˆ
  • encap-dport PORT โ€” the destination port, by number.
  • [no]encap-csum โ€” turns UDP checksums on/off inside the secondary encapsulation.
  • [no]encap-remcsum โ€” toggles Remote Checksum Offload. Only applicable for Generic UDP Encapsulation, so don't come for it otherwise ๐Ÿšซ
  • mode { ip6ip | ipip | mplsip | any } โ€” which mode the device should run in. ip6ip = IPv6-Over-IPv4, ipip = IPv4-Over-IPv4, mplsip = MPLS-Over-IPv4, any = IPv6, IPv4 or MPLS Over IPv4. Supported for SIT (default is ip6ip) and for IPIP (default is ipip). Quick PSA: IPv6-Over-IPv4 is not supported for IPIP ๐Ÿ˜ญ
  • external โ€” hands this tunnel over to external control (think ip route encap). Main character letting someone else drive ๐Ÿ‘‘

โœจ GRE Type Support โœจ

For a link of type GRE or GRETAP, these extra arguments are supported ๐Ÿซถ

ip link add DEVICE type { gre | gretap }  remote ADDR local ADDR [ [no][i|o]seq ] [ [i|o]key KEY | no[i|o]key ] [ [no][i|o]csum ] [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ [no]ignore-df ] [ dev PHYS_DEV ] [ encap { fou | gue | none } ] [ encap-sport { PORT | auto } ] [ encap-dport PORT ] [ [no]encap-csum ] [ [no]encap-remcsum ] [ external ]
  • remote ADDR โ€” the remote address of the tunnel ๐Ÿ’ซ
  • local ADDR โ€” the fixed local address for tunneled packets. Again: it must be an address on another interface on this host โœ‹
  • [no][i|o]seq โ€” serialize packets. oseq turns on sequencing of outgoing packets, iseq demands that all input packets are serialized ๐Ÿ”ข
  • [i|o]key KEY | no[i|o]key โ€” use keyed GRE with key KEY. KEY is either a number or an IPv4 address-like dotted quad. key means the same key both directions; ikey and okey let you set different keys for input and output ๐Ÿ”‘
  • [no][i|o]csum โ€” generate/require checksums for tunneled packets. ocsum calculates checksums for outgoing packets. icsum requires that all input packets have the correct checksum. And csum is just shorthand for the combo icsum ocsum โœ…
  • ttl TTL โ€” the TTL value to use in outgoing packets.
  • tos TOS โ€” the TOS value to use in outgoing packets.
  • [no]pmtudisc โ€” enables/disables Path MTU Discovery on this tunnel. It's enabled by default. Not me pointing out that a fixed ttl is incompatible with this option: tunneling with a fixed ttl always makes pmtu discovery ๐Ÿ’€
  • [no]ignore-df โ€” enables/disables IPv4 DF suppression on this tunnel. Normally datagrams that exceed the MTU get fragmented; the DF flag blocks that and instead you get an ICMP Unreachable (Fragmentation Required) message. Turning this attribute on makes the DF flag get ignored ๐Ÿšฉ
  • dev PHYS_DEV โ€” the physical device to use for tunnel endpoint communication.
  • encap { fou | gue | none } โ€” type of secondary UDP encapsulation. fou = Foo-Over-UDP, gue = Generic UDP Encapsulation ๐ŸŽ
  • encap-sport { PORT | auto } โ€” source port in UDP encapsulation. PORT by number, or auto and the kernel picks a flow based on the flow hash of the encapsulated packet ๐Ÿ™ˆ
  • encap-dport PORT โ€” destination port, by number.
  • [no]encap-csum โ€” whether UDP checksums are enabled in the secondary encapsulation.
  • [no]encap-remcsum โ€” whether Remote Checksum Offload is enabled. Only applicable for Generic UDP Encapsulation ๐Ÿšซ
  • external โ€” make this tunnel externally controlled (e.g. ip route encap) ๐Ÿ‘‘

๐ŸŒˆ IP6GRE/IP6GRETAP Type Support ๐ŸŒˆ

For a link of type IP6GRE/IP6GRETAP, here's what else you get ๐Ÿ’œ

ip link add DEVICE type { ip6gre | ip6gretap } remote ADDR local ADDR [ [no][i|o]seq ] [ [i|o]key KEY | no[i|o]key ] [ [no][i|o]csum ] [ hoplimit TTL ] [ encaplimit ELIM ] [ tclass TCLASS ] [ flowlabel FLOWLABEL ] [ dscp inherit ] [ [no]allow-localremote ] [ dev PHYS_DEV ] [ external ]
  • remote ADDR โ€” the remote IPv6 address of the tunnel โœจ
  • local ADDR โ€” the fixed local IPv6 address for tunneled packets. Must be an address on another interface on this host, same rules as always โœ‹
  • [no][i|o]seq โ€” serialize packets. oseq enables sequencing of outgoing packets, iseq requires that all input packets are serialized ๐Ÿ”ข
  • [i|o]key KEY | no[i|o]key โ€” keyed GRE with key KEY. KEY is either a number or an IPv4 address-like dotted quad. key uses the same key both directions; ikey and okey set different keys for input and output ๐Ÿ”‘
  • [no][i|o]csum โ€” generate/require checksums for tunneled packets. ocsum = checksums for outgoing packets. icsum = all input packets must have the correct checksum. csum = the combo icsum ocsum โœ…
  • hoplimit TTL โ€” the Hop Limit value to use in outgoing packets.
  • encaplimit ELIM โ€” a fixed encapsulation limit. Default is 4 ๐Ÿ€
  • flowlabel FLOWLABEL โ€” a fixed flowlabel.
  • [no]allow-localremote โ€” whether to allow the remote endpoint to have an address configured on the local host ๐Ÿ‘€
  • tclass TCLASS โ€” the traffic class field on tunneled packets. You can give it as a two-digit hex value (e.g. c0) or a predefined string (e.g. internet). The value inherit copies the field from the original IP header. The values inherit/STRING or inherit/00..ff set the field to STRING or 00..ff when tunneling non-IP packets. The default value is 00 ๐ŸŽ€
  • external โ€” make this tunnel externally controlled (or not, which is the default). In the kernel, this is referred to as collect metadata mode. And bestie, listen: this flag is mutually exclusive with the remote, local, seq, key, csum, hoplimit, encaplimit, flowlabel and tclass options. Pick a lane ๐Ÿ’…

๐Ÿ’– IPoIB Type Support ๐Ÿ’–

For a link of type IPoIB, these extra arguments are supported ๐Ÿฆ‹

ip link add DEVICE name NAME type ipoib [ pkey PKEY ] [ mode MODE ]
  • pkey PKEY โ€” the IB P-Key to use ๐Ÿ”‘
  • mode MODE โ€” the mode to use (datagram or connected) ๐Ÿ”Œ

๐Ÿงš OVPN Type Support ๐Ÿงš

For a link of type OVPN, this extra argument is supported ๐ŸŒธ

ip link add DEVICE type ovpn [ mode { p2p | mp } ]
  • mode { p2p | mp } โ€” selects the OpenVPN device mode. The default, p2p, creates a point-to-point device for a single peer. The mp mode creates a multi-peer device ๐Ÿ‘ฏ

โญ ERSPAN Type Support โญ

For a link of type ERSPAN/IP6ERSPAN, these extra arguments are supported ๐Ÿ‘‘

ip link add DEVICE type { erspan | ip6erspan } remote ADDR local ADDR seq key KEY erspan_ver version [ erspan IDX ] [ erspan_dir { ingress | egress } ] [ erspan_hwid hwid ] [ [no]allow-localremote ] [ external ]
  • remote ADDR โ€” the remote address of the tunnel ๐Ÿ’ซ
  • local ADDR โ€” the fixed local address for tunneled packets. Yep, you guessed it: it must be an address on another interface on this host โœ‹
  • erspan_ver version โ€” the ERSPAN version number. version picks which one you're creating: 0 for version 0 type I, 1 for version 1 (type II), or 2 for version 2 (type III) ๐Ÿ”ข
  • erspan IDX โ€” the ERSPAN v1 index field. IDX is a 20 bit index/port number associated with the ERSPAN traffic's source port and direction ๐ŸŽฏ
  • erspan_dir { ingress | egress } โ€” the ERSPAN v2 mirrored traffic's direction โ†—๏ธโ†™๏ธ
  • erspan_hwid hwid โ€” a unique identifier of an ERSPAN v2 engine within a system. hwid is a 6-bit value for users to configure ๐Ÿท๏ธ
  • [no]allow-localremote โ€” whether to allow the remote endpoint to have an address configured on the local host ๐Ÿ‘€
  • external โ€” makes this tunnel externally controlled (or not, which is the default, bestie ๐Ÿ’…). In the kernel this whole vibe is referred to as collect metadata mode. Ok but listen: this flag is mutually exclusive with the remote, local, erspan_ver, erspan, erspan_dir and erspan_hwid options. Pick a lane, you cannot have both, periodt ๐Ÿ™…โ€โ™€๏ธ

GENEVE Type Support ๐Ÿฆ‹

For a link of type GENEVE the following additional arguments are supported:

ip link add DEVICE type geneve id VNI remote IPADDR [ local IPADDR ] [ ttl TTL ] [ tos TOS ] [ df DF ] [ flowlabel FLOWLABEL ] [ dstport PORT ] [ [no]external ] [ [no]udpcsum ] [ [no]udp6zerocsumtx ] [ [no]udp6zerocsumrx ] [ innerprotoinherit ]
  • id VNI โ€” specifies the Virtual Network Identifier to use. Your tunnel's little name tag ๐Ÿท๏ธ
  • remote IPADDR โ€” specifies the unicast destination IP address to use in outgoing packets. Where the packets are headed, fr fr ๐Ÿ“ฌ
  • local IPADDR โ€” specifies the source IP address to listen on.
  • ttl TTL โ€” specifies the TTL value to use in outgoing packets. "0" or "auto" means use whatever default value, "inherit" means inherit the inner protocol's ttl. Default option is "0".
  • tos TOS โ€” specifies the TOS value to use in outgoing packets.
  • df DF โ€” specifies the usage of the Don't Fragment flag (DF) bit in outgoing packets with IPv4 headers. The value inherit causes the bit to be copied from the original IP header. The values unset and set cause the bit to be always unset or always set, respectively. By default, the bit is not set.
  • flowlabel FLOWLABEL โ€” specifies the flow label to use in outgoing packets.
  • dstport PORT โ€” select a destination port other than the default of 6081. Lol the default is giving "I was here first" ๐Ÿ’€
  • [no]external โ€” make this tunnel externally controlled (or not, which is the default). This flag is mutually exclusive with the id, remote, ttl, tos and flowlabel options. Again bestie: mutually exclusive, do not fight it โœ‹
  • [no]udpcsum โ€” specifies if UDP checksum is calculated for transmitted packets over IPv4.
  • [no]udp6zerocsumtx โ€” skip UDP checksum calculation for transmitted packets over IPv6.
  • [no]udp6zerocsumrx โ€” allow incoming UDP packets over IPv6 with zero checksum field.
  • innerprotoinherit โ€” use IPv4/IPv6 as inner protocol instead of Ethernet.

Bareudp Type Support ๐Ÿ“

For a link of type Bareudp the following additional arguments are supported:

ip link add DEVICE type bareudp dstport PORT ethertype PROTO [ srcportmin PORT ] [ [no]multiproto ]
  • dstport PORT โ€” specifies the destination port for the UDP tunnel.
  • ethertype PROTO โ€” specifies the ethertype of the L3 protocol being tunnelled. ethertype can be given as plain Ethernet protocol number or using the protocol name ("ipv4", "ipv6", "mpls_uc", etc.). So many options, we love a flexible queen ๐Ÿ‘‘
  • srcportmin PORT โ€” selects the lowest value of the UDP tunnel source port range.
  • [no]multiproto โ€” activates support for protocols similar to the one specified by ethertype. When ethertype is "mpls_uc" (that is, unicast MPLS), this allows the tunnel to also handle multicast MPLS. When ethertype is "ipv4", this allows the tunnel to also handle IPv6. This option is disabled by default.

AMT Type Support ๐ŸŒˆ

For a link of type AMT the following additional arguments are supported:

ip link add DEVICE type AMT discovery IPADDR mode { gateway | relay } local IPADDR dev PHYS_DEV [ relay_port PORT ] [ gateway_port PORT ] [ max_tunnels NUMBER ]
  • discovery IPADDR โ€” specifies the unicast discovery IP address to use to find remote IP address.
  • mode { gateway | relay } โ€” specifies the role of AMT, Gateway or Relay. Choose your fighter โš”๏ธ
  • local IPADDR โ€” specifies the source IP address to use in outgoing packets.
  • dev PHYS_DEV โ€” specifies the underlying physical interface from which transform traffic is sent and received.
  • relay_port PORT โ€” specifies the UDP Relay port to communicate to the Relay.
  • gateway_port PORT โ€” specifies the UDP Gateway port to communicate to the Gateway.
  • max_tunnels NUMBER โ€” specifies the maximum number of tunnels.

MACVLAN and MACVTAP Type Support ๐ŸŽ€

For a link of type MACVLAN or MACVTAP the following additional arguments are supported:

ip link add link DEVICE name NAME type { macvlan | macvtap } mode { private | vepa | bridge | passthru  [ nopromisc ] | source [ nodst ] }  [ bcqueuelen { LENGTH } ]  [ bclim LIMIT ]
  • type { macvlan | macvtap } โ€” specifies the link type to use. macvlan creates just a virtual interface, while macvtap in addition creates a character device /dev/tapX to be used just like a tuntap device. Two for the price of one, iconic ๐Ÿ’–
  • mode private โ€” Do not allow communication between macvlan instances on the same physical interface, even if the external switch supports hairpin mode. Boundaries, bestie ๐Ÿšง
  • mode vepa โ€” Virtual Ethernet Port Aggregator mode. Data from one macvlan instance to the other on the same physical interface is transmitted over the physical interface. Either the attached switch needs to support hairpin mode, or there must be a TCP/IP router forwarding the packets in order to allow communication. This is the default mode. โœจ
  • mode bridge โ€” In bridge mode, all endpoints are directly connected to each other, communication is not redirected through the physical interface's peer.
  • mode passthru [ nopromisc ] โ€” This mode gives more power to a single endpoint, usually in macvtap mode. It is not allowed for more than one endpoint on the same physical interface. All traffic will be forwarded to this endpoint, allowing virtio guests to change MAC address or set promiscuous mode in order to bridge the interface or create vlan interfaces on top of it. By default, this mode forces the underlying interface into promiscuous mode. Passing the nopromisc flag prevents this, so the promisc flag may be controlled using standard tools. Main character mode fr ๐Ÿ‘‘
  • mode source [ nodst ] โ€” allows one to set a list of allowed mac address, which is used to match against source mac address from received frames on underlying interface. This allows creating mac based VLAN associations, instead of standard port or tag based. The feature is useful to deploy 802.1x mac based behavior, where drivers of underlying interfaces doesn't allows that. By default, packets are also considered (duplicated) for destination-based MACVLAN. Passing the nodst flag stops matching packets from also going through the destination-based flow.
  • bcqueuelen { LENGTH } โ€” Set the length of the RX queue used to process broadcast and multicast packets. LENGTH must be a positive integer in the range [0-4294967295]. Setting a length of 0 will effectively drop all broadcast/multicast traffic. If not specified the macvlan driver default (1000) is used. Note that all macvlans that share the same underlying device are using the same queue. The parameter here is a request, the actual queue length used will be the maximum length that any macvlan interface has requested. When listing device parameters both the bcqueuelen parameter as well as the actual used bcqueuelen are listed to better help the user understand the setting. It's giving "everyone shares the aux cord and the longest song wins" ๐ŸŽง
  • bclim LIMIT โ€” Set the threshold for broadcast queueing. LIMIT must be a 32-bit integer. Setting this to -1 disables broadcast queueing altogether. Otherwise a multicast address will be queued as broadcast if the number of devices using it is greater than the given value.

High-availability Seamless Redundancy (HSR) Support ๐Ÿงš

For a link of type HSR the following additional arguments are supported:

ip link add link DEVICE name NAME type hsr slave1 SLAVE1-IF slave2 SLAVE2-IF [ interlink INTERLINK-IF ] [ supervision ADDR-BYTE ] [ version { 0 | 1 } [ proto { 0 | 1 } ]
  • type hsr โ€” specifies the link type to use, here HSR.
  • slave1 SLAVE1-IF โ€” Specifies the physical device used for the first of the two ring ports.
  • slave2 SLAVE2-IF โ€” Specifies the physical device used for the second of the two ring ports.
  • interlink INTERLINK-IF โ€” The interlink device bound to the HSR network to connect SAN device(s).
  • supervision ADDR-BYTE โ€” The last byte of the multicast address used for HSR supervision frames. Default option is "0", possible values 0-255.
  • version { 0 | 1 } โ€” Selects the protocol version of the interface. Default option is "0", which corresponds to the 2010 version of the HSR standard. Option "1" activates the 2012 version.
  • proto { 0 | 1 } โ€” Selects the protocol at the interface. Default option is "0", which corresponds to the HSR standard. Option "1" activates the Parallel Redundancy Protocol (PRP).

BRIDGE Type Support ๐ŸŒธ

For a link of type BRIDGE the following additional arguments are supported:

Alright bestie, buckle up, because this is the part where the bridge gets ALL of its knobs ๐Ÿ’… Every single one of these goes on the ip link add DEVICE type bridge line, and yes, there are a lot of them. Here's the full shopping list, in order:

ip link add DEVICE type bridge [ ageing_time AGEING_TIME ] [ group_fwd_mask MASK ] [ group_address ADDRESS ] [ forward_delay FORWARD_DELAY ] [ hello_time HELLO_TIME ] [ max_age MAX_AGE ] [ stp_state STP_STATE ] [ stp_mode STP_MODE ] [ mst_enabled MST_ENABLED ] [ priority PRIORITY ] [ no_linklocal_learn NO_LINKLOCAL_LEARN ] [ fdb_local_vlan_0 FDB_LOCAL_VLAN_0 ] [ fdb_max_learned FDB_MAX_LEARNED ] [ vlan_filtering VLAN_FILTERING ] [ vlan_protocol VLAN_PROTOCOL ] [ vlan_default_pvid VLAN_DEFAULT_PVID ] [ vlan_stats_enabled VLAN_STATS_ENABLED ] [ vlan_stats_per_port VLAN_STATS_PER_PORT ] [ mcast_snooping MULTICAST_SNOOPING ] [ mcast_vlan_snooping MULTICAST_VLAN_SNOOPING ] [ mcast_router MULTICAST_ROUTER ] [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ] [ mcast_querier MULTICAST_QUERIER ] [ mcast_hash_elasticity HASH_ELASTICITY ] [ mcast_hash_max HASH_MAX ] [ mcast_last_member_count LAST_MEMBER_COUNT ] [ mcast_startup_query_count STARTUP_QUERY_COUNT ] [ mcast_last_member_interval LAST_MEMBER_INTERVAL ] [ mcast_membership_interval MEMBERSHIP_INTERVAL ] [ mcast_querier_interval QUERIER_INTERVAL ] [ mcast_query_interval QUERY_INTERVAL ] [ mcast_query_response_interval QUERY_RESPONSE_INTERVAL ] [ mcast_startup_query_interval STARTUP_QUERY_INTERVAL ] [ mcast_stats_enabled MCAST_STATS_ENABLED ] [ mcast_igmp_version IGMP_VERSION ] [ mcast_mld_version MLD_VERSION ] [ nf_call_iptables NF_CALL_IPTABLES ] [ nf_call_ip6tables NF_CALL_IP6TABLES ] [ nf_call_arptables NF_CALL_ARPTABLES ] [ mdb_offload_fail_notification MDB_OFFLOAD_FAIL_NOTIFICATION ]

And now the โœจexplainersโœจ, same order, no skips, no cap:

  • ageing_time AGEING_TIME โ€” sets how long the bridge's FDB (that's the forwarding database, its lil memory of MAC addresses) keeps an entry. Specifically: the number of seconds a MAC address sticks around in the FDB after a packet shows up from that address. Once that time passes, the entry gets cleaned up. bye felicia ๐Ÿ‘‹
  • group_fwd_mask MASK โ€” sets the group forward mask. This is the bitmask that decides whether incoming frames headed to link-local addresses get forwarded โ€” link-local meaning addresses shaped like 01:80:C2:00:00:0X. Defaults to 0, i.e. the bridge forwards zero link-local frames. gatekeeping, but make it networking ๐Ÿšซ
  • group_address ADDRESS โ€” sets the MAC address of the multicast group this bridge uses for STP. Heads up: the address has to be a link-local address in standard Ethernet MAC address format, i.e. one shaped like 01:80:C2:00:00:0X, with X in [0, 4..f].
  • forward_delay FORWARD_DELAY โ€” sets the forwarding delay in seconds, i.e. the time spent in LISTENING state (before moving to LEARNING) and in LEARNING state (before moving to FORWARDING). Only matters if STP is enabled. Valid values: between 2 and 30.
  • hello_time HELLO_TIME โ€” sets the time in seconds between hello packets the bridge sends, when it's a root bridge or a designated bridge. Only matters if STP is enabled. Valid values: between 1 and 10.
  • max_age MAX_AGE โ€” sets the hello packet timeout, i.e. how many seconds until another bridge in the spanning tree is assumed to be dead, counted from receiving its last hello message. Only matters if STP is enabled. Valid values: between 6 and 40.
  • stp_state STP_STATE โ€” turns spanning tree protocol on (STP_STATE > 0) or off (STP_STATE == 0) for this bridge.
  • stp_mode STP_MODE โ€” sets the STP mode for this bridge. This controls how the bridge picks between userspace and kernel STP when STP is enabled via stp_state. STP_MODE can be one of:
    • auto (default) โ€” invokes the /sbin/bridge-stp helper to hand the bridge over to a userspace STP daemon. Only attempted in the initial network namespace; in other namespaces this falls back to kernel STP.
    • user โ€” directly enables userspace STP without invoking the helper. Works in any network namespace. The caller is responsible for registering the bridge with the userspace STP daemon.
    • kernel โ€” directly enables kernel STP without invoking the helper.

Can only be changed while STP is disabled. Both stp_mode and stp_state can be set in a single command. ๐Ÿ”ฅ

  • mst_enabled MST_ENABLED โ€” turns multiple spanning tree (MST) support on (MST_ENABLED > 0) or off (MST_ENABLED == 0). When enabled, sets of VLANs can be associated with multiple spanning tree instances (MSTIs), and STP states for each port can be controlled on a per-MSTI basis. Note: no implementation of the MSTP protocol is provided, only the primitives needed to implement it. To avoid interfering with the legacy per-VLAN STP states, this setting can only be changed when no bridge VLANs are configured.
  • priority PRIORITY โ€” sets this bridge's spanning tree priority, used during STP root bridge election. PRIORITY is a 16bit unsigned integer.
  • no_linklocal_learn NO_LINKLOCAL_LEARN โ€” turns link-local learning on (NO_LINKLOCAL_LEARN == 0) or off (NO_LINKLOCAL_LEARN > 0). When disabled, the bridge will not learn from link-local frames (default: enabled).
  • fdb_local_vlan_0 FDB_LOCAL_VLAN_0 โ€” when disabled, local FDB entries (i.e. those for member port addresses and the address of the bridge itself) are kept at VLAN 0 as well as any member VLANs. When the option is enabled, they are only kept at VLAN 0. By default the option is disabled.

When this option is enabled, when making a forwarding decision, the bridge looks at VLAN 0 for a matching entry that is permanent, but not added by user. However in all other ways the entry only exists on VLAN 0. This affects dumping, where the entries are not shown on non-0 VLANs, and FDB get and flush do not find the entry on non-0 VLANs. When the entry is deleted, it affects forwarding on all VLANs.

  • fdb_max_learned FDB_MAX_LEARNED โ€” sets the maximum number of learned FDB entries. If (FDB_MAX_LEARNED == 0) the feature is disabled. Default is 0. FDB_MAX_LEARNED is a 32bit unsigned integer.
  • vlan_filtering VLAN_FILTERING โ€” turns VLAN filtering on (VLAN_FILTERING > 0) or off (VLAN_FILTERING == 0). When disabled, the bridge will not consider the VLAN tag when handling packets.
  • vlan_protocol { 802.1Q | 802.1ad } โ€” sets the protocol used for VLAN filtering.
  • vlan_default_pvid VLAN_DEFAULT_PVID โ€” sets the default PVID (that's native/untagged VLAN ID, bestie) for this bridge.
  • vlan_stats_enabled VLAN_STATS_ENABLED โ€” enables (VLAN_STATS_ENABLED == 1) or disables (VLAN_STATS_ENABLED == 0) per-VLAN stats accounting.
  • vlan_stats_per_port VLAN_STATS_PER_PORT โ€” enables (VLAN_STATS_PER_PORT == 1) or disables (VLAN_STATS_PER_PORT == 0) per-VLAN per-port stats accounting. Can be changed only when there are no port VLANs configured. ๐Ÿ™ˆ
  • mcast_snooping MULTICAST_SNOOPING โ€” turns multicast snooping on (MULTICAST_SNOOPING > 0) or off (MULTICAST_SNOOPING == 0).
  • mcast_vlan_snooping MULTICAST_VLAN_SNOOPING โ€” turns multicast VLAN snooping on (MULTICAST_VLAN_SNOOPING > 0) or off (MULTICAST_VLAN_SNOOPING == 0).
  • mcast_router MULTICAST_ROUTER โ€” sets the bridge's multicast router if IGMP snooping is enabled. MULTICAST_ROUTER is an integer value with these meanings:
    • 0 โ€” disabled.
    • 1 โ€” automatic (queried).
    • 2 โ€” permanently enabled.
  • mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR โ€” whether to use the bridge's own IP address as the source address for IGMP queries (MCAST_QUERY_USE_IFADDR > 0) or the default of 0.0.0.0 (MCAST_QUERY_USE_IFADDR == 0).
  • mcast_querier MULTICAST_QUERIER โ€” enables (MULTICAST_QUERIER > 0) or disables (MULTICAST_QUERIER == 0) the IGMP querier, i.e. sending of multicast queries by the bridge (default: disabled).
  • mcast_querier_interval QUERIER_INTERVAL โ€” interval between queries sent by other routers. If no queries are seen after this delay has passed, the bridge will start to send its own queries (as if mcast_querier was enabled). it said fine, i'll do it myself ๐Ÿ’…
  • mcast_hash_elasticity HASH_ELASTICITY โ€” sets multicast database hash elasticity, i.e. the maximum chain length in the multicast hash table (defaults to 4).
  • mcast_hash_max HASH_MAX โ€” sets the maximum size of the multicast hash table (defaults to 512, and the value must be a power of 2).
  • mcast_last_member_count LAST_MEMBER_COUNT โ€” sets multicast last member count, i.e. the number of queries the bridge will send before stopping forwarding a multicast group after a "leave" message has been received (defaults to 2).
  • mcast_last_member_interval LAST_MEMBER_INTERVAL โ€” interval between queries to find the remaining members of a group, after a "leave" message is received.
  • mcast_startup_query_count STARTUP_QUERY_COUNT โ€” sets the number of IGMP queries to send during the startup phase (defaults to 2).

okay pausing there because there's more coming and you do NOT want me to rush the rest, we still have intervals, versions, netfilter calls and offload notifications to get through ๐Ÿฆ‹๐Ÿ’œ

  • mcast_startup_query_interval STARTUP_QUERY_INTERVAL โ€” the interval between queries while the bridge is in its startup phase. yes, startup phase gets its own lil timing vibe ๐Ÿ’…
  • mcast_query_interval QUERY_INTERVAL โ€” the interval between queries the bridge sends once the startup phase is over and done. post-startup era โœจ
  • mcast_query_response_interval QUERY_RESPONSE_INTERVAL โ€” sets the Max Response Time / Maximum Response Delay for the IGMP/MLD queries the bridge is sending out. no cap ๐ŸŽ€
  • mcast_membership_interval MEMBERSHIP_INTERVAL โ€” the delay after which the bridge will leave a group if it's getting no membership reports for that group. basically the ghosting timer ๐Ÿซถ
  • mcast_stats_enabled MCAST_STATS_ENABLED โ€” turns multicast (IGMP/MLD) stats accounting on if MCAST_STATS_ENABLED > 0, or off if MCAST_STATS_ENABLED == 0. the receipts... tracked or not tracked ๐Ÿ“Š
  • mcast_igmp_version IGMP_VERSION โ€” set the IGMP version.
  • mcast_mld_version MLD_VERSION โ€” set the MLD version.
  • nf_call_iptables NF_CALL_IPTABLES โ€” enable the iptables hooks on the bridge (NF_CALL_IPTABLES > 0) or disable them (NF_CALL_IPTABLES == 0). ๐Ÿ”ฅ
  • nf_call_ip6tables NF_CALL_IP6TABLES โ€” enable the ip6tables hooks on the bridge (NF_CALL_IP6TABLES > 0) or disable them (NF_CALL_IP6TABLES == 0).
  • nf_call_arptables NF_CALL_ARPTABLES โ€” enable the arptables hooks on the bridge (NF_CALL_ARPTABLES > 0) or disable them (NF_CALL_ARPTABLES == 0). arptables girlies rise ๐Ÿ™ˆ
  • mdb_offload_fail_notification MDB_OFFLOAD_FAIL_NOTIFICATION โ€” turn the mdb offload fail notification on (MDB_OFFLOAD_FAIL_NOTIFICATION > 0) or off (MDB_OFFLOAD_FAIL_NOTIFICATION == 0). Default is 0. ๐Ÿ‘‘

๐ŸŒˆ MACsec Type Support ๐ŸŒˆ

So if your link is type MACsec, there's a whole extra menu of arguments, bestie. feast your eyes:

ip link add link DEVICE name NAME type macsec [ [ address <lladdr> ] port PORT | sci SCI ] [ cipher CIPHER_SUITE ] [ icvlen { 8..16 } ] [ encrypt { on | off } ] [ send_sci { on | off } ] [ end_station { on | off } ] [ scb { on | off } ] [ protect { on | off } ] [ replay { on | off } window { 0..2^32-1 } ] [ validate { strict | check | disabled } ] [ encodingsa { 0..3 } ]
  • address <lladdr> โ€” sets the system identifier component of the secure channel for this MACsec device.
  • port PORT โ€” sets the port number component of the secure channel for this MACsec device, and it's gotta be in range from 1 to 65535 inclusive. Heads up: numbers with a leading " 0 " or " 0x " get interpreted as octal and hexadecimal respectively. iykyk ๐Ÿงš
  • sci SCI โ€” sets the secure channel identifier for this MACsec device. SCI is a 64bit wide number in hexadecimal format.
  • cipher CIPHER_SUITE โ€” defines the cipher suite to use. pick your fighter ๐Ÿ’œ
  • icvlen LENGTH โ€” sets the length of the Integrity Check Value (ICV).
  • encrypt on or encrypt off โ€” switches between authenticated encryption, or authenticity mode only.
  • send_sci on or send_sci off โ€” specifies whether the SCI is included in every packet, or only when it's necessary.
  • end_station on or end_station off โ€” sets the End Station bit.
  • scb on or scb off โ€” sets the Single Copy Broadcast bit.
  • protect on or protect off โ€” enables MACsec protection on the device.
  • replay on or replay off โ€” enables replay protection on the device.
    • window SIZE โ€” sets the size of the replay window.
  • validate strict or validate check or validate disabled โ€” sets the validation mode on the device.
  • encodingsa AN โ€” sets the active secure association for transmission.

๐Ÿฆ‹ VRF Type Support ๐Ÿฆ‹

For a link of type VRF the following additional arguments are supported:

ip link add DEVICE type vrf table TABLE
  • table โ€” table id associated with the VRF device.

โญ RMNET Type Support โญ

For a link of type RMNET the following additional arguments are supported:

ip link add link DEVICE name NAME type rmnet mux_id MUXID
  • mux_id MUXID โ€” specifies the mux identifier for the rmnet device, possible values 1-254.

๐Ÿ’€ XFRM Type Support ๐Ÿ’€

For a link of type XFRM the following additional arguments are supported:

ip link add DEVICE type xfrm dev PHYS_DEV [ if_id IF_ID ] [ external ]
  • dev PHYS_DEV โ€” specifies the underlying physical interface from which transform traffic is sent and received.
  • if_id IF-ID โ€” specifies the hexadecimal lookup key used to send traffic to and from specific xfrm policies. Policies must be configured with the same key. If it's not set, the key defaults to 0 and will match any policies which similarly do not have a lookup key configuration.
  • external โ€” make this device externally controlled. This flag is mutually exclusive with the dev and if_id options. pick one, bestie, you can't have both ๐Ÿšซ

๐ŸŒธ GTP Type Support ๐ŸŒธ

For a link of type GTP the following additional arguments are supported:

ip link add DEVICE type gtp role ROLE hsize HSIZE
  • role ROLE โ€” specifies the role of the GTP device, either sgsn or ggsn.
  • hsize HSIZE โ€” specifies size of the hashtable which stores PDP contexts.
  • restart_count RESTART_COUNT โ€” GTP instance restart counter.

๐ŸŽ€ PFCP Type Support ๐ŸŽ€

For a link of type PFCP no additional arguments are supported. that's it. that's the whole thing. ๐Ÿ’…


  • dev DEVICE โ€” specifies the virtual device to act operate on.
  • group GROUP โ€” specifies the group of virtual links to delete. Group 0 is not allowed to be deleted since it is the default group. the default group is literally the main character, she stays ๐ŸŒŸ
  • type TYPE โ€” specifies the type of the device.

โš ๏ธ Warning: If multiple parameter changes are requested, ip aborts immediately after any of the changes have failed. This is the only case when ip can move the system to an unpredictable state. The solution is to avoid changing several parameters with one ip link set call. The modifier change is equivalent to set.

like bestie, one thing at a time, ok?? do NOT be greedy with your parameter changes or the system gets feral ๐Ÿ˜ญ

  • dev DEVICE โ€” DEVICE specifies network device to operate on. When you're configuring SR-IOV Virtual Function (VF) devices, this keyword should specify the associated Physical Function (PF) device.
  • group GROUP โ€” GROUP has a dual role: If both group and dev are present, then it moves the device to the specified group. If only a group is specified, then the command operates on all devices in that group. multitasking queen ๐Ÿ‘‘
  • up and down โ€” change the state of the device to UP or DOWN.
  • arp on or arp off โ€” change the NOARP flag on the device.
  • multicast on or multicast off โ€” change the MULTICAST flag on the device.
  • allmulticast on or allmulticast off โ€” change the ALLMULTI flag on the device. When enabled, it instructs the network driver to retrieve all multicast packets from the network to the kernel for further processing.
  • promisc on or promisc off โ€” change the PROMISC flag on the device. When enabled, it activates promiscuous operation of the network device. she's seeing everything ๐Ÿ™ˆ
  • trailers on or trailers off โ€” change the NOTRAILERS flag on the device. It's NOT used by the Linux and exists for BSD compatibility. a lil vintage relic, we respect her ๐ŸŽ€
  • protodown on or protodown off โ€” change the PROTODOWN state on the device. Indicates that a protocol error has been detected on the port. Switch drivers can react to this error by doing a phys down on the switch port.
  • protodown_reason PREASON on or off โ€” set PROTODOWN reasons on the device. protodown reason bit names can be enumerated under /etc/iproute2/protodown_reasons.d/. possible reasons bits 0-31.
  • dynamic on or dynamic off โ€” change the DYNAMIC flag on the device. Indicates that address can change when interface goes down (currently NOT used by the Linux). girl is flagging but nobody's listening ๐Ÿ˜ญ
  • name NAME โ€” change the name of the device. This operation is not recommended if the device is running or has some addresses already configured.
  • txqueuelen NUMBER
  • txqlen NUMBER โ€” change the transmit queue length of the device.
  • mtu NUMBER โ€” change the MTU of the device.
  • address LLADDRESS โ€” change the station address of the interface.
  • broadcast LLADDRESS
  • brd LLADDRESS
  • peer LLADDRESS โ€” change the link layer broadcast address or the peer address when the interface is POINTOPOINT.
  • netns { PID | NETNSNAME | NETNSFILE } โ€” move the device to the network namespace associated with process PID or the name NETNSNAME or the file NETNSFILE.

Some devices are not allowed to change network namespace: loopback, bridge, wireless. These are network namespace local devices. In such case the ip tool will return "Invalid argument" error. It is possible to find out if a device is local to a single network namespace by checking the netns-local flag in the output of the ethtool:

ethtool -k DEVICE

To change network namespace for wireless devices the iw tool can be used. But it allows one to change network namespace only for physical devices and by process PID.

  • alias NAME โ€” give the device a symbolic name for easy reference. a cute nickname, if you will ๐Ÿ’œ
  • group GROUP โ€” specify the group the device belongs to. The available groups are listed in /usr/share/iproute2/group or /etc/iproute2/group (has precedence if exists).
  • vf NUM โ€” specify a Virtual Function device to be configured. The associated PF device must be specified using the dev parameter.
    • mac LLADDRESS โ€” change the station address for the specified VF. The vf parameter must be specified.
  • vlan VLANID โ€” reassigns the VLAN that belongs to the VF you named. Once you set it, every packet the VF sends gets tagged with that VLAN ID, incoming traffic gets filtered for that same ID, and all the VLAN tags get stripped off before anything reaches the VF ๐Ÿ’… Setting this to 0 turns VLAN tagging and filtering all the way off. Oh and you literally must pass the vf parameter, no skipping ๐Ÿซถ
  • qos VLAN-QOS โ€” hands the VLAN tag its QOS (priority) bits โœจ When you set it, every VLAN tag the VF transmits carries those priority bits. Not specified? Then the value is just assumed to be 0. Both vf and vlan have to be specified. And heads up: setting both vlan and qos to 0 disables VLAN tagging and filtering for that VF entirely.
  • proto VLAN-PROTO โ€” picks the VLAN PROTOCOL for the tag, either 802.1Q or 802.1ad ๐Ÿ‘‘ Set it to 802.1ad and all traffic sent from the VF gets tagged with a VLAN S-Tag, while incoming traffic has its VLAN S-Tags stripped before being passed to the VF. Setting 802.1ad also unlocks the option to concatenate another VLAN tag, so both S-TAG and C-TAG get inserted/stripped for outgoing/incoming traffic respectively ๐ŸŽ€ If you don't specify anything, the value is assumed to be 802.1Q. Both the vf and vlan parameters must be specified.
  • rate TXRATE -- โ€” changes the allowed transmit bandwidth, in Mbps, for the specified VF. Setting this to 0 disables rate limiting. The vf parameter must be specified. > ok bestie real talk: please use the new max_tx_rate option instead, this one's the old API ๐Ÿ™ˆ
  • max_tx_rate TXRATE - โ€” changes the allowed maximum transmit bandwidth, in Mbps, for the specified VF. Setting this to 0 disables rate limiting. The vf parameter must be specified.
  • min_tx_rate TXRATE - โ€” changes the allowed minimum transmit bandwidth, in Mbps, for the specified VF. Minimum TXRATE should always be <= Maximum TXRATE, no cap ๐Ÿ“ Setting this to 0 disables rate limiting. The vf parameter must be specified.
  • spoofchk on|off โ€” flips packet spoof checking on or off for the specified VF.
  • query_rss on|off โ€” toggles whether you're allowed to query the RSS configuration of a specific VF. VF RSS info like the RSS hash key can be considered sensitive on some devices, since it's shared between the VF and the PF โ€” so querying it may be prohibited by default ๐Ÿ”’
  • state auto|enable|disable โ€” sets the virtual link state as seen by the specified VF. auto means it just reflects the PF link state. enable lets the VF talk to other VFs on this host even when the PF link state is down. disable makes the HW drop any packet the VF sends ๐Ÿ’€
  • trust on|off โ€” trusts the specified VF user. This means that VF user can set a specific feature that may impact security and/or performance (e.g. VF multicast promiscuous mode) ๐Ÿ‘€
  • node_guid eui64 โ€” configures the node GUID for Infiniband VFs.
  • port_guid eui64 โ€” configures the port GUID for Infiniband VFs.

๐Ÿฆ‹ xdp object | pinned | off ๐Ÿฆ‹

Sets (or unsets) a XDP ("eXpress Data Path") BPF program to run on every packet at driver level ๐Ÿ”ฅ Your ip link output will show a xdp flag on the networking device.

If the driver doesn't have native XDP support, the kernel falls back to a slower, driver-independent "generic" XDP variant โ€” and then the ip link output says xdpgeneric instead of just xdp. If the driver does have native XDP support, but the program is loaded under xdpgeneric object | pinned, then the kernel uses the generic XDP variant instead of the native one.

xdpdrv does the opposite: it requests that the automatic fallback to the generic XDP variant be disabled, and if the driver isn't XDP-capable an error should be returned. xdpdrv also disables hardware offloads โœจ

xdpoffload in the ip link output means the program has been offloaded to hardware, and it can also be used to request the "offload" mode โ€” much like xdpgeneric, it forces the program to be installed specifically in the HW/FW of the adapter ๐Ÿ’…

  • off (or none ) โ€” Detaches any currently attached XDP/BPF program from the given device. Bye felicia ๐Ÿ‘‹
  • object FILE โ€” Attaches a XDP/BPF program to the given device. FILE points to a BPF ELF file (f.e. generated by LLVM) that contains the BPF program code, map specifications, etc. If a XDP/BPF program is already attached to the given device, an error will be thrown. If no XDP/BPF program is currently attached, the device supports XDP, and the program from the BPF ELF file passes the kernel verifier, then it will be attached to the device. If the option -force is passed to ip then any prior attached XDP/BPF program will be atomically overridden and no error will be thrown in this case ๐Ÿ˜ค If no section option is passed, then the default section name ("prog") will be assumed, otherwise the provided section name will be used. If no verbose option is passed, then a verifier log will only be dumped on load error. See also the EXAMPLES section for usage examples.
  • section NAME โ€” Specifies a section name that contains the BPF program code. If no section name is specified, the default one ("prog") will be used. This option is to be passed with the object option.
  • program NAME โ€” Specifies the BPF program name that need to be attached. When the program name is specified, the section name parameter will be ignored. This option only works when iproute2 build with libbpf support.
  • verbose โ€” Act in verbose mode. For example, even in case of success, this will print the verifier log in case a program was loaded from a BPF ELF file ๐Ÿ—’๏ธ
  • pinned FILE โ€” Attaches a XDP/BPF program to the given device. FILE points to an already pinned BPF program in the BPF file system. The option section doesn't apply here, but otherwise the semantics are the same as with the option object described already.

๐Ÿ‘‘ master DEVICE ๐Ÿ‘‘

set master device of the device (enslave device).

๐Ÿ‘‘ nomaster ๐Ÿ‘‘

unset master device of the device (release device).

๐ŸŒˆ addrgenmode eui64|none|stable_secret|random ๐ŸŒˆ

set the IPv6 address generation mode

  • eui64 โ€” use a Modified EUI-64 format interface identifier
  • none โ€” disable automatic address generation
  • stable_secret โ€” generate the interface identifier based on a preset /proc/sys/net/ipv6/conf/{default,DEVICE}/stable_secret
  • random โ€” like stable_secret, but auto-generate a new random secret if none is set ๐ŸŽฒ

๐Ÿ’œ inet ๐Ÿ’œ

set the IPv4 devconf network parameters for the specific device. These parameters map directly to the kernel's IPv4 interface sysctls.

  • forwarding { on | off } โ€” enable or disable IPv4 forwarding on the device.
  • proxy_arp, accept_redirects, secure_redirects, send_redirects, shared_media, accept_source_route, bootp_relay, log_martians, arp_filter, disable_xfrm, disable_policy, promote_secondaries, arp_notify, accept_local, src_vmark, proxy_arp_pvlan, route_localnet, bc_forwarding, ignore_routes_with_linkdown, drop_unicast_in_l2_multicast, drop_gratuitous_arp, arp_evict_nocarrier, { on | off } โ€” toggle the corresponding boolean network parameter ๐ŸŽš๏ธ
  • rp_filter { 0 | 1 | 2 } โ€” set reverse path filtering.
  • arp_announce { 0 | 1 | 2 } โ€” define different restriction levels for announcing the local source IP address from IP packets in ARP requests.
  • arp_ignore { 0 | 1 | ... | 8 } โ€” define different modes for replying to ARP requests that resolve local target IP addresses.
  • arp_accept { 0 | 1 | 2 } โ€” define behavior for gratuitous ARP frames.
  • force_igmp_version { 0 | 1 | 2 | 3 } โ€” force IGMP version.
  • tag TAG โ€” set the interface tag.
  • medium_id ID โ€” set the interface medium ID.
  • igmpv2_unsolicited_report_interval INTERVAL igmpv3_unsolicited_report_interval INTERVAL โ€” set the IGMP unsolicited report interval in milliseconds โฑ๏ธ

set peer netnsid for a cross-netns interface


๐Ÿงš type ETYPE TYPE_ARGS ๐Ÿงš

Change type-specific settings. For a list of supported types and arguments refer to the description of ip link add above. In addition to that, it is possible to manipulate settings to slave devices:

๐ŸŒŸ Bridge Slave Support ๐ŸŒŸ

For a link with master bridge the following additional arguments are supported:

ip link set type bridge_slave [ fdb_flush ] [ state STATE ] [ priority PRIO ] [ cost COST ] [ guard { on | off } ] [ hairpin { on | off } ] [ fastleave { on | off } ] [ root_block { on | off } ] [ learning { on | off } ] [ flood { on | off } ] [ proxy_arp { on | off } ] [ proxy_arp_wifi { on | off } ] [ mcast_router MULTICAST_ROUTER ] [ mcast_fast_leave { on | off} ] [ bcast_flood { on | off } ] [ mcast_flood { on | off } ] [ mcast_to_unicast { on | off } ] [ group_fwd_mask MASK ] [ neigh_suppress { on | off } ] [ neigh_vlan_suppress { on | off } ] [ neigh_forward_grat { on | off } ] [ vlan_tunnel { on | off } ] [ isolated { on | off } ] [ locked { on | off } ] [ mab { on | off } ] [ backup_port DEVICE ] [ nobackup_port ] [ backup_nhid NHID ]
  • fdb_flush โ€” flush bridge slave's fdb dynamic entries ๐Ÿงน
  • state STATE โ€” Set port state. STATE is a number representing the following states: 0 (disabled), 1 (listening), 2 (learning), 3 (forwarding), 4 (blocking).
  • priority PRIO โ€” sets the port priority, and bestie the allowed values are between 0 and 63, inclusively, so don't go rogue. ๐Ÿ’…
  • cost COST โ€” sets the port cost. Allowed values are between 1 and 65535, inclusively. That's the range, no cap on vibes though.
  • guard { on | off } โ€” blocks incoming BPDU packets on this port. Boundaries, we love to see it. ๐Ÿšซ
  • hairpin { on | off } โ€” turns on hairpin mode for this port. This will allow incoming packets on this port to be reflected back. It's giving mirror selfie honestly. ๐Ÿชž
  • fastleave { on | off } โ€” enables multicast fast leave on this port.
  • root_block { on | off } โ€” blocks this port from becoming the bridge's root port. Not everyone gets to be the main character. ๐Ÿ‘‘
  • learning { on | off } โ€” allows MAC address learning on this port.
  • flood { on | off } โ€” opens the flood gates on this port, i.e. forward all unicast frames to this port also. It requires proxy_arp and proxy_arp_wifi to be turned off. So like, they cannot coexist, fr fr.
  • proxy_arp { on | off } โ€” enables proxy ARP on this port.
  • proxy_arp_wifi { on | off } โ€” enables proxy ARP on this port which meets extended requirements by IEEE 802.11 and Hotspot 2.0 specifications. Fancy wifi edition. โœจ
  • mcast_router MULTICAST_ROUTER โ€” configures this port for having multicast routers attached. A port with a multicast router will receive all multicast traffic. MULTICAST_ROUTER may be either:
    • 0 to disable multicast routers on this port
    • 1 to let the system detect the presence of routers โ€” this is the default
    • 2 to permanently enable multicast traffic forwarding on this port
    • 3 to enable multicast routers temporarily on this port, not depending on incoming queries
  • mcast_fast_leave { on | off } โ€” this is a synonym to the fastleave option above. Same thing, different name, we love a rebrand. ๐Ÿฆ‹
  • bcast_flood { on | off } โ€” controls flooding of broadcast traffic on the given port. By default this flag is on.
  • mcast_flood { on | off } โ€” controls whether a given port will flood multicast traffic for which there is no MDB entry. By default this flag is on.
  • mcast_to_unicast { on | off } โ€” controls whether a given port will replicate packets using unicast instead of multicast. By default this flag is off.
  • group_fwd_mask MASK โ€” sets the group forward mask. This is the bitmask that is applied to decide whether to forward incoming frames destined to link-local addresses, ie addresses of the form 01:80:C2:00:00:0X (defaults to 0, ie the bridge does not forward any link-local frames coming on this port). Mask reveal, but make it network. ๐ŸŽญ
  • neigh_suppress { on | off } โ€” controls whether neigh discovery (arp and nd) proxy and suppression is enabled on the port. By default this flag is off.
  • neigh_vlan_suppress { on | off } โ€” controls whether per-VLAN neigh discovery (arp and nd) proxy and suppression is enabled on the port. When on, the bridge link option neigh_suppress has no effect and the per-VLAN state is set using the bridge vlan option neigh_suppress. By default this flag is off. So it's giving override energy, lowkey.
  • neigh_forward_grat { on | off } โ€” controls whether gratuitous ARP packets and unsolicited Neighbor Advertisement packets are forwarded when neighbor suppression is enabled on the port. By default this flag is off, meaning gratuitous ARP and unsolicited NA packets will be suppressed when neighbor suppression is enabled. Setting this flag to on allows these packets to be forwarded even when neighbor suppression is enabled.
  • vlan_tunnel { on | off } โ€” controls whether vlan to tunnel mapping is enabled on the port. By default this flag is off.
  • locked { on | off } โ€” controls whether a port is locked or not. When locked, non-link-local frames received through the port are dropped unless an FDB entry with the MAC source address points to the port. The common use case is IEEE 802.1X where hosts can authenticate themselves by exchanging EAPOL frames with an authenticator. After authentication is complete, the user space control plane can install a matching FDB entry to allow traffic from the host to be forwarded by the bridge. When learning is enabled on a locked port, the no_linklocal_learn bridge option needs to be on to prevent the bridge from learning from received EAPOL frames. By default this flag is off.
  • mab { on | off } โ€” controls whether MAC Authentication Bypass (MAB) is enabled on the port or not. MAB can only be enabled on a locked port that has learning enabled. When enabled, FDB entries are learned from received traffic and have the "locked" FDB flag set. The flag can only be set by the kernel and it indicates that the FDB entry cannot be used to authenticate the corresponding host. User space can decide to authenticate the host by replacing the FDB entry and clearing the "locked" FDB flag. Locked FDB entries can roam to unlocked (authorized) ports in which case the "locked" flag is cleared. FDB entries cannot roam to locked ports regardless of MAB being enabled or not. Therefore, locked FDB entries are only created if an FDB entry with the given {MAC, VID} does not already exist. This behavior prevents unauthenticated hosts from disrupting traffic destined to already authenticated hosts. Locked FDB entries act like regular dynamic entries with respect to forwarding and aging. By default this flag is off. Okay that was a whole saga but every word of it matters bestie, no skipping. ๐Ÿ˜ค
  • backup_port DEVICE โ€” if the port loses carrier all traffic will be redirected to the configured backup port. Backup bestie activated. ๐Ÿซถ
  • nobackup_port โ€” removes the currently configured backup port. Bestie, you're on your own now.
  • backup_nhid NHID โ€” the FDB nexthop object ID (see ip-nexthop(8)) to attach to packets being redirected to a backup port that has VLAN tunnel mapping enabled (via the vlan_tunnel option). Setting a value of 0 (default) has the effect of not attaching any ID.

๐Ÿ’– Bonding Slave Support ๐Ÿ’–

For a link with master bond the following additional arguments are supported:

ip link set type bond_slave [ queue_id ID ] [ prio PRIORITY ]
  • queue_id ID โ€” set the slave's queue ID (a 16bit unsigned value).
  • prio PRIORITY โ€” set the slave's priority for active slave re-selection during failover (a 32bit signed value). This option only valid for active-backup(1), balance-tlb (5) and balance-alb (6) mode.
  • actor_port_prio PRIORITY โ€” set the slave's ad actor port priority for 802.3ad aggregation selection logic during failover (a 16bit unsigned value). This option only valid for 802.3ad (4) mode.

๐ŸŒˆ MACVLAN and MACVTAP Support ๐ŸŒˆ

Modify list of allowed macaddr for link in source mode.

ip link set type { macvlan | macvap } [ macaddr COMMAND MACADDR ... ]

Commands:

  • add โ€” add MACADDR to allowed list
  • set โ€” replace allowed list
  • del โ€” remove MACADDR from allowed list
  • flush โ€” flush whole allowed list

Update the broadcast/multicast queue length.

ip link set type { macvlan | macvap } [ bcqueuelen  LENGTH ] [ bclim LIMIT ]
  • bcqueuelen LENGTH โ€” Set the length of the RX queue used to process broadcast and multicast packets. LENGTH must be a positive integer in the range [0-4294967295]. Setting a length of 0 will effectively drop all broadcast/multicast traffic. If not specified the macvlan driver default (1000) is used. Note that all macvlans that share the same underlying device are using the same queue. The parameter here is a request, the actual queue length used will be the maximum length that any macvlan interface has requested. When listing device parameters both the bcqueuelen parameter as well as the actual used bcqueuelen are listed to better help the user understand the setting. They're showing their work, we love transparency. ๐Ÿ’…
  • bclim LIMIT โ€” Set the threshold for broadcast queueing. LIMIT must be a 32-bit integer. Setting this to -1 disables broadcast queueing altogether. Otherwise a multicast address will be queued as broadcast if the number of devices using it is greater than the given value.

๐Ÿฆ‹ DSA user port support ๐Ÿฆ‹

For a link having the DSA user port type, the following additional arguments are supported:

ip link set type dsa [ conduit DEVICE ]
  • conduit DEVICE โ€” change the DSA conduit (host network interface) responsible for handling the locally terminated traffic for the given DSA switch user port. For a description of which network interfaces are suitable for serving as conduit interfaces of this user port, please see https://docs.kernel.org/networking/dsa/configuration.html#affinity-of-user-ports-to-cpu-ports as well as what is supported by the driver in use. Yeah bestie, go read the docs, iykyk. ๐Ÿ“š
  • master DEVICE โ€” this is a synonym for "conduit".

  • dev NAME (default) โ€” NAME specifies the network device to show.
  • group GROUP โ€” GROUP specifies what group of devices to show.
  • up โ€” only display running interfaces. Glow-up only. โœจ
  • down โ€” only display not running interfaces. The sad ones.
  • master DEVICE โ€” DEVICE specifies the master device which enslaves devices to show.
  • vrf NAME โ€” NAME specifies the VRF which enslaves devices to show.
  • type TYPE โ€” TYPE picks which kind of devices show up. and bestie, listen: that type name is not checked against the list of supported types ๐Ÿ˜ณ it gets sent as-is straight to the kernel. only later is it used to filter the returned interface list, by comparing it against the relevant attribute โ€” and only in case the kernel didn't already filter. so likeโ€ฆ any string is accepted, but you might just get empty output for your troubles. it's giving vibes-based filtering ๐Ÿ’€
  • nomaster โ€” only show devices with no master. orphan era ๐Ÿ’…
  • novf โ€” only show devices with no VF info โœจ
  • type TYPE โ€” TYPE says which kind of devices to display extended statistics for. very "show me the numbers" of it.
  • dev DEVICE โ€” DEVICE says which device to display address-family statistics for. one device, one destiny ๐Ÿซถ

TYPE specifies which help of link type to display. (yes the option and the vibe are both just TYPE, iconic behavior)

GROUP ๐Ÿ‘‘

may be a number or a string from /usr/share/iproute2/group or /etc/iproute2/group, which you can manually fill, and which has precedence if it exists. so you can name your little groups, bestie, go off ๐ŸŒธ


โœจ EXAMPLES โœจ

okay so here's the whole glow-up tour, one command at a time ๐Ÿ’–

ip link show

Shows the state of all network interfaces on the system. the whole main-character lineup ๐ŸŽ€

ip link show type bridge

Shows the bridge devices.

ip link show type vlan

Shows the vlan devices.

ip link show master br0

Shows devices enslaved by br0. (their words, not mine, but yes โ€” enslaved ๐Ÿ˜ญ)

ip link set dev ppp0 mtu 1400

Change the MTU the ppp0 device. (that's the original phrasing, and honestly? it ate. it understood.)

ip link add link eth0 name eth0.10 type vlan id 10

Creates a new vlan device eth0.10 on device eth0. nesting era ๐Ÿช†

ip link delete dev eth0.10

Removes vlan device. bye bestie ๐Ÿ‘‹

ip link help gre

Display help for the gre link type.

ip link add name tun1 type ipip remote 192.168.1.1 local 192.168.1.2 ttl
225 encap gue encap-sport auto encap-dport 5555 encap-csum encap-remcsum

Creates an IPIP that is encapsulated with Generic UDP Encapsulation, and the outer UDP checksum and remote checksum offload are enabled. packed with options, no notes โœ…

ip link set dev eth0 xdp obj prog.o

Attaches a XDP/BPF program to device eth0, where the program is located in prog.o, section "prog" (default section). In case a XDP/BPF program is already attached, throw an error. no second chances, periodt ๐Ÿ’€

ip -force link set dev eth0 xdp obj prog.o sec foo

Attaches a XDP/BPF program to device eth0, where the program is located in prog.o, section "foo". In case a XDP/BPF program is already attached, it will be overridden by the new one. -force said "make it make sense" and it did ๐Ÿ”ฅ

ip -force link set dev eth0 xdp pinned /sys/fs/bpf/foo

Attaches a XDP/BPF program to device eth0, where the program was previously pinned as an object node into BPF file system under name foo. reusing your own slay, we love a sustainable queen ๐ŸŒฑ

ip link set dev eth0 xdp off

If a XDP/BPF program is attached on device eth0, detach it and effectively turn off XDP for device eth0. goodbye forever ๐Ÿฆ‹

ip link add link wpan0 lowpan0 type lowpan

Creates a 6LoWPAN interface named lowpan0 on the underlying IEEE 802.15.4 device wpan0.

ip link add dev ip6erspan11 type ip6erspan seq key 102 local fc00:100::2
remote fc00:100::1 erspan_ver 2 erspan_dir ingress erspan_hwid 17

Creates a IP6ERSPAN version 2 interface named ip6erspan00. (yes that's what the manpage says, that's the command name, we don't fight the lore ๐Ÿ™ˆ)

ip link set dev swp0 type dsa conduit eth1

Changes the conduit interface of the swp0 user port to eth1. rerouting your whole social life in one line ๐Ÿ’…


๐ŸŒŸ SEE ALSO ๐ŸŒŸ

these are the group chat, go read them too bestie ๐Ÿซถ


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Original Manpage by Michail Litvak <mci@owl.openwall.com>


and that's the whole page, bestie!! this icon was written for iproute2 and dated 13 Dec 2012, and you just finished reading IP-LINK(8) โ€” congrats, you're officially the main character of your own network stack ๐ŸŒˆโญ no cap, go run some commands ๐Ÿ’–

๐Ÿ“ฆ where this page comes from