You can configure a network adapter of a machine to use a static IP address. To configure static IP address in Ubuntu, you need to edit the  /etc/network/interfaces file

Open the file with Sudo Option

sudo nano /etc/network/interfaces

Assuming that the eth1 is the adapter for which static IP address is to be configured.

NOTE: If you set Host only adapter in “Adapter 2” in Oracle VirtualBox then eth1 will be mentioned. Similarly if you set Host only adapter in “Adapter 3” in Oracle VirtualBox then eth2 will be mentioned and so on…

Add / Edit Configuration for eth0 Adapter


auto eth1
iface eth1 inet static
address 192.168.56.101
netmask 255.255.255.0

Save the file 

If you are using nano editor, press ctrl+x and then Y and Enter to save the changes.

Restart Machine’s Network 

To restart the network in Ubuntu, execute the following command:

sudo ifdown eth1 && sudo ifup eth1

NOTE: If you have configured Host only adapter in any other adapter except ‘Adapter 2’ in Oracle VirtualBox then mention your respective Ethernet name in above command.

Verification

Now check your IP using below command:

ifconfig

Above command will show you static IP address.

Share this:

One thought on “Configure Static IP Address in Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *