Unexpected behavior of ssh(d) with vlan

Hello,

I have a problem with my vlan configuration and sshd

my virtual machine is connected do a dhcp server,
network is 10.0.2.0
netmask is 255.255.255.0
dhcp-range is 10.0.2.2-100

In my rc.conf
Code:
ifconfig_em0="DHCP"
em0 will get ip 10.0.2.15

with this, sshd is reachable on 10.0.2.15


but, when I add
Code:
vlans_em0="10 20" 
ifconfig_em0_10="inet 10.0.2.130 netmask 255.255.255.0"
ifconfig_em0_20="inet inet 192.168.20.2 netmask 255.255.255.0"
I cannot reach sshd on 10.0.2.15 on this machine
with arp -a there is no answer from 10.0.2.130, as expectet.

but when I change the subnet
Code:
ifconfig_em0_10="inet 10.0.3.130 netmask 255.255.255.0"
sshd is reachable on 10.0.2.15

I cannot understand this, because, a vlan should behave, as a physically different wire / network and it should be possible to use the same network-range on different networks.
 
Please show me all network configuration from /etc/rc.conf

I predict that you have defined two the same networks on the same host.
1st is received via DHCP - 10.0.2.15/24
2nd is vlan10 - 10.0.2.130/24
It will not work in that configuration, but it is possible to split your 10.0.2.0/24 netwotk;
For example: you can use two /25 networks instead of one 10.0.2.0/24
Another devices should to have a correct netmask too.

If you want to have an interface dedicated only for vlans then just use
Code:
ifconfig_em0="UP"
It will disable 'untagged' non-vlan net 10.0.2.15/24.

If you want to communicate via vlans then you should to have a remote device in the same vlan or in the access port with the same vlan.
 
If you want to communicate via vlans then you should to have a remote device in the same vlan or in the access port with the same vlan.
You also need a switch that understand VLANs. Most commercial switches that are used at home are unmanaged and do not support VLANs.
 
Are you using the same subnet (10.0.2.0/24) on untagged AND on vlan 10? Never do that, this is always a recipe for disaster. _Always_ use different subnets on different networks (vlans)!
 
Back
Top