---
title: Force network link speed on Linux
date: 2024-01-14
slug: focre-network-link-speed-linux
authors:
- lunik
description: Step-by-step guide to troubleshooting and forcing network interface link speed on Linux using ethtool, covering common issues with auto-negotiation.
tags:
- linux
- network
- speed
- link
- ethtool
- ip
- ifconfig
---

<!--
# CHANGELOG

-->

![cover](/blog/img/posts/2024-01-14-force-network-link-speed/cover.png)

Today I was confronted with a quite annoying problem. I have a server with a 1Gbps network card connected to a 1Gbps switch. I was trying to backup my data as usual but the transfer was slower than usual. Using `ethtool` I saw that the link speed was only 100Mbps !

<!-- truncate -->

## Debug the current link speed

First of all, I need to retreive the name of the network interface. I tougth it was `eth0` but it was `enp2s0`. Thank's Fedora for the new naming convention !

So using the `ip` command I can get list of all network interfaces and their current status.

```shell
ip link show
```

Output :

```shell
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 12:34:56:78:9a:bc brd ff:ff:ff:ff:ff:ff
```

The `enp2s0` interface is the one I'm looking for. I can now use `ethtool` to get the current link speed.

```shell
ethtool enp2s0
```

Output :

```shell
Settings for enp2s0:
	Supported ports: [ TP	 MII ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  100baseT/Full
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Link partner advertised link modes:  10baseT/Half 10baseT/Full
	                                     100baseT/Half 100baseT/Full
	                                     1000baseT/Half 1000baseT/Full
	Link partner advertised pause frame use: Symmetric Receive-only
	Link partner advertised auto-negotiation: Yes
	Link partner advertised FEC modes: Not reported
	Speed: 100Mb/s
	Duplex: Full
	Auto-negotiation: on
	master-slave cfg: preferred slave
	master-slave status: slave
	Port: Twisted Pair
	PHYAD: 0
	Transceiver: external
	MDI-X: Unknown
	Supports Wake-on: pumbg
	Wake-on: g
	Link detected: yes
```

The `Speed` line is the one I'm looking for. It says `1000b/s` which is not what I'm expecting. `Auto-negotiation` is `on` so the network card should be able to negociate the link speed with the switch. 

My card supports `1000baseT/Full` as seen in the `Supported link modes` line. The switch also supports `1000baseT/Full` as seen in the `Link partner advertised link modes` line. So why is the link speed only 100Mbps ?

## Force the link speed

I can force the link speed using the `ethtool` command.

```shell
ethtool -s enp2s0 speed 1000
```

Let's check the link speed again.

```shell
ethtool enp2s0
```

Output :

```shell
Settings for enp2s0:
	Supported ports: [ TP	 MII ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  1000baseT/Full
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Link partner advertised link modes:  10baseT/Half 10baseT/Full
	                                     100baseT/Half 100baseT/Full
	                                     1000baseT/Half 1000baseT/Full
	Link partner advertised pause frame use: Symmetric Receive-only
	Link partner advertised auto-negotiation: Yes
	Link partner advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Auto-negotiation: on
	master-slave cfg: preferred slave
	master-slave status: slave
	Port: Twisted Pair
	PHYAD: 0
	Transceiver: external
	MDI-X: Unknown
	Supports Wake-on: pumbg
	Wake-on: g
	Link detected: yes
```

The `Speed` line now says `1000Mb/s` which is what I'm expecting.

## Conclusion

I don't really know why the link speed was only 100Mbps. Maybe there was a problem with the switch or the cable. I'll investigate later. For now, I'm happy with my 1Gbps link speed.

<!-- Links -->
