I recently had to change my router subnet from 192.168.1.1 to use 192.168.2.1, so it wouldn't conflict with an upstream router.
I have a few servers connected to the router using static IPs that I also needed to update to use the new subnet. For example: the old IP was 192.168.1.2, so I thought I simply needed to change that to 192.168.2.2.
So I edited by /etc/network/interfaces
from:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.1.2
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
to:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.2.2
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.2.255
gateway 192.168.2.1
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
I know the most recent Ubuntu distro uses netplan, but this is an older server I've upgraded, still using /etc/network/interfaces
.
After rebooting it's using the new IP, but it's unable to resolve domain names. It seems to be able to ping external IPs directly, but just can't resolve the domains themselves. For example, the server can't ping google.com, but it can ping 8.8.8.8.
My router has WiFi, and if I connect to the WiFi with a laptop I can ping domains just fine.
Why is this? Is my network configuration wrong, or is this more like a problem with my router?
Edit: My /etc/resolv.conf
looks like:
nameserver 127.0.0.53
domain home
search home
nameserver 192.168.1.1
nameserver 71.242.0.12
so it looks like it's still trying to use the old router IP as a nameserver, which it can no longer access. How do I correct this? Or should I just hard-code common public nameservers in my interfaces
like?
dns-nameservers 8.8.8.8 8.8.4.4
/etc/resolv.conf
pointing to the device that's supposed to offer DNS services?interfaces
as you suggested and call it a day :-)