Skip to content

lime-proto-wan add support for VLAN on WAN#1236

Merged
ilario merged 8 commits intolibremesh:masterfrom
ilario:lime-proto-wan-vlan3
Feb 24, 2026
Merged

lime-proto-wan add support for VLAN on WAN#1236
ilario merged 8 commits intolibremesh:masterfrom
ilario:lime-proto-wan-vlan3

Conversation

@ilario
Copy link
Member

@ilario ilario commented Jan 14, 2026

I am using a LibreMesh router directly connected to an Optical Network Terminal.
My ONT communicates exclusively on VLAN 20 (type 802.1q), so the wan proto needs to support the wan:20 syntax, as already happens with the routing protocols (e.g. list protocols babeld:17).

With the routing protocols, the VLAN type defaults to 802.1ad, but here I think that the scenario I described is the predominant use case, and works with 802.1q. So I decided that the type defaults to 802.1q for lime-proto-wan.

In order to create a VLAN device without creating also the OpenWrt interface, I made a function network.createDevice copying the code from network.createMacvlanIface.
The main problem of having also the OpenWrt interface, is that OpenWrt's firewall would add wan_20 (wan with VLAN ID 20) to the LAN set of interfaces, allowing traffic to all ports.

@a-gave
Copy link
Contributor

a-gave commented Jan 28, 2026

Amazing, thanks!

I just tested it and seems ok. I'm approving it. Feel free to merge it yourself when you consider it complete.

Tested on:

  • OpenWrt One: running libremesh-master-ow24.10.5
  • Cudy WR3000S v1: running libremesh-master-ow24.10.3 (b23a8f4 20250629_1619)

Details of tests:

A. on the Cudy (connected to the internet via 80211s):

  1. Install luci via opkg
  2. Go to http://10.13.0.1/cgi-bin/luci/admin/network/network and select the tab Devices
  3. Select 'Add device configuration' and create a 'VLAN (802.1q)' network device,
    with 'Base Device: lan1'. Then 'Save' and 'Save and Apply'
  4. From the Network/Devices tab select 'Configure' on the network device 'br-lan',
    then edit 'Bridge ports' deselecting 'lan1' and selecting 'lan1.20'. Then 'Save and Apply'

B. on the OpenWrt One:

  1. Copied ilario's patch to the files /usr/lib/lua/lime/network.lua and /usr/lib/lua/lime/proto/wan.lua
  2. Inserted the following content to 'lime-node':
    (to disable babeld, change wifi channels, change ipv4 to 10.14.x.x/16, change ap_ssid)
config lime 'system'

config lime network
	option main_ipv4_address '10.14.0.0/16'
	list protocols ieee80211s
	list protocols lan
	list protocols anygw
	list protocols batadv:%N1

config lime 'wifi'
	option ap_ssid 'test_LibreMesh.org'

config lime-wifi-band '2ghz'
	option channel '1'

config lime-wifi-band '5ghz'
	list channel '44'

config net lm_hwd_openwrt_wan                           # This interface gets created by lime-hwd-openwrt-wan package in case an ethernet WAN port is detected
    option autogenerated 'false'                        # Specify that the configuration of the WAN ethernet port has been manually edited, 
        
config net port0
    option linux_name 'eth0'
    list protocols 'wan:20:8021q' 

  1. Run 'lime-config; reboot'

Then I connected via cable the Cudy lan1 port to the OpenWrt One's wan port and the latter reach the internet successfully.

I'd maybe repeat in lime-docs the section to disable the autogeneration of lime-hwd-openwrt-wan, because I tend to forget it

config net lm_hwd_openwrt_wan                           # This interface gets created by lime-hwd-openwrt-wan package in case an ethernet WAN port is detected
    option autogenerated 'false'                        # Specify that the configuration of the WAN ethernet port has been manually edited, 

Near the section ## configure the ethernet port eth1.5 as WAN with static ipv4 and ipv6 addresses
Because is required if you are inserting a manual configuration through the default wan port.

@ilario
Copy link
Member Author

ilario commented Feb 24, 2026

I changed the section name and added the configuration option there, it works for me, so I merge. Thanks for the testing!!!

@ilario ilario merged commit 7929208 into libremesh:master Feb 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants