how to move physical interface into multiple vimage interfaces

Marko Zec zec at icir.org
Thu Apr 2 10:53:22 PDT 2009


On Thursday 02 April 2009 18:43:57 subbsd wrote:
> Hello maillist
>
> i fetch and apply latest
> http://imunes.tel.fer.hr/virtnet/vimage-20081015.tgz patches for 7.2
> i386 for testing vimage.

Hi,

if you're running 7.2-PRERELASE or similar you'll probably have more 
luck trying out the latest sys tarball tracking 7-stable: 
http://imunes.tel.fer.hr/virtnet/vimage_7_20090401.tgz

> All according man page work done.
> Small bug: vimage -i with 1 arguments make core dumped:
>
> # vimage -i onearg
> Segmentation fault (core dumped)

You're right, this needs to be fixed...

> and bridge cannot worked:
> kldload if_bridge.ko
> link_elf: symbol ifnet undefined
> KLD if_bridge.ko: depends on bridgestp - not available

if_bridge is not virtualized yet, so as an alternative, I'd suggest you 
try out netgraph bridging which works quite well vith virtual stacks.  
There's a tutorial describing how to use netgraph with vimages - pls. 
take a look at this: 
http://imunes.tel.fer.hr/virtnet/eurobsdcon07_tutorial.pdf

> And i've want asking:
> may i using 1 physical or vlan interface as parent for multiple
> vimage interfaces? something like
> vimage -c sw1
> vimage -c sw2
> vimage -c sw3
>
> vimage -i sw1,sw2,sw3 em0

No it won't work that way - a single interface (physical, vlan, 
whatever) can be assigned to only one vimage at a time.  So to make 
multiple vimages visible via a single physical card you should create 
virtual interfaces for vimages and bridge them to the physical one.  
Here's an example:

tpx32# vimage -c sw1
tpx32# vimage -c sw2
tpx32# vimage -c sw3
tpx32# ngctl mkpeer eiface ether ether
tpx32# ngctl mkpeer eiface ether ether
tpx32# ngctl mkpeer eiface ether ether
tpx32# kldload ng_ether
tpx32# ngctl mkpeer em0: bridge lower link0
tpx32# ngctl name em0:lower b0
tpx32# ngctl connect em0: b0: upper link9
tpx32# ngctl connect ngeth0: b0: ether link1
tpx32# ngctl connect ngeth1: b0: ether link2
tpx32# ngctl connect ngeth2: b0: ether link3
tpx32# vimage -i sw1 ngeth0
eth0 at sw1
tpx32# vimage -i sw2 ngeth1
eth0 at sw2
tpx32# vimage -i sw3 ngeth2
eth0 at sw3
tpx32# 
tpx32# ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 
1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:16:41:15:4d:3e
        inet6 fe80::216:41ff:fe15:4d3e%em0 prefixlen 64 scopeid 0x3 
        inet6 a:2::51 prefixlen 64 
        inet 192.168.200.110 netmask 0xffffff00 broadcast 
192.168.200.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        inet6 ::1 prefixlen 128 
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5 
        inet 127.0.0.1 netmask 0xff000000 
tpx32# ping 192.168.200.1
PING 192.168.200.1 (192.168.200.1): 56 data bytes
64 bytes from 192.168.200.1: icmp_seq=0 ttl=255 time=4.668 ms
64 bytes from 192.168.200.1: icmp_seq=1 ttl=255 time=2.625 ms
^C
--- 192.168.200.1 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 2.625/3.647/4.668/1.022 ms
tpx32# ifconfig em0 promisc
tpx32# vimage sw1
Switched to vimage sw1
# ifconfig
lo0: flags=8008<LOOPBACK,MULTICAST> metric 0 mtu 16384
eth0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:00:00:00:00:00
# ifconfig lo0 localhost
# ifconfig eth0 link 42:1:2:3:4:1
# dhclient eth0
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPNAK from 192.168.200.31
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
DHCPOFFER from 192.168.200.31
DHCPOFFER from 192.168.200.32
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 192.168.200.31
bound to 192.168.200.112 -- renewal in 1800 seconds.
# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        inet 127.0.0.1 netmask 0xff000000 
        inet6 ::1 prefixlen 128 
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
eth0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 
1500
        ether 42:01:02:03:04:01
        inet6 fe80::d41d:8cd9:8f00:b204%eth0 prefixlen 64 scopeid 0x2 
        inet 192.168.200.112 netmask 0xffffff00 broadcast 
192.168.200.255
# ping 192.168.200.1
PING 192.168.200.1 (192.168.200.1): 56 data bytes
64 bytes from 192.168.200.1: icmp_seq=0 ttl=255 time=4.833 ms
64 bytes from 192.168.200.1: icmp_seq=1 ttl=255 time=2.619 ms
64 bytes from 192.168.200.1: icmp_seq=2 ttl=255 time=2.544 ms
^C
--- 192.168.200.1 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 2.544/3.332/4.833/1.062 ms
# 


More information about the freebsd-virtualization mailing list