Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

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

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

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

    Is this what you're reffering to?

    Code:
    ~$ ping 1.1.1.1
    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
    Code:
    $ route -n
    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
    Code:
    $ cat /etc/network/interfaces
    # 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
    netmask 255.255.255.0
    gateway 192.168.101.1
    dns-nameserver 1.1.1.1

  2. #12
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,372
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

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

    Are you restarting networking between changes?

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

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

    I am yes. Using sudo ifdown -a && sudo ifup -a

    If that's the correct way?

  4. #14
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,372
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

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

    systemd broke much of how networking works. Sometimes ifup/ifdown don't work anymore and we have to use the systemctl commands. Sometimes those don't work and for expediency, I just reboot.

    Here's an interfaces file:
    $ more /etc/network/interfaces
    Code:
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto ens3
    iface ens3 inet static
     address 172.22.22.34
     netmask  255.255.255.0
     gateway 172.22.22.1
     dns-nameservers 172.22.22.80 172.22.22.81
    My router for that LAN segment is 172.22.22.1. It doesn't run any DNS or caching DNS or forwarding DNS.
    If you can't ping the router/gateway, nothing is going to work. If that isn't working, we need to step back and look at the cable, ports, and drivers.

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

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

    Okay I have made some headway. It is definitely routing related.

    So when I execute route -n I get this:

    Code:
    $ route -n
    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
    The 192.168.1.254 gateway and 192.168.1.0 IP should not be there so I execute both
    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
    which removes them, all good.

    The I add my default gateway:
    Code:
    sudo ip route add default via 192.168.101.1
    So the routes now look like this:
    Code:
    $ route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.101.1   0.0.0.0         UG    0      0        0 eno1
    192.168.101.0   0.0.0.0         255.255.255.0   U     0      0        0 eno1
    Now everything works as it should - I can ping google.com with no issues.

    However, once the server is rebooted the 192.168.1.254 gateway and 192.168.1.0 IP are back in the routing table again. Where would they be populating from? I don't know what would be holding on to that info?

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

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

    Have you ever used any GUI to control the network settings?
    Is there a DHCP server on the LAN that might be providing the gateway?

    Are you really running 16.04? Netplan took over network configuration after that release.

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

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

    I've found where it was sitting.

    /etc/dhcpcd.conf had the old router listed. I have no idea why it would have been listed in there but I corrected the IP address and it all seems good now.

    Thank you for the assistance TheFu. Will update as solved and add solution to my first post as well.
    Last edited by PseudZ; 4 Weeks Ago at 11:59 AM.

Page 2 of 2 FirstFirst 12

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
  •