Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Dec 2010 05:30:26 +0800
From:      rozhuk.im@gmail.com
To:        <freebsd-net@freebsd.org>
Subject:   RE: Virtual Network Interface Card
Message-ID:  <4d0bd675.8a1ce30a.200f.2c4b@mx.google.com>
In-Reply-To: <AANLkTimrVfHY=i6dQfUzCs-Qa2zR5KqNEWSGkFU%2BEF2P@mail.gmail.com>
References:  <AANLkTimrVfHY=i6dQfUzCs-Qa2zR5KqNEWSGkFU%2BEF2P@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 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 em0:lower eiface
link3 ether

# 3.2 create and connect second virtual NIC ngctl mkpeer em0:lower 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



 
--
Rozhuk Ivan
  


> -----Original Message-----
> From: owner-freebsd-net@freebsd.org [mailto:owner-freebsd- 
> net@freebsd.org] On Behalf Of Alex Zhang
> Sent: Saturday, December 18, 2010 2:30 AM
> To: freebsd-net@freebsd.org
> Subject: Virtual Network Interface Card
> 
> Hi all,
> I just wonder that if there are virtual nic functionalities which 
> provides MAC address?
> I need to run ISC DHCP Server on 4 different IP's within one sever, 
> however I have only 2 NICs connected to the server. I need different 
> MAC Address for those IPs in order to run it properly, so bxn0:l 
> styled cards won't work.  Solaris VNIC will just work for me, however 
> I would like to use FreeBSD, Alex 
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> 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?4d0bd675.8a1ce30a.200f.2c4b>