Eureka Moment Wiki

One eureka moment at the time

User Tools

Site Tools


Static network IP on Ubuntu server

Configuring IP address on Ubuntu server without using any tools other than a text editor

Edit network configuration file

sudo vim /etc/network/interfaces

You fill find configuration something like this

# The primary network interface -- use DHCP to find our address
auto eth0
iface eth0 inet dhcp

Change it to this

# The primary network interface
auto eth0
iface eth0 inet static

And finally restart networking service

sudo /etc/init.d/networking restart

You should be able to ping the host on the new IP address

If you need to add static routes, you can do it here by adding the lines

up route add -net netmask gw dev eth0

And delete them

down route del -net netmask gw dev eth0
linux/networking/static_ip.txt · Last modified: 2017/08/10 13:00 (external edit)