I tried the previously suggested setups with veb(4) but couldn't get it
to work, so I decided to start with simpler configurations to at least
figure out how to use vlan(4).

These experiments, though, have also failed. I'm attempting to use vlan
with vmm but making a mistake somewhere.  Networking without vlans
works, but as soon as I create vlans, it fails. Anyone able to provide
hints?

Here is the original working configuration:

First, the host/hypervisor:

# cat /etc/vm.conf
socket owner :vmdusers

switch "switch1" {
    locked lladdr
    interface bridge0
}

bsdiso="/home/iso/install75.iso"

vm "jrmu" {
    owner jrmu
    memory 2G
    cdrom $bsdiso
    disk /home/jrmu/jrmu.qcow2 format qcow2
    interface tap1 { 
        locked lladdr e8:8b:27:7b:7a:02
        switch "switch1"
    }
}

# cat /etc/hostname.bridge0                                             
add vether0
# cat /etc/hostname.vether0                                             
inet 104.167.241.53 0xfffffff8
up
# cat /etc/hostname.em1     
inet 104.167.241.211 0xffffffc0
inet6 2602:fccf:400:41::1 64
!route add -inet6 2602:fccf:400::1 -cloning -link -iface em1
!route add -inet6 default 2602:fccf:400::1

# ifconfig
lo0: flags=2008049<UP,LOOPBACK,RUNNING,MULTICAST,LRO> mtu 32768
        index 4 priority 0 llprio 3
        groups: lo
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
        inet 127.0.0.1 netmask 0xff000000
em0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:25:90:5a:2d:93
        index 1 priority 0 llprio 3
        media: Ethernet autoselect (none)
        status: no carrier
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:25:90:5a:2d:92
        index 2 priority 0 llprio 3
        groups: egress
        media: Ethernet autoselect (1000baseT full-duplex,master)
        status: active
        inet 104.167.241.211 netmask 0xffffffc0 broadcast 104.167.241.255
        inet6 fe80::225:90ff:fe5a:2d92%em1 prefixlen 64 scopeid 0x2
        inet6 2602:fccf:400:41::1 prefixlen 64
enc0: flags=0<>
        index 3 priority 0 llprio 3
        groups: enc
        status: active
bridge0: flags=41<UP,RUNNING> mtu 1500
        description: switch1-switch1
        index 5 llprio 3
        groups: bridge
        priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp
        tap1 flags=3<LEARNING,DISCOVER>
                port 8 ifpriority 0 ifcost 0
        vether0 flags=3<LEARNING,DISCOVER>
                port 6 ifpriority 0 ifcost 0
vether0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        lladdr fe:e1:ba:d0:bc:f9
        index 6 priority 0 llprio 3
        groups: vether
        media: Ethernet autoselect
        status: active
        inet 104.167.241.53 netmask 0xfffffff8 broadcast 104.167.241.55
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33136
        index 7 priority 0 llprio 3
        groups: pflog
tap1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        lladdr fe:e1:ba:d1:13:c3
        description: vm1-if0-jrmu
        index 8 priority 0 llprio 3
        groups: tap
        status: active

# route -n show -inet
Routing tables

Internet:
Destination        Gateway            Flags   Refs      Use   Mtu  Prio Iface
default            104.167.241.193    UGS        2      845     -     8 em1  
224/4              127.0.0.1          URS        0        0 32768     8 lo0  
47.103.216.95      104.167.241.193    UGHD       1      755     - L   8 em1  
104.167.241.192/26 104.167.241.211    UCn        1      545     -     4 em1  
104.167.241.48/29  104.167.241.53     UCn        6        0     -     4 vether0
104.167.241.48     link#6             UHLc       0       20     -     3 vether0
104.167.241.49     link#6             UHRLc      0       59     -     3 vether0
104.167.241.50     link#6             UHRLc      0       88     -     3 vether0
104.167.241.51     e8:8b:27:7b:7a:02  UHLc       0      183     -     3 vether0
104.167.241.52     link#6             UHRLc      0       64     -     3 vether0
104.167.241.53     fe:e1:ba:d0:db:10  UHLl       0       27     -     1 vether0
104.167.241.54     link#6             UHRLc      0       68     -     3 vether0
104.167.241.55     104.167.241.53     UHb        0       12     -     1 vether0
104.167.241.193    ac:1f:6b:fe:ca:98  UHLch      2      277     -     3 em1  
104.167.241.211    00:25:90:5a:2d:92  UHLl       0      127     -     1 em1  
104.167.241.255    104.167.241.211    UHb        0       61     -     1 em1  
127/8              127.0.0.1          UGRS       0        0 32768     8 lo0  
127.0.0.1          127.0.0.1          UHhl       2      280 32768     1 lo0  

Inside the virtual machine:

jrmu# cat /etc/hostname.vio0                                                  
inet 104.167.241.51 0xfffffff8
up
jrmu# cat /etc/mygate                                                         
104.167.241.53

Connectivity works fine:

jrmu# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=114 time=7.205 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=114 time=7.272 ms

However, here is what I see after I setup vlans:

On the host/hypervisor:

