Virtual Network Interface Card

rozhuk.im at gmail.com rozhuk.im at gmail.com
Fri Dec 17 21:30:31 UTC 2010


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 at freebsd.org [mailto:owner-freebsd- 
> net at freebsd.org] On Behalf Of Alex Zhang
> Sent: Saturday, December 18, 2010 2:30 AM
> To: freebsd-net at 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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"



More information about the freebsd-net mailing list