Ubuntu Server 14.04 How To Change IP Address From Dynamic To Static

When setting up a server, it is more practical to set the IP Address to Static or Fixed IP Address


To view and change your IP Address type:
  $ sudo nano /etc/network/interfaces  
If your primary network interface (usually eth0) is dynamic it will display these lines:
  #The primary network interface
 auto eth0                                    
 iface eth0 inet dhcp                      




To change it to static IP Address change 'dhcp' to 'static' and enter the rest of the data below:

#The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.254

netmask 255.255.255.0

network 192.168.0.0

broadcast 192.168.0.255

gateway 192.168.0.1
For nano* editor press ctrl-X and the press 'Y' and Enter.

This is assuming that you are using the following data:
  • subnet 192.168.0.x 
  • IP address of your server:  192,168,0,254
  • Gateway: 192.168.0.1
To implement the changes, you need to restart the network card (eth0). You do this by disabling the eth0 and enabling it again, type the two commands below.

$sudo ifdown eth0 
$sudo ifup eth0  

To verify if the new configuration is used type:

 $ifconfig 
You're supposed to see the IP address you have entered above.

Note: *- Nano - is a text editor similar to the old time favorite vi.

Comments

  1. 192.168.0.1 is the address of an array of D-Link and Netgear model routers, similar to 192.168.1.1

    ReplyDelete

Post a Comment