Virtual Network Interface Card
Julian Elischer
julian at freebsd.org
Sat Dec 18 02:38:35 UTC 2010
On 12/17/10 1:30 PM, rozhuk.im at gmail.com wrote:
> Hi, Alex!
>
>
> You can make virtual NIC via netgraph.
>
> 1. ng_ether automatic attached to every physical NICs on load module.
> 2. connect ng_bridge to upper and lower hooks on ng_ether 3. create and
> connect ng_eiface to ng_bridge and you will get new NIC ngethX with its own
> MAC address and IP addrs too.
> 4. repeat 3 :)
>
>
> But, do not connect physical NICs to one ng_bridge!
>
> Example
>
> # 1. loading netgraph modules
> kldload ng_ether
> kldload ng_bridge
> kldload ng_eiface
>
> # 2. create and connect bridge to physical NIC
some line wrap problems here... cleaned up.
> ngctl mkpeer em0: bridge lower link0
> ngctl connect em0: em0:lower upper link1
> # we can set name for bridge, and replace em0:lower -> em0Bridge in ngctl
> calls
> ngctl name em0:lower em0Bridge
>
> # 3.1 create and connect first virtual NIC
> ngctl mkpeer em0Bridge: eiface link3 ether
>
> # 3.2 create and connect second virtual NIC
> ngctl mkpeer em0Bridge: eiface link4 ether
>
>
> # configure virtual NICs
> ifconfig ngeth0 link 00:11:22:33:44:01
> ifconfig ngeth0 inet 192.168.1.254 netmask 255.255.255.0
>
> ifconfig ngeth1 link 00:11:22:33:44:02
> ifconfig ngeth1 inet 192.168.2.254 netmask 255.255.255.0
>
Yes,
this would give 3 interfaces on the same hardware
em0, ngeth0 and ngeth1
you could run a dhcp server on each, or I THINK the dhcp server .
can handle multiiple interfaces (but I'm not sure of details as I haven't
used it for a few years). you could also assign each interface to a
different
jail and have completely different systems on each address (including
dhcp server).
There are several alternatives and differences you could do to this.
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
>
More information about the freebsd-net
mailing list