Okay, so “tre mil,” I’d never even heard of this before. It sounds kinda fancy, maybe Italian? Turns out, it’s about configuring network interfaces in Linux. Yeah, I know, not exactly glamorous, but hey, gotta learn sometime, right?
I needed to set up a static IP for a little home server I was messing with. Dynamic IPs are fine for most things, but this server needed to be reliable. I used the new server for hosting some game, you know. Constant address changes would have been a pain.
The Hunt Begins
First, I did what any normal person does: I hit up Google. Lots of complicated-looking commands, network configuration files, and scary warnings about breaking my system. Yikes.
I stumbled upon a few tutorials, some of which were better, but still not quite what I needed. There were all these different ways to do it, using ip commands, editing /etc/network/interfaces, messing with NetworkManager… it was a mess.
Wrangling with /etc/network/interfaces (and Failing)
I started by trying to edit the /etc/network/interfaces file. It seemed like the “old school” way, and I figured it would be the most straightforward. I opened it up with a text editor.
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto enp0s3
#iface enp0s3 inet dhcp <-- I commented this out
iface enp0s3 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
I added the lines for a static IP, netmask, gateway, and DNS servers. Saved the file, rebooted… and nothing. No internet. Oops.
NetworkManager to the (Partial) Rescue
Next, I tried using NetworkManager. I figured it had a GUI, so it had to be easier, right? Well, sort of. I found the network settings, clicked on my connection, and switched it to “Manual” mode. I filled in all the same IP address info, and… still no internet.
The “ip” Command: A Temporary Fix
Getting desperate, I started messing with the ip command. I found some examples online and managed to temporarily set the IP address:
sudo ip addr add 192.168.1.100/24 dev enp0s3
sudo ip route add default via 192.168.1.1
This worked! I had internet! But as soon as I rebooted, it was gone. Back to square one.
The Real Solution (Finally!)
After more digging, I realized I’d been missing a crucial step when using NetworkManager. I had to actually tell NetworkManager to use the manual settings I’d configured.
I found I needed to reset config:
nmcli connection modify enp0s3 * manual
I also reset those other settings with the following:
And after using the ip addr command, I find my config worked. I got a stable internet connection, and can use my little server for hosting game!
So, yeah, “tre mil” wasn’t as fancy as it sounded. It was just a lot of trial and error, Googling, and finally figuring out the right way to use NetworkManager. It’s not pretty, but it works, and that’s what matters, right?