Manually set IP address and route

Sometimes you need to set a temporarily IP address to your interface.
In this example I need to add to my eth1 interface:

ip addr add dev eth0

After this, you also need to set a default route so your computer know where to go if you want to access something outside your subnet:

ip route add default via

These settings are not permanent, if you restart your computer, do a dhclient --renew or restart your network, these settings will be gone.

Add a new route to your network configuration

If you want to add a route to a different network enter the following:

sudo route add -net gw netmask dev eth1
  1. = the network you want to route
  2. gw = your current gateway
  3. netmask = your current netmask
  4. dev eth1 = the interface you want to route the over.

To delete the route, enter the following:

sudo route del -net gw netmask dev eth1
Subscribe to RSS - route