Tag Archives: privacy

Using Network Virtual Interfaces

You might use network virtual interfaces when there are several networks range (completely different) on the same network structure. You have:

ISP modem
Router, Switch or Hub (at least one)
Computers

the non-virtual network structure is:

172.0.0.0 – Network
172.0.0.1 – Gateway
172.0.0.255 – Broadcast
172.0.0.2 – 254 – Clients

There are three computers that want to be comunicated privately or separated from the 172.0.0.0 network but in the same structure of network. (There are several cases in which you can use virtual interfaces, this is just an example)

The virtual structure is:

10.0.0.0 – Network
10.0.0.255 – Broadcast
10.0.0.1-254 – Clients
(There’s no gateway in this case but if you want you might have some one, it can be another router (connected to the first) or another computer that has the NAT function configured)

To set the configuration permanent on a Debian’s based system you write /etc/network/interfaces file:

auto eth0
iface nvirtual inet static
address 172.0.0.20
netmask 255.255.255.0
gateway 172.0.0.1
auto eth0:1
iface virtual inet static
address 10.0.0.2
netmask 255.255.255.0

Close and save.

Now you have to restart networking daemon:

# /etc/init.d/networking restart

Make this with at least two computers and make ping between them using “nvirtual” and “virtual” interfaces.

For make this temporaly, type on at least two computers:

# ifconfig eth0 172.0.0.20 netmask 255.255.255.0 up
# ifconfig eth0:1 10.0.0.2 netmask 255.255.255.0 up
# route add default gw 172.0.0.1
# nano /etc/resolv.conf
namesevers xx.xx.xx.xx
save and close
# ping -c 5 172.0.0.1 ; ping -c 5 10.0.0.4 #another computer virtual interface address