I am trying to set up a NetBSD install with a static ip that is on a vlan. The router is set up to only allow other vlans to access this vlan, but not the other way around. So the NetBSD install should be able to ping the outside world and respond to pings by devices on other vlans. This is the same environment and machine and connection as Unable to reach host with static ip and gateway is vlan - Debian 10 just different os. I was able to get that machine working with the same gateway/server/netmask values.
Just a quick summary...
Router configuration:
IP: 192.168.2.1
Netmask: 255.255.255.0
DHCP range: 192.168.2.2 - 192.168.2.10
This particular vlan configuration (VLAN 3):
VLAN IP: 192.168.0.1
Netmask: 255.255.255.0
DHCP range: 192.168.0.10 - 192.168.0.254
NetBSD/server configuration:
Address 192.168.0.2
Netmask: 255.255.255.0
Gateway: 192.168.0.1
The man page for vlan said to do the following to set up (adapted for current set up):
ifconfig vlan3 create
ifconfig vlan3 vlan 3 vlanif bce0
But, I was not able to ping the outside world nor respond to pings from other vlans. I then tried to do:
create
vlan 3 vlanif bce0
and reboot, but that yielded the same result. I assigned 192.168.0.2 to vlan3 via ifconfig vlan3 192.168.0.2 netmask 255.255.255.0
and I got the same result.
I wasn't sure if lack of other vlans were interfering so I created ifconfig.vlan1 - ifconfig.vlan3 and then rebooted:
/etc/ifconfig.vlan1:
create
vlan 1 vlanif bce0 up
/etc/ifconfig.vlan2:
create
vlan 2 vlanif bce0 up
/etc/ifconfig.vlan3:
create
vlan 3 vlanif bce0 up
But I got the same result. I assigned vlan3 192.168.0.2, but the result was the same.
I tried creating a tap (ifconfig tap0 create
) and then assigning it 192.168.0.2 then creating vlan3 (I destroyed vlan3 before hand) and then doing ifconfig vlan 3 vlanif tap up
, but result was the same.
Here's a snippet of if I go back to the /etc/ifconfig.vlan1-3 files with no ip assigned to any vlan interface and tcpdump -vv -e vlan
and then ping 192.168.0.2 from other vlans:
05:35:06.932765 90:a7:c1:b6:37:44 (oui Unknown) > Broadcast, ethertype 802.1Q (0x8100), length 60: vlan 3, p 0, ethertype ARP (0x0806), Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.0.2 tell 192.168.0.1, length 42
05:35:07.932679 90:a7:c1:b6:37:44 (oui Unknown) > Broadcast, ethertype 802.1Q (0x8100), length 60: vlan 3, p 0, ethertype ARP (0x0806), Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.0.2 tell 192.168.0.1, length 42
Here is raw tcpdump: https://web.archive.org/web/20220112142651/https://tmpfiles.org/dl/188092/tcpdumpout
I have ensured that my default route is 192.168.0.1.
I'm not sure if network interfaces are loaded in the wrong order or if there is a firewall/packet filter that's on by default that I'm not aware of, but I don't know what's wrong.