my home server is usually connected to my home LAN via ethernet, straight to my router.
However I may occasionally move it around and ssh into it while it’s connected to my home WiFi.
Since my router’s DHCP assigns different IPs to those two interfaces (e.g. 10.230.230.2 for eth and .3 for wifi), I was wondering if there’s a way to declare two hostnames, e.g. home-server-eth and home-server-wifi, so that I can reach it by name rather than IP.
My home router should support local DNS resolution AFAIK, but the host name is not something I can decide there, I guess it’s discovered automatically, and therefore it stays the same for both IPs, leading to ambiguity:
Thanks, but I’d rather have something DNS-based since I may also ssh into my server from an Android phone.
This is a first world problem I reckon, with static leases I will know that I have to ssh either into .2 or .3. The point is, this would be a way for me to learn something new
You might want to try to ssh into your router and then change the DNS entries there (it seems to be possible for tp link routers) - you might be in luck.
On the other hand, if the router is from your internet provider, most likely that possibility is locked/disabled.
I’ve not tried this but using nmcli, you could maybe have it configured to send a different hostname value on the dhcp request. For instance: #get connection names
nmcli show con
nmcli con show “wireless name”
One of the properties is ipv4.dhcp-hostname
so maybe:
nmcli con modify “wireless name” ipv4.dhcp-hostname “some unique hostname”
You could then just add it to your hosts file as well assuming you see the hostname reflected in the router on next dhcp
Again about those screen shots. As you explained they are from your router, but there is no title/header, thus what the table shows is unclear.
My impression is that they are just a list of IP addresses managed by the DHCP server in the router. Nothing more. No connection with an eventual DNS server that may or may not run in the same router.
It seems like many home router manufacturers provide this capability tho, at least according to some forum users complaining about this shortage on their Tp-Link.
Anyway, it’s been an occasion for me to learn something new about NM and I’m happy I gave it a try.
I guess I’m gonna connect to the statically leased IP addresses and call it a day (as I’ve been doing so far).