I have a problem with static IP under Ubuntu 12.04.
With DHCP I have no problem, but when I set (under /etc/network/interfaces
) the static address, the gateway, the subnetmask and the dns-nameservers, I have that the Server cannot connect to external world.
It is able only to connect to local IP hosts.
I have tried to insert the nameservers in the /etc/resolv.conf
but every time I restart the machine, the changes are canceled.
What could be the problem?
The best possible way to set a static IP address to your Ubuntu 20.04 device is to use DHCP reservation. DHCP reservation is a feature built-in to most routers and allows you to set a specific IP. Basically, this feature ensures that the router keeps the IP address aside and only hands it to your device.
Step #02: Configure static ip address on Ubuntu 21.04 server. Open netplan config file using any editor. Then insert all below lines into your file. or you can edit your old text and replace interface and ip address as like you want. Then save press Esc type :wq then press Enter.
In the Activities screen, search for “network” and click on the Network icon. This will open the GNOME Network configuration settings. Click on the cog icon. In “IPV4” Method" section, select “Manual” and enter your static IP address, Netmask and Gateway.
Ubuntu 12.04 use resolvconf (a set of scripts and hooks) instead of resolv.conf to manage DNS server. The most notable difference for the user is that any change manually done to /etc/resolv.conf will be lost as it gets overwritten next time something triggers resolvconf.
To add the static dns entries in resolv.conf file,edit /etc/resolvconf/resolv.conf.d/base
:
Add these lines (the example below is OpenDNS’s public name servers):
nameserver 208.67.222.222
nameserver 208.67.220.220
Run this command to refresh the resolvconf setting:
sudo service resolvconf restart
To view your DNS Servers addresses, use this command:
cat /etc/resolv.conf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With