LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ip-link

network device configuration: bring interfaces up/down, set MAC, MTU, create virtual links

TLDR

Show all interfaces
$ ip link
copy
Show specific interface
$ ip link show eth0
copy
Show detailed statistics
$ ip -s link show eth0
copy
Bring interface up/down
$ sudo ip link set eth0 up
copy
Set alias name
$ sudo ip link set eth0 alias "LAN Interface"
copy
Change MAC address (interface must be down)
$ sudo ip link set dev eth0 address ff:ee:dd:cc:bb:aa
copy
Set MTU size
$ sudo ip link set eth0 mtu 9000
copy
Set promiscuous mode
$ sudo ip link set eth0 promisc on
copy
Create a VLAN sub-interface
$ sudo ip link add link eth0 name eth0.10 type vlan id 10
copy

SYNOPSIS

ip [OPTIONS] link COMMAND [arguments]

DESCRIPTION

ip link manages network devices. It can list interfaces, change their state and parameters (MAC address, MTU, alias, promiscuous mode), and create or delete virtual links such as bridges, bonds, VLANs, VXLANs, dummies, veth pairs, and tun/tap devices.It is part of the iproute2 suite that replaces the older ifconfig utility.

PARAMETERS

show [device]

Display interface information. Without device, all interfaces are shown. Combine with -s for statistics, -d for detailed driver info.
set device
Modify properties of an existing interface.
add [link DEV] name NAME type TYPE
Create a virtual interface of the given type (bridge, vlan, veth, dummy, bond, vxlan, ...).
delete device
Remove a virtual interface.
up | down
Bring the interface administratively up or down.
address LLADDR
Set the link-layer (MAC) address. Usually requires the interface to be down first.
mtu BYTES
Set the Maximum Transmission Unit.
alias NAME
Set a human-readable interface description.
promisc on | off
Enable or disable promiscuous mode.
multicast on | off
Enable or disable multicast reception.
arp on | off
Enable or disable ARP on the interface.
master DEVICE
Enslave the interface to a master (bridge or bond).
nomaster
Detach the interface from its master.
txqueuelen N
Set the transmit queue length.
netns PID | NAME
Move the interface into the given network namespace.

CAVEATS

Changing the MAC address usually requires the interface to be brought down first. Virtual interfaces created with ip link add are not persistent across reboots unless declared in distribution-specific network configuration (NetworkManager, systemd-networkd, /etc/network/interfaces, etc.). Some operations require CAP_NET_ADMIN (typically root).

HISTORY

ip link is part of iproute2, originally written by Alexey Kuznetsov and now maintained by Stephen Hemminger. It supersedes the deprecated ifconfig command from net-tools.

SEE ALSO

ip(8), ip-address(8), ip-route(8), ip-tuntap(8), ip-monitor(8), bridge(8), ethtool(8)

Copied to clipboard
Kai