This works for me:
$cat /etc/hostname.vr1
up
$cat /etc/hostname.vlan2
inet 10.0.2.254 255.255.255.0 NONE vlan 2 vlandev vr1
$cat /etc/hostname.vlan100
inet 10.0.100.254 255.255.255.0 NONE vlan 100 vlandev vr1
OpenBSD 6.3 (GENERIC) #3: Thu Dec 20 09:35:15 MST 2018
[email protected]:/usr/src/sys/arch/i386/compile/GENERIC
As Josh mentioned, you also need 802.1Q managed switch. Then you have to
configure your VLANs on your switch.
Example:
let's have any 16ports switch:
16p - configure as uplink for vlan2 and vlan100
1-10p - configure as ports of vlan2
11-15p - configure as ports of vlan100
Then connect 16p to your vlanNIC of openbsd box.
On Mon, 28 Jan 2019 20:02:19 +0800
johnw <[email protected]> wrote:
> My system is:
>
> OpenBSD 6.4-current (GENERIC.MP) #639: Sun Jan 27 14:27:05 MST 2019
> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
> Thanks.
>
> On 2019年1月28日 19:57:01 [GMT+08:00], johnw <[email protected]> wrote:
> >hi, I want create vlan network, I create two files
> >
> >hostname.vio0
> >up
> >
> >hostname.vlan0
> >inet 10.10.10.101 255.255.255.0 10.10.10.255 parent vio0 vnetid 10
> >
> >then reboot
> >
> >I can not ping 10.10.10.1
> >
> >If I create bridge0, and add vio0 and vlan0 to bridge0, then I can ping
> >10.10.10.1
> >
> >Or if I just use vio0 without vlan,
> >hostname.vio0
> >inet 10.10.10.101 255.255.255.0 10.10.10.255
> >I can also ping 10.10.10.1.
> >
> >Why vlan0 not linked vio0(parent) without create bridge?
> >
> >Is this normal? AM I miss understand vlan?
> >
> >(eg: I also tried on real machine with hostname.em0 card, same result)
> >
> >Thanks.
> >
> >
> >
> >
> >
> >Key fingerprint: CDB3 6C62 254B C088 1E5D DD32 182C 97DB CF2C 80AC
>
>
> Key fingerprint: CDB3 6C62 254B C088 1E5D DD32 182C 97DB CF2C 80AC
--
radek