Skip to content

How to manage Ethernet Connections in Linux

7 November 2022
Linux

This blog post will teach you how to manage Ethernet Connections in Linux using the Network Manager command-line tool.

Managing Ethernet Connections

  • Newtwork interfaces are named sequentially: eth0, eth1, etc.
    • Multiple addresses can be assigned to a device with aliases
    • Aliases are labeled eth0:1, eth0:2, etc.
    • Aliases are treated like separate interfaces
  • View interface configuration with /sbin/ip addr show [ethx]
  • Enable interface with /sbin/ifup ethx
  • Disable interface with /sbin/ifdown ethx

Network connection names consist of a prefix, based on the device type, and a number to distinguish a particular device from others of its type. For example, all ethernet devices have the prefix eth. The first detected ethernet card is assigned the name eth0, the second eth1 and so forth. Every system also has a special network device called the lo, which represents the “localhost” or “loopback” device with address 127.0.0.1. You can view the basic settings of a network device by running the '/sbin/ip a command. By default, /sbin/ip a will print information on all active devices. If given a device name as an argument after show, it will print information about that device only.

# /sbin/ip addr show eth0

2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:09:6b:cd:13:0d brd ff:ff:ff:ff:ff:ff
altname enp3s0
altname ens160
inet 10.10.10.58/26 brd 10.10.10.127 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:feb9:130d/64 scope link
valid_lft forever preferred_lft forever

How to manage Ethernet Connections in Linux

While at first glance this output may be a bit overwhelming, it is helpful to know that the most important information is in the top three lines. The first line tells us that eth0 is an ethernet device.

The second line list the hardware (or MAC) address 00:09:6b:cd:13:0d. This is a unique address built into every ethernet card by the manufacturer and can be useful for identifying specific devices on the network.

The fifth line lists the three fundamental IP configuration parameters: the IP address (10.10.10.58),