Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: No DNS after static IP change on Ubuntu Server 16.04

  1. #1
    Join Date
    Oct 2007
    Location
    South Africa
    Beans
    23

    Question No DNS after static IP change on Ubuntu Server 16.04

    I recently signed up with a new ISP who gave me a new router and without changing too much on their router I thought I'd rather update my servers IP address instead. It was a static IP address before and was working 100% but after the new static IP address domains don't want to resolve for some reason.
    I am running a pi-hole server but not as a DHCP client, the router is still handling that. The routers DNS just points to the pi-hole.

    The setup was working before the server IP change so I am not sure what I am missing now. Perhaps someone could shed some light?

    /etc/network/interfaces file:

    Code:
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eno1
    iface eno1 inet static
    address 192.168.101.110
    broadcast 192.168.101.255
    netmask 255.255.255.0
    network 192.168.101.0
    gateway 192.168.101.1
    dns-nameservers 192.168.101.1
    Not sure if this is relevant?
    etc/resolv.conf

    Code:
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.0.1

    SOLUTION EDIT:

    The routes table and /etc/dhcpcd.conf needed to be updated.

    If there are any IP's relating to the router or network in /etc/dhcpcd.conf they will need to be updated.

    Then check the routes using sudo ip route if there are any IP's that shouldn't be there delete them by executing:

    Code:
    sudo ip route del default via 192.168.1.254 dev eno1
    sudo ip route del 192.168.1.0/24 dev eno1  proto kernel  scope link  src 192.168.1.100  metric 202
    Then add the default gateway:
    Code:
    sudo ip route add default via 192.168.101.1
    Last edited by PseudZ; 3 Weeks Ago at 01:21 PM. Reason: Adding solution to first post

  2. #2
    Join Date
    May 2007
    Beans
    213
    Distro
    Xubuntu

    Re: No DNS after static IP change on Ubuntu Server 16.04

    For 16.04 I don't think the useless systemd-resolved has taken over yet, but check if it has. (did 16.04 even have systemd? don't remember)

    Otherwise the old trusty resolvconf manages your DNS and it's best configured manually in the file /etc/resolvconf/resolv.conf.d/tail
    which will not be overwritten automatically.
    Last edited by webaake; 4 Weeks Ago at 05:45 PM.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  3. #3
    Join Date
    Oct 2007
    Location
    South Africa
    Beans
    23

    Re: No DNS after static IP change on Ubuntu Server 16.04

    Thank you for the feedback. Unfortunately adding the DNS to the resolv.conf doesn't seem to have helped either.

    Interestingly when I run route -n I get ip addresses from the old network not the current network. I am not sure if this is an issue - I would assume so but I am not that much of an expert to know what needs to be changed.

    Just an edit. When I remove the old routes and then add the correct ones in, the first two always end up coming back after a restart. They must be populating from somewhere but I am not sure where.

    Code:
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.1.254   0.0.0.0         UG    202    0        0 eno1
    192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eno1
    192.168.101.0   0.0.0.0         255.255.255.0   U     0      0        0 eno1
    Last edited by PseudZ; 4 Weeks Ago at 04:07 PM.

  4. #4
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,292
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: No DNS after static IP change on Ubuntu Server 16.04

    The machine is in the 192.168.101.0/24 subnet and designates its gateway as 192.168.101.1, but the routing table doesn't show the same configuration. If you use the configuration in post #1, can you ping 192.168.101.1?

    You should be able to configure everything using the graphical NetworkManager.

    16.04 used dnsmasq and resolvconf as I recall. systemd didn't really get going until 18.04.
    Last edited by SeijiSensei; 4 Weeks Ago at 05:15 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  5. #5
    Join Date
    Oct 2007
    Location
    South Africa
    Beans
    23

    Re: No DNS after static IP change on Ubuntu Server 16.04

    This is my issue. When I remove the irrelevant IP addresses from the routing they return after the network is restarted. This I am unsure about as to where it would be defaulting from.
    What would add the old IP addresses back to the routing table?

    I can ping the gateway on 192.168.101.1

  6. #6
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,338
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: No DNS after static IP change on Ubuntu Server 16.04

    Code:
    dns-nameservers 192.168.101.1
    That points at the router, not the pi-hole. That is the problem. Point it at the pi-hole IP.

    Also, I'd remove the "networks" line. It isn't needed and if it is wrong, can confuse things.

    16.04 has systemd, but not systemd.resolved - thank DOG!

    BTW, if you have a pi-hole, you don't need resolvconf or systemd.resolved at all. Those can be purged for systems that don't leave the LAN (desktops and servers), but leave them on any portable devices like laptops. Also, remove the symbolic link for /etc/resolv.conf and create a file there with a standard nameserver and any DNS search options you may desire.
    Code:
    $ more /etc/resolv.conf 
    nameserver 172.22.22.80
    nameserver 172.22.22.81
    Best to have 2 DNS servers, running on different systems. You can point the 2nd to a backup DNS, perhaps 1.1.1.1.

  7. #7
    Join Date
    Oct 2007
    Location
    South Africa
    Beans
    23

    Re: No DNS after static IP change on Ubuntu Server 16.04

    Thank for the replies all.

    Just to eliminate any issues, I have removed the pi-hole and I am just using Cloudflare's DNS on the router level.

    This is what /etc/network/interfaces looks like:

    Code:
    # The primary network interface
    auto eno1
    iface eno1 inet static
    address 192.168.101.110
    broadcast 192.168.101.255
    netmask 255.255.255.0
    gateway 192.168.101.1
    dns-nameserver 192.168.101.1
    Surely pointing the dns-nameserver to the router is okay as it will just use whatever DNS the router is using?

    The routing table:

    Code:
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.1.254   0.0.0.0         UG    202    0        0 eno1
    192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eno1
    192.168.101.0   0.0.0.0         255.255.255.0   U     0      0        0 eno1
    For some reason I cannot get rid of the 192.168.1.xxx IP addresses. I remove them and they keep returning. Not sure how to rectify that?

    Interestingly when I ping 1.1.1.1 it is trying to use the servers old IP address. Once again I am not sure how to sort that out?

    Code:
    PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
    From 192.168.1.100 icmp_seq=1 Destination Host Unreachable
    From 192.168.1.100 icmp_seq=2 Destination Host Unreachable
    From 192.168.1.100 icmp_seq=3 Destination Host Unreachable
    As I mentioned before, everything use to work on my previous network. It's only after the router was changed and new IP addresses were used that the issues started.

    Thanks for the assistance so far.

  8. #8
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,338
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: No DNS after static IP change on Ubuntu Server 16.04

    Whoa!

    You can't just change from the network and router from
    192.168.1.254 ---> 192.168.101.1
    and expect things to work. The router needs to be configured with the changes first. Depending on the router, that may not be possible.

    Ping the router by IP. I don't care if that is 192.168.1.254 or 192.168.101.1. If you can't ping the router, you won't get anywhere.

    There are rules to how networks work. We can't just make up numbers as we go without ensuring all the parts along the way agree with those new made-up numbers.

    "entryway" isn't a valid element in the interfaces file. There's no reference to it in the manpage.

    The interfaces file probably should appear like this for now:
    Code:
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    auto eno1
    iface eno1 inet static
      address 192.168.101.110
      netmask 255.255.255.0
      gateway 192.168.101.1    # assuming this is really the router
      dns-nameserver 1.1.1.1
    If the router IP is wrong, you won't get anywhere. Anything else is useless. The dns-nameserver pointing at the router may or may not work. It depends whether DNS is running on that device or not. It doesn't always.

    You know, if you could show the original file that worked, we'd 100% know what the router IP was.

  9. #9
    Join Date
    Oct 2007
    Location
    South Africa
    Beans
    23

    Re: No DNS after static IP change on Ubuntu Server 16.04

    The original router IP was 192.168.1.254 and I can definitely ping the new the router on 192.168.101.1. I have access to the new router and all my other devices on DHCP are working on the router. It's just the server which isn't

    I have tried the interfaces file as you mentioned but that doesn't seem to have worked either.

    Why though, when I ping 1.1.1.1 it shows as if it's coming from the servers old IP address (192.168.1.100)?

  10. #10
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,338
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: No DNS after static IP change on Ubuntu Server 16.04

    If you don't show the exact command and the exact output, we cannot help.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •