Configure eth0 on Ubuntu Server

To add the primary ip on the Ubuntu Server refer to the following steps.

1) Login in to the server as a root user

open the file /etc/network/interfaces

Delete all the entries from the /etc/network/interfaces but make sure that you have taken of original file

cp -p /etc/network/interfaces /etc/network/interfaces-back

Now open the file, the ip address for server is 192.168.1.5 and gateway is 192.168.1.1 , change the ip as per your server ip and gateway

nano /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.1.5
netmask 255.255.254.0
gateway 192.168.1.1

if you are using the 192.168.11.* range on your ubuntu server than add the following entries

nano /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.11.5
netmask 255.255.254.0
gateway 192.168.11.1

If you are using any firewall like Cisco, Cyberoam than make sure that you are using the correct gateway as per your firewall ip address. For example our Cyberroam ip is 192.168.11.25 therefore my gateway is 192.168.11.25 and interface file having following entries

nano /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.11.5
netmask 255.255.254.0
gateway 192.168.11.25

 

 

About Anant 384 Articles
Senior technical writer