1

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

3
  • 1
    Is /etc/resolv.conf pointing to the device that's supposed to offer DNS services? Feb 6, 2023 at 19:13
  • @Peregrino69 Nope, you're right. See my dit. But it's the file's autogenerated, so I don't want to directly edit it. Why hasn't it picked up the correct nameservers?
    – Cerin
    Feb 6, 2023 at 22:21
  • Sorry, can't really say, and can't test after borking my system. I'd just add it to interfaces as you suggested and call it a day :-) Feb 6, 2023 at 22:27

2 Answers 2

2

Your /etc/resolv.conf may have been fully autogenerated at one point of time, but it looks like the old values are "frozen in" because nothing is supplying any new DNS server addresses to the configuration mechanism.

The fact that it now has nameserver 127.0.0.53 as the first nameserver indicates your system probably uses systemd-resolved and the real DNS settings should then be checked using the resolvectl command. There might be some related settings in /etc/systemd/resolved.conf too.

Adding a dns-nameservers line with the DNS server(s) of your choice to /etc/network/interfaces might work.

If it doesn't work, check the modification timestamp of your /etc/resolv.conf file with ls -l /etc/resolv.conf: if it is older than the time you last rebooted the system, then autogeneration is clearly not actually happening with the current configuration, and you could just edit /etc/resolv.conf.

0

You have only changed the address and gateways entries in /etc/network/interfaces then you also need to change the network entry.

iface br0 inet static
        address 192.168.2.2
        network 192.168.2.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

1
  • Thanks, but after making that change and rebooting, nothing's changed.
    – Cerin
    Feb 6, 2023 at 22:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .