LinuxCommandLibrary

ip-link

Manage network interfaces

TLDR

Show information about all network interfaces

$ ip [[l|link]]
copy

Show information about a specific network interface
$ ip [[l|link]] [[sh|show]] [ethN]
copy

Bring a network interface up or down
$ sudo ip [[l|link]] [[s|set]] [ethN] [up|down]
copy

Give a meaningful name to a network interface
$ sudo ip [[l|link]] [[s|set]] [ethN] [[al|alias]] "[LAN Interface]"
copy

Change the MAC address of a network interface
$ sudo ip [[l|link]] [[s|set]] [ethN] [[a|address]] [ff:ff:ff:ff:ff:ff]
copy

Change the MTU size for a network interface to use jumbo frames
$ sudo ip [[l|link]] [[s|set]] [ethN] mtu [9000]
copy

Set the promisc mode status of a device
$ sudo ip [[l|link]] [[s|set]] [ethN] promisc [on|off]
copy

SYNOPSIS

ip link [OPTIONS] {COMMAND | help}

PARAMETERS

show
    Displays information about network interfaces. Can be filtered by interface name or index.

set
    Modifies network interface attributes like state (up/down), MTU, MAC address, and more.

add
    Creates a new virtual network interface (e.g., a VLAN or bridge).

delete
    Deletes a network interface.

-h, --help
    Displays help information.

-V, --version
    Shows the version of the iproute2 suite.

dev
    Specifies the network interface to operate on.

name
    Sets new name to device.

address
    Sets the hardware address of the interface.

up
    Brings the interface up.

down
    Brings the interface down.

mtu
    Sets the Maximum Transmission Unit (MTU) of the interface.

qlen
    Sets the transmit queue length of the interface.

master
    Make interface slave of the specified master interface.

type
    Sets the interface type (e.g., vlan, bridge, dummy).

DESCRIPTION

The ip-link command in Linux is a powerful tool used to configure and manage network interfaces. It's part of the iproute2 suite, providing a modern replacement for older tools like ifconfig. With ip-link, you can view, create, delete, and modify network links (interfaces). This includes setting their operational state (up/down), MTU (Maximum Transmission Unit), MAC address, and managing various link types like bridges, VLANs, and virtual interfaces. The command interacts directly with the kernel's network subsystem, offering fine-grained control over network interface configuration. It's invaluable for network administrators and developers who need to customize and optimize network performance. Understanding ip-link is crucial for effective network management in Linux environments, including configuring network bonding, VLANs, and managing interfaces in containerized environments.

CAVEATS

Requires root privileges to modify network interfaces. Incorrectly configuring network interfaces can lead to network connectivity issues.
The exact syntax and options can vary slightly depending on the kernel version and iproute2 version installed.

EXAMPLES

  • Bring up an interface: ip link set eth0 up
  • Bring down an interface: ip link set eth0 down
  • Set MTU: ip link set eth0 mtu 1500
  • Show interface information: ip link show eth0
  • Create VLAN: ip link add link eth0 name eth0.10 type vlan id 10

TROUBLESHOOTING

If you encounter errors, check the interface name for typos. Also, ensure you have the necessary permissions (usually root).
Verify that the required kernel modules are loaded for certain interface types (e.g., 8021q for VLANs).

HISTORY

The ip-link command is part of the iproute2 suite, which was created as a replacement for older networking tools like net-tools (which included ifconfig and route). iproute2 and therefore ip-link, were designed to be more flexible and feature-rich, utilizing the Netlink interface in the Linux kernel. The development started in the late 1990s/early 2000s and has been actively maintained since.

It gained prominence as the preferred method for network configuration in modern Linux distributions due to its advanced capabilities and integration with modern networking technologies like VLANs, bridges, and network namespaces.

SEE ALSO

ip(8), ifconfig(8), route(8)

Copied to clipboard