Answer the question
In order to leave comments, you need to log in
Creating a virtual interface
I want something weird.
There is a certain device (router) which runs under Linux.
The piece of iron can access the Internet via several interfaces (wifi, japares), plus it has two network interfaces. A switch hangs on one of them, to which the subnet is already connected (let's say 192.168. 1. *, which will receive the Internet. Also, another router can be connected to the same switch, which can also distribute the Internet. And it should already be another subnet (for example, 192.168.0. */24) .The
task is to hang one or two virtual ones on the same physical interface, with different IPs.This is done for the convenience of routing.There were
attempts to implement this through vconfig xgu.ru/wiki /man
:vconfig, however, was not successful. While I'm testing on my computer running Ubuntu 12.04
If you need any tricky console utilities, list them, build them, try them.
Answer the question
In order to leave comments, you need to log in
The easiest and most effective way: Open the /etc/network/interfaces file with a text editor as superuser, like this
sudo gedit /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 8.8.8.8 192.168.1.1
auto eth0:1
iface eth0:1 inet static
address 192.168.0.5
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.0.1
hwaddress ether 00269ebba619
dns-nameservers 8.8.8.8 192.168.1.1
You just need to set up an alias - hang two IPs on one interface. It is configured differently for different distributions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question