Configure Linux Static IP Network Interface

Static IP configuration can be found in file /etc/network/interfaces. This applies to Debian or any derivatives such as Ubuntu.

Edit the file /etc/network/interfaces using sudo command

sudo pico /etc/network/interfaces

Change the file content to be similar like below. Please ensure to look closely on iface eth0 section. You can change the IP address based on your preferred address.

[code language=”bash”]# The loopback interface
auto lo
iface lo inet loopback

# Configuration for eth0 and aliases

# This line ensures that the interface will be brought up during boot.
auto eth0

# eth0 – This is the main IP address that will be used for most outbound connections.
# The address, netmask and gateway are all necessary.
iface eth0 inet static

In case if you want to configure static IP in any virtual machine such as VirtualBox, you may need to adjust dns-nameservers manually
[code language=”bash”]iface eth0 inet static