From owner-freebsd-net@FreeBSD.ORG Sat Dec 18 02:38:35 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6666D106564A for ; Sat, 18 Dec 2010 02:38:35 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from out-0.mx.aerioconnect.net (outx.internet-mail-service.net [216.240.47.247]) by mx1.freebsd.org (Postfix) with ESMTP id 46EA68FC0A for ; Sat, 18 Dec 2010 02:38:34 +0000 (UTC) Received: from idiom.com (postfix@mx0.idiom.com [216.240.32.160]) by out-0.mx.aerioconnect.net (8.13.8/8.13.8) with ESMTP id oBI2cXIi032497; Fri, 17 Dec 2010 18:38:33 -0800 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137]) by idiom.com (Postfix) with ESMTP id 3D4D22D6011; Fri, 17 Dec 2010 18:38:33 -0800 (PST) Message-ID: <4D0C1EA6.6080402@freebsd.org> Date: Fri, 17 Dec 2010 18:38:30 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 To: Rozhuk.IM@gmail.com References: <4d0bd675.8a1ce30a.200f.2c4b@mx.google.com> In-Reply-To: <4d0bd675.8a1ce30a.200f.2c4b@mx.google.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 216.240.47.51 Cc: freebsd-net@freebsd.org, Alex Zhang Subject: Re: Virtual Network Interface Card X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Dec 2010 02:38:35 -0000 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" >