I am currently trying to set up (as a total noob) a small home server running Ubuntu 20.04. The server is a Minisforum mini PC (U820 model) with two Ethernet ports. The first port is connected to my ISP fibre box. The second port is connected to my usual everyday computer, a Mac — so the Ubuntu server is some kind of router. The Mac is also wirelessly connected to the server (as I activated wifi sharing in Ubuntu).
On the Ubuntu terminal, the ip a
command originally told me to use the 10.42.0.1
address to locally access the server via Ethernet from the Mac:
3: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 5c:85:7e:4e:6c:e5 brd ff:ff:ff:ff:ff:ff
inet 10.42.0.1/24 brd 10.42.1.255 scope global noprefixroute enp2s0
valid_lft forever preferred_lft forever
inet6 fe80::1ea8:95f4:8840:fee/64 scope link noprefixroute
valid_lft forever preferred_lft forever
4: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether b0:a4:60:7c:c0:a4 brd ff:ff:ff:ff:ff:ff
inet 10.42.1.1/24 brd 10.42.0.255 scope global noprefixroute wlp3s0
valid_lft forever preferred_lft forever
inet6 fe80::d87f:88e4:afe7:637f/64 scope link noprefixroute
valid_lft forever preferred_lft forever
But recently (after an Ubuntu reboot?) the local addresses changed, they were reversed, now I have to use the address 10.42.1.1
to connect to the server via the Ethernet port.
How can I prevent future reversals? Or is it possible to give some name to the enp2s0
Ethernet interface, a name that could be used from the Mac to always connect to the server through the wired path?