# cat /etc/hostname.bridge0                                     
add vlan2
# cat /etc/hostname.vlan2 
inet 104.167.241.53 0xfffffff8
parent vether0 vnetid 100
up
# cat /etc/hostname.vether0                                     
up
# ifconfig
lo0: flags=2008049<UP,LOOPBACK,RUNNING,MULTICAST,LRO> mtu 32768
        index 4 priority 0 llprio 3
        groups: lo
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
        inet 127.0.0.1 netmask 0xff000000
em0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:25:90:5a:2d:93
        index 1 priority 0 llprio 3
        media: Ethernet autoselect (none)
        status: no carrier
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:25:90:5a:2d:92
        index 2 priority 0 llprio 3
        groups: egress
        media: Ethernet autoselect (1000baseT full-duplex,master)
        status: active
        inet 104.167.241.211 netmask 0xffffffc0 broadcast 104.167.241.255
        inet6 fe80::225:90ff:fe5a:2d92%em1 prefixlen 64 scopeid 0x2
        inet6 2602:fccf:400:41::1 prefixlen 64
enc0: flags=0<>
        index 3 priority 0 llprio 3
        groups: enc
        status: active
bridge0: flags=41<UP,RUNNING> mtu 1500
        description: switch1-switch1
        index 5 llprio 3
        groups: bridge
        priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp
        tap1 flags=3<LEARNING,DISCOVER>
                port 9 ifpriority 0 ifcost 0
        vlan2 flags=3<LEARNING,DISCOVER>
                port 7 ifpriority 0 ifcost 0
vether0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        lladdr fe:e1:ba:d0:90:ca
        index 6 priority 0 llprio 3
        groups: vether
        media: Ethernet autoselect
        status: active
vlan2: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        lladdr fe:e1:ba:d0:90:ca
        index 7 priority 0 llprio 3
        encap: vnetid 100 parent vether0 txprio packet rxprio outer
        groups: vlan
        media: Ethernet autoselect
        status: active
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33136
        index 8 priority 0 llprio 3
        groups: pflog
tap1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        lladdr fe:e1:ba:d1:17:81
        description: vm1-if0-jrmu
        index 9 priority 0 llprio 3
        groups: tap
        status: active

# route -n show -inet
Routing tables

Internet:
Destination        Gateway            Flags   Refs      Use   Mtu  Prio Iface
default            104.167.241.193    UGS        8     3121     -     8 em1  
224/4              127.0.0.1          URS        0        0 32768     8 lo0  
104.167.241.192/26 104.167.241.211    UCn        1     1418     -     4 em1  
104.167.241.193    ac:1f:6b:fe:ca:98  UHLch      2      716     -     3 em1  
104.167.241.211    00:25:90:5a:2d:92  UHLl       0      386     -     1 em1  
104.167.241.255    104.167.241.211    UHb        0      177     -     1 em1  
127/8              127.0.0.1          UGRS       0        0 32768     8 lo0  
127.0.0.1          127.0.0.1          UHhl       2      712 32768     1 lo0  
172.56.232.16      104.167.241.193    UGHD       1     1019     - L   8 em1  

Inside the virtual machine:

jrmu# cat /etc/hostname.vio0
up
jrmu# cat /etc/hostname.vlan0
inet 104.167.241.51 0xfffffff8
parent vio0 vnetid 100
up
jrmu# cat /etc/mygate
104.167.241.53

# ping 104.167.241.53
PING 104.167.241.53 (104.167.241.53): 56 data bytes
ping: sendmsg: Host is down
ping: wrote 104.167.241.53 64 chars, ret=-1
ping: sendmsg: Host is down
ping: wrote 104.167.241.53 64 chars, ret=-1
ping: sendmsg: Hostis down

On the host, I see the virtual machine has properly tagged packets with vnet
id 100:

# doas tcpdump -ne -i bridge0 
tcpdump: listening on bridge0, link-type EN10MB
23:43:23.896206 e8:8b:27:7b:7a:02 ff:ff:ff:ff:ff:ff 8100 46: 802.1Q vid 100 pri 
3 arp who-has 104.167.241.53 tell 104.167.241.51
23:43:24.906516 e8:8b:27:7b:7a:02 ff:ff:ff:ff:ff:ff 8100 46: 802.1Q vid 100 pri 
3 arp who-has 104.167.241.53 tell 104.167.241.51
23:43:25.906509 e8:8b:27:7b:7a:02 ff:ff:ff:ff:ff:ff 8100 46: 802.1Q vid 100 pri 
3 arp who-has 104.167.241.53 tell 104.167.241.51
23:43:26.906511 e8:8b:27:7b:7a:02 ff:ff:ff:ff:ff:ff 8100 46: 802.1Q vid 100 pri 
3 arp who-has 104.167.241.53 tell 104.167.241.51
23:43:27.906509 e8:8b:27:7b:7a:02 ff:ff:ff:ff:ff:ff 8100 46: 802.1Q vid 100 pri 
3 arp who-has 104.167.241.53 tell 104.167.241.51

-- 
jrmu
IRCNow (https://ircnow.org)

Attachment: signature.asc
Description: PGP signature

Reply via email to