ip-link8
Network device configuration
Usage
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]
object {FILE
[{section | program}
NAME]
[verbose] | }
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 { | }
ip link
show
[{DEVICE | group
GROUP}]
[{up | down}]
[master
DEVICE]
[type
ETYPE]
[vrf
NAME]
[nomaster]
[novf]
ip link
xstats
type
TYPE
[ARGS]
ip link
afstats
[dev
DEVICE]
ip link
help
[TYPE]
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]]
ip link
property
add
dev
DEVICE
[altname
NAME
..]
ip link
property
del
dev
DEVICE
[altname
NAME
..]
Overview
ip link add - add virtual link
linkDEVICE-
specifies the physical device to act operate on.
NAME specifies the name of the new virtual device.
TYPE specifies the type of the new device.
Link types:
amt- Automatic Multicast Tunneling (AMT)bareudp- Bare UDP L3 encapsulation supportbond- Bonding devicebridge- Ethernet Bridge devicecan- Controller Area Networkdsa- Distributed Switch Architecturedummy- Dummy network interfaceerspan- Encapsulated Remote SPAN over GRE and IPv4geneve- GEneric NEtwork Virtualization Encapsulationgre- Virtual tunnel interface GRE over IPv4gretap- Virtual L2 tunnel interface GRE over IPv4gtp- GPRS Tunneling Protocolhsr- High-availability Seamless Redundancy deviceifb- Intermediate Functional Block deviceip6erspan- Encapsulated Remote SPAN over GRE and IPv6ip6gre- Virtual tunnel interface GRE over IPv6ip6gretap- Virtual L2 tunnel interface GRE over IPv6ip6tnl- Virtual tunnel interface IPv4|IPv6 over IPv6ipip- Virtual tunnel interface IPv4 over IPv4ipoib- IP over Infiniband deviceipvlan- Interface for L3 (IPv6/IPv4) based VLANsipvtap- Interface for L3 (IPv6/IPv4) based VLANs and TAPlowpan- Interface for 6LoWPAN (IPv6) over IEEE 802.15.4 / Bluetoothmacsec- 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 testsnetkit- BPF-programmable network devicenlmon- Netlink monitoring deviceovpn- OpenVPN Data Channel Offload devicepfcp- Packet Forwarding Control Protocol devicermnet- Qualcomm rmnet devicesit- Virtual tunnel interface IPv6 over IPv4vcan- Virtual Controller Area Network interfaceveth- Virtual ethernet interfacevirt_wifi- rtnetlink wifi simulation devicevlan- 802.1q tagged virtual LAN interfacevrf- Interface for L3 VRF domainsvti- Virtual tunnel interfacevxcan- Virtual Controller Area Network tunnel interfacevxlan- Virtual eXtended LANxfrm- Virtual xfrm interface
numtxqueuesQUEUE_COUNT-
specifies the number of transmit queues for new device.
numrxqueuesQUEUE_COUNT-
specifies the number of receive queues for new device.
gso_max_sizeBYTES-
specifies the recommended maximum size of a Generic Segment Offload packet the new device should accept. This is also used to enable BIG TCP for IPv6 on this device when the size is greater than 65536.
gso_ipv4_max_sizeBYTES-
specifies the recommended maximum size of a IPv4 Generic Segment Offload packet the new device should accept. This is especially used to enable BIG TCP for IPv4 on this device by setting to a size greater than 65536. Note that
gso_max_sizeneeds to be set to a size greater than or equal togso_ipv4_max_sizeto really enable BIG TCP for IPv4.
gso_max_segsSEGMENTS-
specifies the recommended maximum number of a Generic Segment Offload segments the new device should accept.
gro_max_sizeBYTES-
specifies the maximum size of a packet built by GRO stack on this device. This is also used for BIG TCP to allow the size of a merged IPv6 GSO packet on this device greater than 65536.
gro_ipv4_max_sizeBYTES-
specifies the maximum size of a IPv4 packet built by GRO stack on this device. This is especially used for BIG TCP to allow the size of a merged IPv4 GSO packet on this device greater than 65536.
indexIDX-
specifies the desired index of the new virtual device. The link creation fails, if the index is busy.
netns-
{ PID | NETNSNAME | NETNSFILE }
create the device in the network namespace associated with process PID or the name NETNSNAME or the file NETNSFILE.
- VLAN Type Support
-
For a link of type VLAN the following additional arguments are supported:
ip link add
linkDEVICEnameNAME type vlan [protocolVLAN_PROTO ]idVLANID [reorder_hdr{on|off} ] [gvrp{on|off} ] [mvrp{on|off} ] [loose_binding{on|off} ] [bridge_binding{on|off} ] [ingress-qos-mapQOS-MAP ] [egress-qos-mapQOS-MAP ]protocolVLAN_PROTO - either 802.1Q or 802.1ad.idVLANID - specifies the VLAN Identifier to use. Note that numbers with a leading " 0 " or " 0x " are interpreted as octal or hexadecimal, respectively.reorder_hdr{on|off} - specifies whether ethernet headers are reordered or not (default ison).If
reorder_hdrisonthen VLAN header will be not inserted immediately but only before passing to the physical device (if this device does not support VLAN offloading), the similar on the RX direction - by default the packet will be untagged before being received by VLAN device. Reordering allows one to accelerate tagging on egress and to hide VLAN header on ingress so the packet looks like regular Ethernet packet, at the same time it might be confusing for packet capture as the VLAN header does not exist within the packet.VLAN offloading can be checked by ethtool(8):
ethtool -k <phy_dev> | grep tx-vlan-offload
where <phy_dev> is the physical device to which VLAN device is bound.
gvrp{on|off} - specifies whether this VLAN should be registered using GARP VLAN Registration Protocol.mvrp{on|off} - specifies whether this VLAN should be registered using Multiple VLAN Registration Protocol.loose_binding{on|off} - specifies whether the VLAN device state is bound to the physical device state.bridge_binding{on|off} - specifies whether the VLAN device link state tracks the state of bridge ports that are members of the VLAN.ingress-qos-mapQOS-MAP - defines a mapping of VLAN header prio field to the Linux internal packet priority on incoming frames. The format is FROM:TO with multiple mappings separated by spaces.egress-qos-mapQOS-MAP - defines a mapping of Linux internal packet priority to VLAN header prio field but for outgoing frames. The format is the same as for ingress-qos-map.Linux packet priority can be set by iptables(8):
iptables-t mangle -A POSTROUTING [...] -j CLASSIFY --set-class 0:4and this "4" priority can be used in the egress qos mapping to set VLAN prio "5":
iplink set veth0.10 type vlan egress 4:5
- VXLAN Type Support
-
For a link of type VXLAN the following additional arguments are supported:
ip link add DEVICE
typevxlanidVNI [devPHYS_DEV ] [ {group|remote} IPADDR ] [local{ IPADDR | any } ] [ttlTTL ] [tosTOS ] [dfDF ] [flowlabelFLOWLABEL ] [dstportPORT ] [srcportMIN MAX ] [reserved_bitsVALUE ] [ [no]learning] [ [no]proxy] [ [no]rsc] [ [no]l2miss] [ [no]l3miss] [ [no]udpcsum] [ [no]udp6zerocsumtx] [ [no]udp6zerocsumrx] [ [no]localbypass] [ageingSECONDS ] [maxaddressNUMBER ] [ [no]external] [gbp] [gpe] [ [no]vnifilter] [ [no]mcroute]idVNI - specifies the VXLAN Network Identifier (or VXLAN Segment Identifier) to use.devPHYS_DEV - specifies the physical device to use for tunnel endpoint communication.groupIPADDR - specifies the multicast IP address to join. This parameter cannot be specified with theremoteparameter.remoteIPADDR - specifies the unicast destination IP address to use in outgoing packets when the destination link layer address is not known in the VXLAN device forwarding database. This parameter cannot be specified with thegroupparameter.localIPADDR - specifies the source IP address to use in outgoing packets.ttlTTL - specifies the TTL value to use in outgoing packets.tosTOS - specifies the TOS value to use in outgoing packets.dfDF - specifies the usage of the Don't Fragment flag (DF) bit in outgoing packets with IPv4 headers. The valueinheritcauses the bit to be copied from the original IP header. The valuesunsetandsetcause the bit to be always unset or always set, respectively. By default, the bit is not set.flowlabelFLOWLABEL - specifies the flow label to use in outgoing packets.dstportPORT - specifies the UDP destination port to communicate to the remote
VXLAN tunnel endpoint.srcportMIN MAX - specifies the range of port numbers to use as UDP source ports to communicate to the remote VXLAN tunnel endpoint.reserved_bitsVALUE - by default the kernel rejects packets that have bits set outside of the fields required by the features enabled on the VXLAN netdevice.reserved_bitsis a 64-bit quantity specifying which bits it should be possible to set in a VXLAN header. Each bit set in the value is a tolerated bit set in a packet.[
no]learning- specifies if unknown source link layer addresses and IP addresses are entered into the VXLAN device forwarding database.[
no]rsc- specifies if route short circuit is turned on.[
no]proxy- specifies ARP proxy is turned on.[
no]l2miss- specifies if netlink LLADDR miss notifications are generated.[
no]l3miss- specifies if netlink IP ADDR miss notifications are generated.[
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.[
no]localbypass- if FDB destination is local, with nolocalbypass set, forward encapsulated packets to the userspace network stack. If there is a userspace process listening for these packets, it will have a chance to process them. If localbypass is active (default), bypass the kernel network stack and inject the packets into the target VXLAN device, assuming one exists.ageingSECONDS - specifies the lifetime in seconds of FDB entries learnt by the kernel.maxaddressNUMBER - specifies the maximum number of FDB entries.[
no]external- specifies whether an external control plane (e.g. ip route encap) or the internal FDB should be used.[
no]vnifilter- specifies whether the vxlan device is capable of vni filtering. Only works with a vxlan device with external flag set. once enabled, bridge vni command is used to manage the vni filtering table on the device. The device can only receive packets with vni's configured in the vni filtering table.[
no]mcroute- when the VXLAN tunnel has a multicast remote, whether the underlay packets should be sent directly to the physical device (the default), or whether they should be multicast-routed. In the latter case, for purposes of matching a multicast route, (S,G) are, respectively, local and remote address of the tunnel, and iif is the tunnel physical device.gbp- enables the Group Policy extension (VXLAN-GBP).Allows one to transport group policy context across VXLAN network peers. If enabled, includes the mark of a packet in the VXLAN header for outgoing packets and fills the packet mark based on the information found in the VXLAN header for incoming packets.
Format of upper 16 bits of packet mark (flags);
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|-|-|-|-|-|-|-|-|-|D|-|-|A|-|-|-|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+D := Don't Learn bit. When set, this bit indicates that the egress VTEP MUST NOT learn the source address of the encapsulated frame.
A := Indicates that 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 lower 16 bits of packet mark (policy ID):
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Group Policy ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Example:
iptables -A OUTPUT [...] -j MARK --set-mark 0x800FFgpe- enables the Generic Protocol extension (VXLAN-GPE). Currently, this is only supported together with theexternalkeyword.
- VETH, VXCAN Type Support
-
For a link of types VETH/VXCAN the following additional arguments are supported:
ip link add DEVICE
type{veth|vxcan} [peername NAME ]peername NAME - specifies the virtual pair device name of the VETH/VXCAN tunnel.
- netkit Type Support
-
For a link of type netkit the following additional arguments are supported:
ip link add DEVICE
typenetkit [modeMODE ] [scrubSCRUB ] [ POLICY ] [peer[scrubSCRUB ] [ POLICY ] [ NAME ] ]modeMODE - specifies the operation mode of the netkit device with "l3" and "l2" as possible values. Default option is "l3".scrubSCRUB - specifies the scrub behavior of the netkit device with "default" and "none" as possible values. 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". Specifying scrub before the peer option refers to the primary device, after the peer option refers to the peer device.POLICY - specifies the default device policy when no BPF programs are attached with "forward" and "blackhole" as possible values. Default option is "forward". Specifying policy before the peer option refers to the primary device, after the peer option refers to the peer device.
NAME - specifies the device name of the peer device.
- IPIP, SIT Type Support
-
For a link of type IPIPorSIT the following additional arguments are supported:
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]remoteADDR - specifies the remote address of the tunnel.localADDR - specifies the fixed local address for tunneled packets. It must be an address on another interface on this host.encap{fou|gue|none} - specifies type of secondary UDP encapsulation. "fou" indicates Foo-Over-UDP, "gue" indicates Generic UDP Encapsulation.encap-sport{ PORT |auto} - specifies the source port in UDP encapsulation. PORT indicates the port by number, "auto" indicates that the port number should be chosen automatically (the kernel picks a flow based on the flow hash of the encapsulated packet).[
no]encap-csum- specifies if UDP checksums are enabled in the secondary encapsulation.[
no]encap-remcsum- specifies if Remote Checksum Offload is enabled. This is only applicable for Generic UDP Encapsulation.mode{ ip6ip | ipip | mplsip | any } - specifies mode in which device should run. "ip6ip" indicates IPv6-Over-IPv4, "ipip" indicates "IPv4-Over-IPv4", "mplsip" indicates MPLS-Over-IPv4, "any" indicates IPv6, IPv4 or MPLS Over IPv4. Supported for SIT where the default is "ip6ip" and IPIP where the default is "ipip". IPv6-Over-IPv4 is not supported for IPIP.external- make this tunnel externally controlled (e.g. ip route encap).
- GRE Type Support
-
For a link of type GRE or GRETAP the following additional arguments are supported:
ip link add DEVICE
type{gre|gretap} remote ADDR local ADDR [ [no][i|o]seq] [ [i|o]keyKEY |no[i|o]key] [ [no][i|o]csum] [ttlTTL ] [tosTOS ] [ [no]pmtudisc] [ [no]ignore-df] [devPHYS_DEV ] [encap{fou|gue|none} ] [encap-sport{ PORT |auto} ] [ encap-dport PORT ] [ [no]encap-csum] [ [no]encap-remcsum] [external]remoteADDR - specifies the remote address of the tunnel.localADDR - specifies the fixed local address for tunneled packets. It must be an address on another interface on this host.[
no][i|o]seq- serialize packets. Theoseqflag enables sequencing of outgoing packets. Theiseqflag requires that all input packets are serialized.[
i|o]keyKEY |no[i|o]key- use keyed GRE with key KEY. KEY is either a number or an IPv4 address-like dotted quad. Thekeyparameter specifies the same key to use in both directions. Theikeyandokeyparameters specify different keys for input and output.[
no][i|o]csum- generate/require checksums for tunneled packets. Theocsumflag calculates checksums for outgoing packets. Theicsumflag requires that all input packets have the correct checksum. Thecsumflag is equivalent to the combination icsum ocsum .ttlTTL - specifies the TTL value to use in outgoing packets.tosTOS - specifies the TOS value to use in outgoing packets.[
no]pmtudisc- enables/disables Path MTU Discovery on this tunnel. It is enabled by default. Note 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 will be fragmented; the presence of the DF flag inhibits this, resulting instead in an ICMP Unreachable (Fragmentation Required) message. Enabling this attribute causes the DF flag to be ignored.devPHYS_DEV - specifies the physical device to use for tunnel endpoint communication.encap{fou|gue|none} - specifies type of secondary UDP encapsulation. "fou" indicates Foo-Over-UDP, "gue" indicates Generic UDP Encapsulation.encap-sport{ PORT |auto} - specifies the source port in UDP encapsulation. PORT indicates the port by number, "auto" indicates that the port number should be chosen automatically (the kernel picks a flow based on the flow hash of the encapsulated packet).[
no]encap-csum- specifies if UDP checksums are enabled in the secondary encapsulation.[
no]encap-remcsum- specifies if Remote Checksum Offload is enabled. This is 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 the following additional arguments are supported:
ip link add DEVICE
type{ip6gre|ip6gretap}remoteADDRlocalADDR [ [no][i|o]seq] [ [i|o]keyKEY |no[i|o]key] [ [no][i|o]csum] [hoplimitTTL ] [encaplimitELIM ] [tclassTCLASS ] [flowlabelFLOWLABEL ] [ dscp inherit ] [[no]allow-localremote] [devPHYS_DEV ] [ external ]remoteADDR - specifies the remote IPv6 address of the tunnel.localADDR - specifies the fixed local IPv6 address for tunneled packets. It must be an address on another interface on this host.[
no][i|o]seq- serialize packets. Theoseqflag enables sequencing of outgoing packets. Theiseqflag requires that all input packets are serialized.[
i|o]keyKEY |no[i|o]key- use keyed GRE with key KEY. KEY is either a number or an IPv4 address-like dotted quad. Thekeyparameter specifies the same key to use in both directions. Theikeyandokeyparameters specify different keys for input and output.[
no][i|o]csum- generate/require checksums for tunneled packets. Theocsumflag calculates checksums for outgoing packets. Theicsumflag requires that all input packets have the correct checksum. Thecsumflag is equivalent to the combination icsum ocsum.hoplimitTTL - specifies Hop Limit value to use in outgoing packets.encaplimitELIM - specifies a fixed encapsulation limit. Default is 4.flowlabelFLOWLABEL - specifies a fixed flowlabel.[no]allow-localremote- specifies whether to allow remote endpoint to have an address configured on local host.tclassTCLASS - specifies the traffic class field on tunneled packets, which can be specified as either a two-digit hex value (e.g. c0) or a predefined string (e.g. internet). The valueinheritcauses the field to be copied from the original IP header. The valuesinherit/STRING orinherit/00..ff will 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. This flag is mutually exclusive with the
remote,local,seq,key,csum,hoplimit,encaplimit,flowlabelandtclassoptions.
- IPoIB Type Support
-
For a link of type IPoIB the following additional arguments are supported:
ip link add DEVICE name NAME type ipoib [ pkey PKEY ] [
modeMODE ]pkeyPKEY - specifies the IB P-Key to use.modeMODE - specifies the mode (datagram or connected) to use.
- OVPN Type Support
-
For a link of type OVPN the following additional arguments are 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. Thempmode creates a multi-peer device.
- ERSPAN Type Support
-
For a link of type ERSPAN/IP6ERSPAN the following additional arguments are supported:
ip link add DEVICE
type{erspan|ip6erspan}remoteADDRlocalADDRseqkey KEYerspan_verversion [erspanIDX ] [erspan_dir{ingress|egress} ] [erspan_hwidhwid ] [[no]allow-localremote] [ external ]remoteADDR - specifies the remote address of the tunnel.localADDR - specifies the fixed local address for tunneled packets. It must be an address on another interface on this host.erspan_verversion - specifies the ERSPAN version number. version indicates the ERSPAN version to be created: 0 for version 0 type I, 1 for version 1 (type II) or 2 for version 2 (type III).erspanIDX - specifies the ERSPAN v1 index field. IDX indicates a 20 bit index/port number associated with the ERSPAN traffic's source port and direction.erspan_dir{ingress|egress} - specifies the ERSPAN v2 mirrored traffic's direction.erspan_hwidhwid - an unique identifier of an ERSPAN v2 engine within a system. hwid is a 6-bit value for users to configure.[no]allow-localremote- specifies whether to allow remote endpoint to have an address configured on local host.external- make this tunnel externally controlled (or not, which is the default). In the kernel, this is referred to as collect metadata mode. This flag is mutually exclusive with theremote,local,erspan_ver,erspan,erspan_diranderspan_hwidoptions.
- GENEVE Type Support
-
For a link of type GENEVE the following additional arguments are supported:
ip link add DEVICE
typegeneveidVNIremoteIPADDR [localIPADDR ] [ttlTTL ] [tosTOS ] [dfDF ] [flowlabelFLOWLABEL ] [dstportPORT ] [ [no]external] [ [no]udpcsum] [ [no]udp6zerocsumtx] [ [no]udp6zerocsumrx] [innerprotoinherit]idVNI - specifies the Virtual Network Identifier to use.remoteIPADDR - specifies the unicast destination IP address to use in outgoing packets.localIPADDR - specifies the source IP address to listen on.ttlTTL - 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".tosTOS - specifies the TOS value to use in outgoing packets.dfDF - specifies the usage of the Don't Fragment flag (DF) bit in outgoing packets with IPv4 headers. The valueinheritcauses the bit to be copied from the original IP header. The valuesunsetandsetcause the bit to be always unset or always set, respectively. By default, the bit is not set.flowlabelFLOWLABEL - specifies the flow label to use in outgoing packets.dstportPORT - select a destination port other than the default of 6081.[
no]external- make this tunnel externally controlled (or not, which is the default). This flag is mutually exclusive with theid,remote,ttl,tosandflowlabeloptions.[
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
typebareudpdstportPORTethertypePROTO [srcportminPORT ] [ [no]multiproto]dstportPORT - specifies the destination port for the UDP tunnel.ethertypePROTO - specifies the ethertype of the L3 protocol being tunnelled.ethertypecan be given as plain Ethernet protocol number or using the protocol name ("ipv4", "ipv6", "mpls_uc", etc.).srcportminPORT - selects the lowest value of the UDP tunnel source port range.[
no]multiproto- activates support for protocols similar to the one specified byethertype. Whenethertypeis "mpls_uc" (that is, unicast MPLS), this allows the tunnel to also handle multicast MPLS. Whenethertypeis "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
typeAMTdiscoveryIPADDRmode{gateway|relay}localIPADDRdevPHYS_DEV [relay_portPORT ] [gateway_portPORT ] [max_tunnelsNUMBER ]discoveryIPADDR - specifies the unicast discovery IP address to use to find remote IP address.mode{gateway|relay} - specifies the role of AMT, Gateway or RelaylocalIPADDR - specifies the source IP address to use in outgoing packets.devPHYS_DEV - specifies the underlying physical interface from which transform traffic is sent and received.relay_portPORT - specifies the UDP Relay port to communicate to the Relay.gateway_portPORT - specifies the UDP Gateway port to communicate to the Gateway.max_tunnelsNUMBER - 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 } ] [bclimLIMIT ]type{macvlan|macvtap} - specifies the link type to use.macvlancreates just a virtual interface, whilemacvtapin addition creates a character device/dev/tapXto be used just like atuntapdevice.mode private - Do not allow communication between
macvlaninstances on the same physical interface, even if the external switch supports hairpin mode.mode vepa - Virtual Ethernet Port Aggregator mode. Data from one
macvlaninstance 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.
modepassthru[nopromisc] - This mode gives more power to a single endpoint, usually inmacvtapmode. 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 thenopromiscflag prevents this, so the promisc flag may be controlled using standard tools.modesource[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 thenodstflag 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 arequest, 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.bclimLIMIT - 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
slave1SLAVE1-IFslave2SLAVE2-IF [ interlink INTERLINK-IF ] [ supervision ADDR-BYTE ] [version{0|1} [proto{0|1} ]typehsr - specifies the link type to use, here HSR.slave1SLAVE1-IF - Specifies the physical device used for the first of the two ring ports.slave2SLAVE2-IF - Specifies the physical device used for the second of the two ring ports.interlinkINTERLINK-IF - The interlink device bound to the HSR network to connect SAN device(s).supervisionADDR-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:
ip link add DEVICE type bridge [
ageing_timeAGEING_TIME ] [group_fwd_maskMASK ] [group_addressADDRESS ] [forward_delayFORWARD_DELAY ] [hello_timeHELLO_TIME ] [max_ageMAX_AGE ] [stp_stateSTP_STATE ] [stp_modeSTP_MODE ] [mst_enabledMST_ENABLED ] [priorityPRIORITY ] [no_linklocal_learnNO_LINKLOCAL_LEARN ] [fdb_local_vlan_0FDB_LOCAL_VLAN_0 ] [fdb_max_learnedFDB_MAX_LEARNED ] [vlan_filteringVLAN_FILTERING ] [vlan_protocolVLAN_PROTOCOL ] [vlan_default_pvidVLAN_DEFAULT_PVID ] [vlan_stats_enabledVLAN_STATS_ENABLED ] [vlan_stats_per_portVLAN_STATS_PER_PORT ] [mcast_snoopingMULTICAST_SNOOPING ] [mcast_vlan_snoopingMULTICAST_VLAN_SNOOPING ] [mcast_routerMULTICAST_ROUTER ] [mcast_query_use_ifaddrMCAST_QUERY_USE_IFADDR ] [mcast_querierMULTICAST_QUERIER ] [mcast_hash_elasticityHASH_ELASTICITY ] [mcast_hash_maxHASH_MAX ] [mcast_last_member_countLAST_MEMBER_COUNT ] [mcast_startup_query_countSTARTUP_QUERY_COUNT ] [mcast_last_member_intervalLAST_MEMBER_INTERVAL ] [mcast_membership_intervalMEMBERSHIP_INTERVAL ] [mcast_querier_intervalQUERIER_INTERVAL ] [mcast_query_intervalQUERY_INTERVAL ] [mcast_query_response_intervalQUERY_RESPONSE_INTERVAL ] [mcast_startup_query_intervalSTARTUP_QUERY_INTERVAL ] [mcast_stats_enabledMCAST_STATS_ENABLED ] [mcast_igmp_versionIGMP_VERSION ] [mcast_mld_versionMLD_VERSION ] [nf_call_iptablesNF_CALL_IPTABLES ] [nf_call_ip6tablesNF_CALL_IP6TABLES ] [nf_call_arptablesNF_CALL_ARPTABLES ] [mdb_offload_fail_notificationMDB_OFFLOAD_FAIL_NOTIFICATION ]ageing_timeAGEING_TIME - configure the bridge's FDB entries ageing time, ie the number of seconds a MAC address will be kept in the FDB after a packet has been received from that address. after this time has passed, entries are cleaned up.group_fwd_maskMASK - set 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).group_addressADDRESS - set the MAC address of the multicast group this bridge uses for STP. The address must be a link-local address in standard Ethernet MAC address format, ie an address of the form 01:80:C2:00:00:0X, with X
in [0, 4..f].forward_delayFORWARD_DELAY - set the forwarding delay in seconds, ie the time spent in LISTENING state (before moving to LEARNING) and in LEARNING state (before moving to FORWARDING). Only relevant if STP is enabled. Valid values are between 2 and 30.hello_timeHELLO_TIME - set the time in seconds between hello packets sent by the bridge, when it is a root bridge or a designated bridges. Only relevant if STP is enabled. Valid values are between 1 and 10.max_ageMAX_AGE - set the hello packet timeout, ie the time in seconds until another bridge in the spanning tree is assumed to be dead, after reception of its last hello message. Only relevant if STP is enabled. Valid values are between 6 and 40.stp_stateSTP_STATE - turn spanning tree protocol on (STP_STATE > 0) or off (STP_STATE == 0). for this bridge.stp_modeSTP_MODE - set the STP mode for this bridge. This controls how the bridge selects between userspace and kernel STP when STP is enabled viastp_state. STP_MODE can be one of:auto(default) - invoke the/sbin/bridge-stphelper to hand the bridge to a userspace STP daemon. Only attempted in the initial network namespace; in other namespaces this falls back to kernel STP.user- directly enable 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 enable kernel STP without invoking the helper.Can only be changed while STP is disabled. Both
stp_modeandstp_statecan be set in a single command.mst_enabledMST_ENABLED - turn 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.priorityPRIORITY - set this bridge's spanning tree priority, used during STP root bridge election. PRIORITY is a 16bit unsigned integer.no_linklocal_learnNO_LINKLOCAL_LEARN - turn 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_0FDB_LOCAL_VLAN_0 When disabled, local FDB entries (i.e. those for member port addresses and 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_learnedFDB_MAX_LEARNED - set the maximum number of learned FDB entries. If (FDB_MAX_LEARNED == 0) the feature is disabled. Default is0. FDB_MAX_LEARNED is a 32bit unsigned integer.vlan_filteringVLAN_FILTERING - turn 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} - set the protocol used for VLAN filtering.vlan_default_pvidVLAN_DEFAULT_PVID - set the default PVID (native/untagged VLAN ID) for this bridge.vlan_stats_enabledVLAN_STATS_ENABLED - enable (VLAN_STATS_ENABLED == 1) or disable (VLAN_STATS_ENABLED == 0) per-VLAN stats accounting.vlan_stats_per_portVLAN_STATS_PER_PORT - enable (VLAN_STATS_PER_PORT == 1) or disable (VLAN_STATS_PER_PORT == 0) per-VLAN per-port stats accounting. Can be changed only when there are no port VLANs configured.mcast_snoopingMULTICAST_SNOOPING - turn multicast snooping on (MULTICAST_SNOOPING > 0) or off (MULTICAST_SNOOPING == 0).mcast_vlan_snoopingMULTICAST_VLAN_SNOOPING - turn multicast VLAN snooping on (MULTICAST_VLAN_SNOOPING > 0) or off (MULTICAST_VLAN_SNOOPING == 0).mcast_routerMULTICAST_ROUTER - set bridge's multicast router if IGMP snooping is enabled. MULTICAST_ROUTER is an integer value having the following meaning:0- disabled.1- automatic (queried).2- permanently enabled.mcast_query_use_ifaddrMCAST_QUERY_USE_IFADDR - whether to use the bridge's own IP address as source address for IGMP queries (MCAST_QUERY_USE_IFADDR > 0) or the default of 0.0.0.0 (MCAST_QUERY_USE_IFADDR == 0).mcast_querierMULTICAST_QUERIER - enable (MULTICAST_QUERIER > 0) or disable (MULTICAST_QUERIER == 0) IGMP querier, ie sending of multicast queries by the bridge (default: disabled).mcast_querier_intervalQUERIER_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 ifmcast_querierwas enabled).mcast_hash_elasticityHASH_ELASTICITY - set multicast database hash elasticity, ie the maximum chain length in the multicast hash table (defaults to 4).mcast_hash_maxHASH_MAX - set maximum size of multicast hash table (defaults to 512, value must be a power of 2).mcast_last_member_countLAST_MEMBER_COUNT - set multicast last member count, ie 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_intervalLAST_MEMBER_INTERVAL - interval between queries to find remaining members of a group, after a "leave" message is received.mcast_startup_query_countSTARTUP_QUERY_COUNT - set the number of IGMP queries to send during startup phase (defaults to 2).mcast_startup_query_intervalSTARTUP_QUERY_INTERVAL - interval between queries in the startup phase.mcast_query_intervalQUERY_INTERVAL - interval between queries sent by the bridge after the end of the startup phase.mcast_query_response_intervalQUERY_RESPONSE_INTERVAL - set the Max Response Time/Maximum Response Delay for IGMP/MLD queries sent by the bridge.mcast_membership_intervalMEMBERSHIP_INTERVAL - delay after which the bridge will leave a group, if no membership reports for this group are received.mcast_stats_enabledMCAST_STATS_ENABLED - enable (MCAST_STATS_ENABLED > 0) or disable (MCAST_STATS_ENABLED == 0) multicast (IGMP/MLD) stats accounting.mcast_igmp_versionIGMP_VERSION - set the IGMP version.mcast_mld_versionMLD_VERSION - set the MLD version.nf_call_iptablesNF_CALL_IPTABLES - enable (NF_CALL_IPTABLES > 0) or disable (NF_CALL_IPTABLES == 0) iptables hooks on the bridge.nf_call_ip6tablesNF_CALL_IP6TABLES - enable (NF_CALL_IP6TABLES > 0) or disable (NF_CALL_IP6TABLES == 0) ip6tables hooks on the bridge.nf_call_arptablesNF_CALL_ARPTABLES - enable (NF_CALL_ARPTABLES > 0) or disable (NF_CALL_ARPTABLES == 0) arptables hooks on the bridge.mdb_offload_fail_notificationMDB_OFFLOAD_FAIL_NOTIFICATION - turn mdb offload fail notification on (MDB_OFFLOAD_FAIL_NOTIFICATION > 0) or off (MDB_OFFLOAD_FAIL_NOTIFICATION == 0). Default is0.
- MACsec Type Support
-
For a link of type MACsec the following additional arguments are supported:
ip link add link DEVICE name NAME type macsec [ [
address<lladdr> ]portPORT |sciSCI ] [cipherCIPHER_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 secure channel for this MACsec device.portPORT - sets the port number component of secure channel for this MACsec device, in a range from 1 to 65535 inclusive. Numbers with a leading " 0 " or " 0x " are interpreted as octal and hexadecimal, respectively.sciSCI - sets the secure channel identifier for this MACsec device. SCI is a 64bit wide number in hexadecimal format.cipherCIPHER_SUITE - defines the cipher suite to use.icvlenLENGTH - 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 is 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.
windowSIZE - sets the size of the replay window.validate strict or validate check or validate disabled - sets the validation mode on the device.
encodingsaAN - 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
tabletable id associated with 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_idMUXID - 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 ]
devPHYS_DEV - specifies the underlying physical interface from which transform traffic is sent and received.if_idIF-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 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 thedevandif_idoptions.
- 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
roleROLE - specifies the role of the GTP device, either sgsn or ggsnhsizeHSIZE - specifies size of the hashtable which stores PDP contextsrestart_countRESTART_COUNT - GTP instance restart counter
- PFCP Type Support
-
For a link of type PFCP no additional arguments are supported
ip link delete - delete virtual link
devDEVICE-
specifies the virtual device to act operate on.
groupGROUP-
specifies the group of virtual links to delete. Group 0 is not allowed to be deleted since it is the default group.
typeTYPE-
specifies the type of the device.
ip link set - change device attributes
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.
devDEVICE-
DEVICE specifies network device to operate on. When configuring SR-IOV Virtual Function (VF) devices, this keyword should specify the associated Physical Function (PF) device.
groupGROUP-
GROUP has a dual role: If both group and dev are present, then move the device to the specified group. If only a group is specified, then the command operates on all devices in that group.
upanddown-
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, instructs 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, activates promiscuous operation of the network device.
- trailers on or trailers off
-
change the NOTRAILERS flag on the device, NOT used by the Linux and exists for BSD compatibility.
- 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).
nameNAME-
change the name of the device. This operation is not recommended if the device is running or has some addresses already configured.
txqueuelenNUMBER
txqlenNUMBER-
change the transmit queue length of the device.
mtuNUMBER-
change the MTU of the device.
addressLLADDRESS-
change the station address of the interface.
broadcastLLADDRESS
brdLLADDRESS
peerLLADDRESS-
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
iptool will return "Invalid argument" error. It is possible to find out if device is local to a single network namespace by checkingnetns-localflag in the output of theethtool:ethtool -k DEVICE
To change network namespace for wireless devices the
iwtool can be used. But it allows one to change network namespace only for physical devices and by process PID.
aliasNAME-
give the device a symbolic name for easy reference.
groupGROUP-
specify the group the device belongs to. The available groups are listed in
/usr/share/iproute2/groupor/etc/iproute2/group(has precedence if exists).
vfNUM-
specify a Virtual Function device to be configured. The associated PF device must be specified using the
devparameter.macLLADDRESS - change the station address for the specified VF. Thevfparameter must be specified.vlanVLANID - change the assigned VLAN for the specified VF. When specified, all traffic sent from the VF will be tagged with the specified VLAN ID. Incoming traffic will be filtered for the specified VLAN ID, and will have all VLAN tags stripped before being passed to the VF. Setting this parameter to 0 disables VLAN tagging and filtering. Thevfparameter must be specified.qosVLAN-QOS - assign VLAN QOS (priority) bits for the VLAN tag. When specified, all VLAN tags transmitted by the VF will include the specified priority bits in the VLAN tag. If not specified, the value is assumed to be 0. Both thevfandvlanparameters must be specified. Setting bothvlanandqosas 0 disables VLAN tagging and filtering for the VF.protoVLAN-PROTO - assign VLAN PROTOCOL for the VLAN tag, either 802.1Q or 802.1ad. Setting to 802.1ad, all traffic sent from the VF will be tagged with VLAN S-Tag. Incoming traffic will have VLAN S-Tags stripped before being passed to the VF. Setting to 802.1ad also enables an option to concatenate another VLAN tag, so both S-TAG and C-TAG will be inserted/stripped for outgoing/incoming traffic, respectively. If not specified, the value is assumed to be 802.1Q. Both thevfandvlanparameters must be specified.rateTXRATE -- change the allowed transmit bandwidth, in Mbps, for the specified VF. Setting this parameter to 0 disables rate limiting.vfparameter must be specified. Please use new APImax_tx_rateoption instead.max_tx_rateTXRATE - change the allowed maximum transmit bandwidth, in Mbps, for the specified VF. Setting this parameter to 0 disables rate limiting.vfparameter must be specified.min_tx_rateTXRATE - change the allowed minimum transmit bandwidth, in Mbps, for the specified VF. Minimum TXRATE should be always <= Maximum TXRATE. Setting this parameter to 0 disables rate limiting.vfparameter must be specified.spoofchkon|off - turn packet spoof checking on or off for the specified VF.query_rsson|off - toggle the ability of querying the RSS configuration of a specific VF. VF RSS information like RSS hash key may be considered sensitive on some devices where this information is shared between VF and PF and thus its querying may be prohibited by default.stateauto|enable|disable - set the virtual link state as seen by the specified VF. Setting to auto means a reflection of the PF link state, enable lets the VF to communicate with other VFs on this host even if the PF link state is down, disable causes the HW to drop any packets sent by the VF.truston|off - trust the specified VF user. This enables that VF user can set a specific feature which may impact security and/or performance. (e.g. VF multicast promiscuous mode)node_guideui64 - configure node GUID for Infiniband VFs.port_guideui64 - configure port GUID for Infiniband VFs.
- xdp object | pinned | off
-
set (or unset) a XDP ("eXpress Data Path") BPF program to run on every packet at driver level. ip link output will indicate a
xdpflag for the networking device. If the driver does not have native XDP support, the kernel will fall back to a slower, driver-independent "generic" XDP variant. The ip link output will in that case indicatexdpgenericinstead ofxdponly. If the driver does have native XDP support, but the program is loaded under xdpgeneric object | pinned then the kernel will use the generic XDP variant instead of the native one.xdpdrvhas the opposite effect of requesting that the automatic fallback to the generic XDP variant be disabled and in case driver is not XDP-capable error should be returned.xdpdrvalso disables hardware offloads.xdpoffloadin ip link output indicates that the program has been offloaded to hardware and can also be used to request the "offload" mode, much likexdpgenericit forces program to be installed specifically in HW/FW of the adapter.off(ornone) - Detaches any currently attached XDP/BPF program from the given device.objectFILE - Attaches a XDP/BPF program to the given device. The 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 toipthen any prior attached XDP/BPF program will be atomically overridden and no error will be thrown in this case. If nosectionoption is passed, then the default section name ("prog") will be assumed, otherwise the provided section name will be used. If noverboseoption is passed, then a verifier log will only be dumped on load error. See also EXAMPLES section for usage examples.sectionNAME - 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 theobjectoption.programNAME - 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 withlibbpfsupport.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.pinnedFILE - Attaches a XDP/BPF program to the given device. The FILE points to an already pinned BPF program in the BPF file system. The optionsectiondoesn't apply here, but otherwise semantics are the same as with the optionobjectdescribed already.
masterDEVICE-
set master device of the device (enslave device).
nomaster-
unset master device of the device (release device).
addrgenmodeeui64|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_secretrandom - 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.tagTAG - set the interface tag.medium_idID - set the interface medium ID.igmpv2_unsolicited_report_intervalINTERVAL
igmpv3_unsolicited_report_intervalINTERVAL - set the IGMP unsolicited report interval in milliseconds.
- link-netnsid
-
set peer netnsid for a cross-netns interface
typeETYPE 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
bridgethe following additional arguments are supported:ip link set type bridge_slave [
fdb_flush] [stateSTATE ] [priorityPRIO ] [costCOST ] [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_routerMULTICAST_ROUTER ] [mcast_fast_leave{on|off} ] [bcast_flood{on|off} ] [mcast_flood{on|off} ] [mcast_to_unicast{on|off} ] [group_fwd_maskMASK ] [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_portDEVICE ] [nobackup_port] [backup_nhidNHID ]fdb_flush- flush bridge slave's fdb dynamic entries.stateSTATE - Set port state. STATE is a number representing the following states:0(disabled),1(listening),2(learning),3(forwarding),4(blocking).priorityPRIO - set port priority (allowed values are between 0 and 63, inclusively).costCOST - set port cost (allowed values are between 1 and 65535, inclusively).guard{on|off} - block incoming BPDU packets on this port.hairpin{on|off} - enable hairpin mode on this port. This will allow incoming packets on this port to be reflected back.fastleave{on|off} - enable multicast fast leave on this port.root_block{on|off} - block this port from becoming the bridge's root port.learning{on|off} - allow MAC address learning on this port.flood{on|off} - open the flood gates on this port, i.e. forward all unicast frames to this port also. Requiresproxy_arpandproxy_arp_wifito be turned off.proxy_arp{on|off} - enable proxy ARP on this port.proxy_arp_wifi{on|off} - enable proxy ARP on this port which meets extended requirements by IEEE 802.11 and Hotspot 2.0 specifications.mcast_routerMULTICAST_ROUTER - configure this port for having multicast routers attached. A port with a multicast router will receive all multicast traffic. MULTICAST_ROUTER may be either0to disable multicast routers on this port,1to let the system detect the presence of routers (this is the default),2to permanently enable multicast traffic forwarding on this port or3to enable multicast routers temporarily on this port, not depending on incoming queries.mcast_fast_leave{on|off} - this is a synonym to thefastleaveoption above.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_maskMASK - set 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).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 optionneigh_suppresshas no effect and the per-VLAN state is set using the bridge vlan optionneigh_suppress. By default this flag is off.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, theno_linklocal_learnbridge 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.backup_portDEVICE - if the port loses carrier all traffic will be redirected to the configured backup portnobackup_port- removes the currently configured backup portbackup_nhidNHID - 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 thevlan_tunneloption). Setting a value of 0 (default) has the effect of not attaching any ID.
- Bonding Slave Support
-
For a link with master
bondthe following additional arguments are supported:ip link set type bond_slave [
queue_idID ] [prioPRIORITY ]queue_idID - set the slave's queue ID (a 16bit unsigned value).prioPRIORITY - 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_prioPRIORITY - 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 } [
macaddrCOMMAND MACADDR ... ]Commands:
add- add MACADDR to allowed listset- replace allowed listdel- remove MACADDR from allowed listflush- flush whole allowed listUpdate the broadcast/multicast queue length.
ip link set type { macvlan | macvap } [
bcqueuelenLENGTH ] [bclimLIMIT ]bcqueuelenLENGTH - 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 arequest, 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.bclimLIMIT - 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 [
conduitDEVICE ]conduitDEVICE - 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.
masterDEVICE - this is a synonym for "conduit".
ip link show - display device attributes
devNAME(default)-
NAME specifies the network device to show.
groupGROUP-
GROUP specifies what group of devices to show.
up-
only display running interfaces.
down-
only display not running interfaces.
masterDEVICE-
DEVICE specifies the master device which enslaves devices to show.
vrfNAME-
NAME specifies the VRF which enslaves devices to show.
typeTYPE-
TYPE specifies the type of devices to show.
Note that the type name is not checked against the list of supported types - instead it is sent as-is to the kernel. Later it is used to filter the returned interface list by comparing it with the relevant attribute in case the kernel didn't filter already. Therefore any string is accepted, but may lead to empty output.
nomaster-
only show devices with no master
novf-
only show devices with no VF info
ip link xstats - display extended statistics
typeTYPE-
TYPE specifies the type of devices to display extended statistics for.
ip link afstats - display address-family specific statistics
devDEVICE-
DEVICE specifies the device to display address-family statistics for.
ip link help - display help
TYPE specifies which help of link type to display.
Group
may be a number or a string from /usr/share/iproute2/group or /etc/iproute2/group which can be manually filled and has precedence if exists.
Examples
ip link show
Shows the state of all network interfaces on the system.
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
ip link set dev ppp0 mtu 1400
Change the MTU the ppp0 device.
ip link add link eth0 name eth0.10 type vlan id 10
Creates a new vlan device eth0.10 on device eth0.
ip link delete dev eth0.10
Removes vlan device.
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.
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.
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.
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.
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.
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.
ip link set dev swp0 type dsa conduit eth1
Changes the conduit interface of the swp0 user port to eth1.
Releases
8 releases since Debian 7 (Wheezy); the text changed 7 times.