What a network card is
Video 051 of 140 in Virtualization Foundations, in the unit “Storage devices, buses and network cards”. 4:01, with English and Hindi audio.
A network card connects a server to the network. It turns data into electrical or light signals that travel along a cable or a fibre. To understand one, you need four details: its ports, its speed, its MAC address and its queues. Each one tells you something about what the card can carry and how it behaves. This article explains the four, and shows how to read a port's speed and link state on Linux.
What you will learn
- A port is where a cable plugs in, and its speed is agreed with the switch.
- The MAC address is a hardware address that tells cards apart on a local network.
- Queues let several processor cores share the incoming packets.
- Changing a MAC address can break software that is tied to it.
- When a port misbehaves, check its link state and its negotiated speed first.
Ports and speed
A port is a socket that one cable plugs into. A card can have several ports. Each port runs at a speed measured in bits per second. Twenty-five gigabits is a common speed for server ports.
When the link comes up, the port and the switch agree on a speed. If the settings do not match, the link runs slower, or stays down.
Note: A port that agreed on a lower speed carries less than you expect, and nothing shows as an error. Check the speed.
What a MAC address is for
Every network card has a MAC address, a number built into it. Other devices on the local network use it to tell the card apart. It has six pairs of hexadecimal digits, a base-sixteen way of writing numbers. The first three pairs name the card's maker.
Virtual cards also get MAC addresses. The hypervisor, the software that runs virtual machines, makes them. On Linux, the command below lists each interface with its state and its MAC address.
ip -br linkNote: Do not change a card's MAC address without checking what depends on it. Some software licences are tied to that address, and the program may refuse to run if the address changes.
How queues spread the work across cores
A busy card has queues, which are separate lines for incoming packets. A packet is a small piece of network data. Each queue has its own interrupt, so the work can be spread across processor cores.
The card runs each packet's addresses through a hash, a quick calculation, to choose a queue. Packets from one conversation therefore land in the same queue, so their order holds.
Spreading the work this way is called receive side scaling. Without it, one busy core could handle every packet and become the limit.
Read one port's speed and link state
Pick a port name from the list you got in the step above. The example below uses eno1, which may not exist on your machine, so use your own name.
sudo ethtool eno1The output reports the speed that the port agreed on with its switch, and whether a cable is up. A port with no link has no live signal at all.
Try it yourself
You need a Linux server with a network card. You will list its ports, then check the speed and link state of one of them.
List the interfaces with their state and their MAC address.
ip -br linkWhat you should see: Each interface is shown, with its state and its MAC address.
Ask ethtool about one port. Replace eno1 with a port name from the list above.
sudo ethtool eno1What you should see: The speed the port agreed on with its switch, and whether a cable is up.
Terms
- Port
- A socket on a network card where one cable plugs in.
- MAC address
- A hardware address built into a network card, used to tell cards apart on a local network.
- Packet
- A small piece of network data that travels from one device to another.
- Queue
- A separate line for incoming packets, so that the work can be shared across processor cores.
- Receive side scaling
- Spreading incoming packets across queues and cores, so that one core is not the limit.
Check yourself
What does a MAC address identify?
The network card on a local network. It is built into the card, and other devices use it to tell cards apart.
Why can a port run slower than expected without showing an error?
The port and the switch may agree on a lower speed. The link still works and carries less data, and nothing shows as an error.
Why do queues help a busy server?
They let several processor cores share the incoming packets, so one core does not become the limit.
Previous: How a device talks to the CPU: DMA and interrupts. Next: HBAs and RAID controllers.