A classic routing problem
My ISP's router was pretty basic and didn't let me assign static IP addresses to my devices. This would have been helpful for stuff like my security cameras, home server, TV, etc.
So, when I got the Pi 4 and decided to set this thing up, I went looking for a cheap router instead. I didn't bother looking at any mid-to-high-range routers since my goal was to find one with the static IP address feature. After a quick browse, I bought a cheap TP-Link Archer C24. It was awesome and did exactly what I needed.
Network setup
My ISP router's default gateway is 192.168.1.1
, and the new router is 192.168.0.1
. I connected them with an Ethernet cable. My home server and other devices that needed a static IP were connected to the new router, and I assigned them addresses accordingly.
My phone connects to whichever router is nearest, which was never a problem. I also connected my PC to the new router via Ethernet so I could easily access my local devices. This was a sweet setup, and I was even thinking about setting up port forwarding between the two routers in the future.
But as always, things didn't go perfectly on the first try.
Noticeable drop in speed
After a few days, I started to notice that my internet speed was slower than usual. My normal speed should be around 400 Mbps, yet I was only hitting 90 Mbps at most.
I took some time to check for misconfigurations, and then it hit me—I'd made a massive oversight when I bought the router. The new TP-Link Archer C24 was only capable of 100 Mbps speed. While this was fine for the local network storage I'd set up, it was a huge bottleneck for browsing, downloading large files, and updating games. I need that speed for my comfort and sanity.
Feeling bad about my oversight and ignorance, I was mulling over returning it. But first, I decided to check for any "software solutions." Which, it turns out, actually exist.
A classic routing problem
This was actually a simple routing problem. I guess I should have paid more attention in my Cisco class back in college. I realized I could configure my PC to route traffic based on its destination. This means if I'm browsing the internet or downloading game updates, my PC will use the fast ISP router. Otherwise, it will connect to the new, slower router to access my local servers.
To do this, my PC needed to be connected to both routers at the same time. It was already connected to the new router via Ethernet, so I just had to connect to the ISP router's Wi-Fi as well. It's possible to have two active network connections on one machine.
Unfortunately, my other devices won't have this dual-connection setup, but that's not a big deal since they mostly use Wi-Fi anyway. I can just connect them directly to the faster ISP router by default.
The nmcli commands
After a quick search for the right commands, I found I could do everything I needed with nmcli
.
First, find the right connection name:
$ nmcli connection show
My Ethernet connection to the new router was named Wired connection 1
. I needed to tell my system to never use this connection as the default route for internet traffic. The command to do that is:
$ nmcli connection modify "Wired connection 1" ipv4.never-default yes
This ensures that all internet-bound traffic goes through my other connection (the Wi-Fi), which is connected to the fast ISP router.
To apply the changes, I just had to restart the connection:
$ nmcli connection down "Wired connection 1" && nmcli connection up "Wired connection 1"
Finally, the my speed is back!
And just like that, I got my speed back! I ran a speed test and confirmed I was getting my full 400 Mbps again. I also checked that I could still connect to my home server through the wired connection, and it worked perfectly.