Ubuntu: How to get rid off the dynamic ip?



Question:

[enter image description here][1]I will try to keep this short!

I've successfully managed to give ubuntu server 16.04 (Raspberry Pi 3 B) a static ip, but the dynamic ip is still present and active. Using ssh is the only way of accessing the server.

How do i get rid of the dynamic ip?

I have put my static ip configuration in /etc/network/interfaces. The dynamic ip is not defined in /etc/network/interface anymore, it's defined in /etc/network/interfaces.d/*.cfg. I've tried commenting out /etc/network/interfaces.d/*.cfg and the dynamic ip configuration itself, but this is when the problems start kicking in. After sudo shutdown -h now -> replug -> start, the system looses the static ip. I cant even login with the dynamic ip, even though it's visible.

This is little off topic, but i was once logged in with static ip and after installing mysql-server the ssh connection was suddenly cut off and i had to reconnect with the dynamic ip. Seems like the ip addresses aren't treated equally.

Do i need to disable/delete some dhcp client deamons/files and if so, how? The dhcp client seems to go nuts if i try to prevent it from reaching the dhcp configuration by commenting them out.

I've configured a static ip before, but this time everything seems to be working differently.

Here are the requested files

/etc/network/interfaces:

# This file describes the network interfaces available on your system  # and how to activate them. For more information, see interfaces(5).    # The loopback network interface  auto lo  iface lo inet loopback    auto eth0  iface eth0 inet static  address            192.168.1.201  netmask            255.255.255.0  network            192.168.1.0  broadcast          192.168.1.255  gateway            192.168.1.1  dns-nameservers    62.241.198.245    # Source interfaces  # Please check /etc/network/interfaces.d before changing this file  # as interfaces may have been defined in /etc/network/interfaces.d  # See LP: #1262951

/etc/network/interfaces.d/*.cfg:

auto lo  iface lo inet loopback    auto eth0  iface eth0 inet dhcp

Any help is appreciated!

Thanks in advance


Solution:1

Comment out/remove auto eth0 iface eth0 inet dhcp - it is the reason why dynamic IP is being assigned (using DHCP). You shouldn't have the same interface defined twice. See https://help.ubuntu.com/lts/serverguide/network-configuration.html for more details on network configuration.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »