0

From time to time I unplug my ethernet cable from my desktop (Linux Mint 19) to connect my laptop to the wired network. When I plug the cable back into the desktop, the internet on there is incredibly slow (going from >800 Mbps to <7 Mbps).

I've tried resetting the network adapter (using sudo /etc/init.d/network-manager restart), which doesn't help. The only thing that seemed to work is rebooting my computer entirely. But it is a little annoying to terminate my simulations etc. just to get back to proper internet speeds, so I'm looking for a simple command line solution.

I'm afraid I know very little of these things, so I don't know what information you require to diagnose the issue. Please comment and let me know what output you need, and I will append it to this question.

Additional info:

  • Output of cat /sys/class/net/eno1/speed is 1000 in the normal case, and 10 when I unplug/replug the ethernet cable
  • The IP address on my desktop remains unchanged, and is different from my laptop's
4
  • Please give us a bit mpre information: the contents of /sys/clas/net/XXX/speed where XXX is the network device (maybe something like eno1, ethY or enpXsY) before and after the incident. Commented Mar 18, 2019 at 8:10
  • This is just a hunch, but could you check the ip addresses on both devices when they get the network connection? If they get the same ip address by the DHCP server, this may cause the slowdowns.
    – LPChip
    Commented Mar 18, 2019 at 8:15
  • Thanks @EugenRieck, @LPChip. I added the requested information to my question. It is suspicious that /sys/class/net/eno1/speed changes, so I guess there's an issue with that.
    – MPA
    Commented Mar 18, 2019 at 14:03
  • 1
    Try bringing the adapter down and back up in the command prompt with "ifconfig eno1 down/up" it should be the same as a restart, unless something is up with your tcp/IP stack. Commented Mar 18, 2019 at 16:07

1 Answer 1

2

As I expected, the speed handshake between your switch and the NIC fails the second time - this happens from time to time with some switch-nic combinations.

You have a few options:

  • First try ifdown eno1 ; sleep 2 ; ifup eno1 (and recheck /sys/class/net/eno1/speed) to see if this fixes it.
  • If this does not suffice, unload the driver and reload it: ifdown eno1; sleep 1; driver=$(basename $(realpath /sys/class/net/eno1/device/driver); rmmod -f $driver ; sleep 1; modprobe $driver ; sleep 2; ifup eno1 - this should be the same as a reboot.
1
  • Your first suggestion works (with the slight modification I adopted from @Tim_Stewart: ifconfig eno1 down ; sleep 2 ; ifconfig eno1 up). Thanks!
    – MPA
    Commented Mar 19, 2019 at 7:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .