Assigning a static IP to Ubuntu Server 14.04 LTS
I'm not sure if this will solve your problem, but this answers your question and I think it's worth a shot.
To assign a static IP, you need to edit /etc/network/interfaces
.
The interface will probably be called eth0
.
The current entry will look something like:
auto eth0
iface eth0 inet dhcp
You will need to change this to:
auto eth0
iface eth0 inet static
address 10.253.0.50
netmask 255.255.255.0
network 10.253.0.0
gateway 10.253.0.1
dns-nameservers 8.8.8.8
You will have to change the numbers around depending on your network, but you can find out the information by checking out ipconfig
from Windows.
Make sure you choose an address outside the address space of the DHCP server.
Then restart networking sudo service networking restart
. If that gives you trouble, reboot the machine.
Set your IP address changes in /etc/network/interfaces
. Example:
auto eth0
iface eth0 inet static
address 192.168.1.128
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Don't give your DNS configurations in /etc/resolv.conf
because while we restart the server sometimes the configuration get erased.
So use vim /etc/resolvconf/resolv.conf.d/base
(while updating configs in this it doesn't get removed)
example:
search (domain name)
nameserver 8.8.8.8
nameserver 8.8.4.4
Save and then restart your server, this fixed my static issue! :)
I found I had to include the dns settings:
auto lo enp0s25
iface lo inet loopback
iface enp0s25 inet static
address 192.168.1.128
netmask 255.255.255.0
gateway 192.168.1.1
dns-search example.com
dns-nameservers 8.8.8.8 8.8.4.4
See https://help.ubuntu.com/lts/serverguide/network-configuration.html