I am not sure if I am interpreting your question correctly, but a few things to help test if you can in fact see your router from your server.
Because NetPlan now is the default manager, we can ignore /etc/resolv.conf
, however to view or modify on Ubuntu you can set your DNS settings via /etc/resolv.conf
as follows:
nameserver 127.0.0.53
options edns0
search internal-network.local
If you are using resolv
and not Netplan
, point this at your DNS provider (in this question, PiHole I surmise), and restart the service:
sudo systemctl status resolvconf.service
From here, you can then test to see if you can reach your router or DNS provider. If you simply ping
the IP address of your destination (removing DNS from the equation) you should see if you can hit your L2 next-hop. You can find this out quite easily:
ip a | grep default
default via 192.168.0.1 dev eno2
default via 192.168.0.1 dev eno2 proto dhcp metric 100
(Noting your ranges will vary)
From there perform a basic ping -c 1 192.168.0.1
to ensure you have connectivity. From here you can start to validate that you have L2 network access.
Your Question
I get the feeling that the server cannot find the router
This is pretty open. If you've configured your DHCP leases (or your static routes correctly) then that should be fine. On your server, have a look at the netplan configuration and ensure you've set it correctly.
Run cat /var/lib/NetworkManager/internal...
(noting the file is unique, use tab
to auto-complete) to see your DHCP data:
# This is private data. Do not parse.
ADDRESS=192.168.0.9
NETMASK=255.255.255.0
ROUTER=192.168.0.1
SERVER_ADDRESS=192.168.0.1
T1=42600
T2=74550
LIFETIME=85200
DNS=8.8.8.8 8.8.4.4
DOMAINNAME=internal-network.local
CLIENTID=01b42e9933fa61
If you've got the correct information here (ROUTER
, NETMASK
and SERVER_ADDRESS
) then your problem is something else. A simple ICMP ping will denote whether you've got access to your router. If you're in the same logical network (I'm going to guess you're on a convention /24 range (255.255.255.0/24)) then you should also be see your DNS setup without the requirement to route.
IP route show gives me no info at all. I get the feeling that the server can't find the router?
This will give you all the information you require. If your DNS server is not within the same broadcast domain, you'll need to route to it. If this is in the same logical subnet then you should be able to abide by the default route on your box (an assumption is being made you have 1 logical NIC) - and even if not, as long as default
knows how to route to $x you're fine.
The question here is does your server have the capacity to route via your router to the internet. Start by identifying your routers internal IP address and see if you can get to it - then, try an internet address:
m-(~)-(15 files, 1.5Mb)--> traceroute 1.1.1.1
traceroute to 1.1.1.1 (1.1.1.1), 64 hops max
1 192.168.0.1 0.505ms 0.395ms 0.301ms
2 58.162.26.2 1.810ms 1.904ms 1.923ms
The first hop is my router, and then out to the internet. If you've got dual NICs, you might want to add a route:
ip route add 1.1.1.1/32 via 192.168.0.1
Retest this single host and see if your route changes.
ip a
andip route
we can have a look.