Calling Network Gurus! (VLAN Issues)

Hi Everyone

I am newer-ish to OpenWRT. I am trying to configure a VLAN for my home servers. (file, media, pihole, etc)

I have OpenWRT running on a GEEK+ Mini PC, Mini Desktop Intel Celeron J3455
https://www.amazon.com/gp/product/B08SQS7NWQ/ref=ppx_yo_dt_b_asin_title_o04_s00?ie=UTF8&psc=1

The PC has 2x gigabit ethernet ports. eth0 is LAN and eth1 is WAN.

I also have 2x TP-Link 8 Port Gigabit Managed Switches.

In OpenWRT, I create a VLAN with the ID of 2, eth0.2. I assign a static IP when I create the interface, 10.10.8.1, and set up DHCP on that interface.

On the TP Switch, I enable 802.1Q VLANs, and untag a port 3 with VLAN ID 2.

I have a hypervisor with a VM hanging off it with a gigabit nic that is connected to the port 3, VLAN2.

I can't get the VM to pull a DHCP on vlan2 nor can I get to the internet or anything.

What am I doing wrong?

Let’s start by looking at the router config. After this is verified, we can check the switch.

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/network
cat /etc/config/dhcp
cat /etc/config/firewall
1 Like
root@firewall:~# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'xxxxxxxxxxxxxxxxxxxxxxxxx'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ip6assign '60'
        option ipaddr '10.10.4.2'
        option netmask '255.255.255.0'

config interface 'wan'
        option device 'eth1'
        option proto 'dhcp'

config interface 'wan6'
        option device 'eth1'
        option proto 'dhcpv6'

config interface 'wg0'
        option proto 'wireguard'
        option private_key 'xxxxxxxxxxxxxxxxxxxxxxxxx'
        option listen_port 'xxxxx'
        list addresses '10.14.0.1/24'

config device
        option type '8021q'
        option ifname 'eth0'
        option vid '2'
        option name 'eth0.2'

config interface 'Servers'
        option proto 'static'
        option device 'eth0.2'
        option ipaddr '10.10.8.1'
        option netmask '255.255.255.0'

root@firewall:~#

root@firewall:~# cat /etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option nonwildcard '1'
        option localservice '1'
        option ednspacket_max '1232'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        list dhcp_option '3,10.10.4.2'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

config dhcp 'VLAN2'
        option interface 'VLAN2'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option netmask '255.255.255.0'
        list ra_flags 'none'

config dhcp 'Servers'
        option interface 'Servers'
        option start '100'
        option limit '150'
        option leasetime '12h'
        list ra_flags 'none'

root@firewall:~#

root@firewall:~# cat /etc/config/firewall

config defaults
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option synflood_protect '1'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        list network 'lan'
        list network 'wg0'
        list network 'Servers'

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        list network 'wan'
        list network 'wan6'

config forwarding
        option src 'lan'
        option dest 'wan'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option src_ip 'fc00::/6'
        option dest_ip 'fc00::/6'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-IPSec-ESP'
        option src 'wan'
        option dest 'lan'
        option proto 'esp'
        option target 'ACCEPT'

config rule
        option name 'Allow-ISAKMP'
        option src 'wan'
        option dest 'lan'
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'

config rule
        option name 'Support-UDP-Traceroute'
        option src 'wan'
        option dest_port '33434:33689'
        option proto 'udp'
        option family 'ipv4'
        option target 'REJECT'
        option enabled 'false'

config include
        option path '/etc/firewall.user'

config redirect
        option target 'DNAT'
        option name 'WireGuard'
        list proto 'udp'
        option src 'wan'
        option src_dport 'xxxxx'
        option dest 'lan'
        option dest_ip '10.10.4.2'
        option dest_port 'xxxxx'

config redirect
        option target 'DNAT'
        option name 'SSH'
        list proto 'tcp'
        option src 'wan'
        option src_dport '22'
        option dest 'lan'
        option dest_ip '10.10.4.151'
        option dest_port '22'
        option enabled '0'

root@firewall:~#

@psherman
Requested above. Thanks for looking it over!

Looks okay at first glance. Let’s look at the switch configuration. Please show the vlan assignments for the ports in question - specifically the trunk port(s) and the access ports - be sure to tell us what each port are connected to what. And don’t forget to show the pvid assignments, too.

Port 4 is the router link.
Port 8 is the VM I want on VLAN2.

Port 4 is the router link.
Port 8 is the VM I want on VLAN2.

currently, VLAN 2 is only present on port 8, so it doesn't have a connection to the router. Make port 4 (the router uplink port) a member of VLAN 2 -- tagged. That should fix the problem.

Two untagged vlans on the one port makes no sense at all

That is why there is a pvid setting. Only one untagged network is actually active on the port.

Right

Still, remove it from vlan1 otherwise vlan1 traffic can still be sent to port 8 as it is a member if vlan1

PVID sets the ingress id for untagged traffic - does not effect egress, nor does it effect tagged ingress packets

Try setting more than one untagged vlan on your openwrt router - it won't allow it - the fact that TP-Link allows it doesn't make it correct

and ... having a single port on a vlan makes no sense either - you've made a dead end for vlan 2

I have a similar setup albeit with a 16 port switch - here's the dumbed down version (I actually have 5 vlans, and trunking happening, but that's irrelevant to your setup - I think)

        MEMBER PORTS    TAGGED PORTS    UNTAGGED PORTS
VLAN   
   1    3-16                            3-16
   2    1-2                             1-2
  • Ports 1 & 2 have PVID = 2
  • Everything else PVID = 1
  • My ISP supplied modem connects to port 1
  • My OpenWRT WAN connects to port 2
  • My OpenWRT LAN connects to port 3
  • Everything else connects to ports 4-16

It works just fine

This is incorrect. I have a variety of switches from tp-link and netgear which both allow a port to be a member of multiple networks as untagged and then have a pvid control. The pvid setting controls both ingress and egress. You can think of it as selecting the one network to be active out of a ‘menu’ of several that are available to be chosen.

This is not unique to tp-link and is true on the consumer series as well as the enterprise oriented switches.

That was why I said that vlan 2 needs to be added to port 4 (tagged)

So, why have you not done what you know you need to do?

As far as the other stuff goes - I'll just disagree with your assertions about multiple untagged vlans on the one port - try it on openwrt ... try it on cisco ... it makes no sense to do it

I have on my own networks. I am not the person who started this thread. I am the person helping the op.

I agree that it is not allowed on openwrt, and Cisco has a different method, too. But I can tell you with certainty that it is valid and functions properly to use the pvid as I have described on netgear and tp-link devices. There are differences in implementation of the settings between the various brands. All that matters is that the end result is 802.1q compliant.

Also, I don’t disagree with you that it is preferable to only have a single untagged network specified, but I can confirm that there is no harm to having multiple, as long as the pvid is set correctly.

The singular benefit to this is that it makes for a physically neat appearance. But there is literally no value add from a network perspective. In fact, it can be considered a negative - you are consuming 2 extra switch ports and using an extra cable for your wan. You’re not really leveraging any value with the vlan capabilities of your router and switch.

@psherman You fixed it! I have not had a chance to read all the other replies yet but your suggestion has worked!

Awesome. I figured that would be the only issue! Glad it works now.

There isn't much to gain from the rest of the thread after the suggestion that fixed the issue, but feel free to read it and ask questions if anything is not clear.

Meanwhile, please also mark the most helpful response as the solution.

I haven't actually shown my true config - there's a reason the router is connected the way it is - which is irrelevant to this topic