Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Dec 2010 18:38:30 -0800
From:      Julian Elischer <julian@freebsd.org>
To:        Rozhuk.IM@gmail.com
Cc:        freebsd-net@freebsd.org, Alex Zhang <alex@e.zc0.net>
Subject:   Re: Virtual Network Interface Card
Message-ID:  <4D0C1EA6.6080402@freebsd.org>
In-Reply-To: <4d0bd675.8a1ce30a.200f.2c4b@mx.google.com>
References:  <AANLkTimrVfHY=i6dQfUzCs-Qa2zR5KqNEWSGkFU%2BEF2P@mail.gmail.com> <4d0bd675.8a1ce30a.200f.2c4b@mx.google.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 12/17/10 1:30 PM, rozhuk.im@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@freebsd.org"
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D0C1EA6.6080402>