Setting up a Static IP and route in Linux

By Paulus, 17 April, 2011

The first step is to setup the interface with an IP and a netmask:

# ifconfig eht0 192.168.1.25 netmask 255.255.255.0 up

Next we need to tell where we want to route the information to:

# route add default gw 192.168.1.1 eth0 

The above command is saying that we want a default gateway on interface eth0 to be 192.168.1.1 which is a router.