Thursday, March 13, 2014

In my works, sometimes I need to configure router/wireless router with my PC. But since my PC only has one ethernet port that configured with static IP address, I have to find a way to be able to configure the router/wireless router without unplug it. One way is by adding secondary (virtual) IP address on existing ethernet port.

You can do this by using temporary or permanent way.

Temporary way:
Pretend that your ethernet is eth0, and you know that DHCP block IP from the router/wireless router is 192.168.1.0/24, you can set static IP address in that range:

$ sudo ip addr add 192.168.1.11/24 dev eth0

And when you finished, you can just delete that temporary additional IP:

$ sudo ip addr del 192.168.1.11/24 dev eth0

Permanent way:
You can add permanently by adding config in /etc/network/interfaces file: