Configuring OpenWRT on GNS3

Hi everyone,

I am working on a project focused on structuring a mesh network for a local town. Since I don't have access to the actual physical hardware, I am setting up the configuration in GNS3, where I have LibreMesh installed on QEMU virtual machines.

In theory, the lab setup is straightforward. It consists of nodes linked across the town in a ring topology acting as internet gateways, which form the distribution network. These will then link to the users who want to install their own nodes.

My intention was to run the babeld protocol on the distribution network nodes (let's call them gateway nodes) and run batman-adv simultaneously. I have assigned (or intend to assign) a manual IP address to these gateway nodes. Regarding the access network, I planned for it to run the batman-adv protocol and, additionally, for the gateway node to act as a DHCP server to assign IPs to as many user nodes as connect to it. Similarly, I want the access network nodes (the user nodes) to also act as DHCP servers for the end devices that connect to them.

The issue, as I see it, is that GNS3 does not support wireless link simulation, forcing everything to be wired. Therefore, I'm not entirely sure to what extent these protocols can run successfully under these conditions. I've been testing and hitting a brick wall for several days now, unable to make any real progress.

I have checked the LibreMesh documentation, and I've been consulting AI tools regarding the configurations I am implementing. However, much to my regret, configuring LibreMesh within a simulated, entirely wired environment like GNS3 is highly unusual—or at least I haven't been able to find any resources providing information on it.

Attached below is an example of the lime-defaults and lime-node configuration files for one of the gateway nodes.

First of all, I want to apologize in advance for taking up your time if this practice turns out to be unfeasible or if the mistake is something quite silly and simple (which I am certain is the case). Please keep in mind that I am just a student, and this is the first time I've ventured into configuring something like this outside of the Cisco environments we are typically taught in school. That being said, here are the files:

Lime-defaults file:


# Community configuration file for LibreMesh
# Community: Lliurianet
# This file must be exclusively edited by administrators.
# Any unauthorized modification will be reported to authorities.
# Before modifying, read the official documentation available at:
# http://libremesh.org

config lime system
        option hostname 'gtw2'
        option domain 'lliuria.org'
        option keep_on_upgrade 'libremesh dropbear minimum-essential /etc/sysupgrade.conf'
        option root_password_policy 'SET_SECRET'
        option root_password_secret 'admin'

        # Reboot for maintenance
        option deferrable_reboot_uptime_s '97200'

        # Ping for maintenance after reboot
        option deferrable_reboot_ping_target '4.2.2.2'

config lime network
        option primary_interface 'eth4'
        option main_ipv4_address '192.168.4.254/22'
        option anygw_ipv4_address '192.168.20.%N1/24'
        option anygw_dhcp_start '2'
        option anygw_dhcp_limit '0'
        option main_ipv6_address 'fd%N1:%N2%N3:%N4%N5::/64'

        option auto_vlan_recovery 'false'
        option bridge_all_ethernet 'false'

        # Active and scalable protocols
        list protocols ieee80211s
        list protocols lan:eth4
        list protocols anygw
        list protocols anygw:219:eth4
        list protocols batadv:219
        list protocols batadv:219:eth4
        list protocols babeld:17:eth2
        list protocols babeld_eth2_type:wired
        list protocols babeld:17:eth3
        list protocols babeld_eth3_type:wired

        # DNS Servers
        list resolvers 4.2.2.2          # b.resolvers.Level3.net
        list resolvers 141.1.1.1        # cns1.cw.net
        list resolvers 2001:470:20::2   # ordns.he.net
        list resolvers 8.8.8.8
        list resolvers 1.1.1.1

        # Routing engine configuration
        option batadv_orig_interval '2000'
        option batadv_routing_algo 'BATMAN_V'
        option anygw_mac "aa:aa:aa:%N1:%N2:aa"
        option use_odhcpd false
        # option bmx6_mtu '1500'
        # option bmx6_publish_ownip false
        # option bmx6_over_batman false
        # option bmx6_pref_gw none
        # option bmx6_wifi_rate_max 54000000
        # option bmx7_mtu '1500'
        # option bmx7_publish_ownip false
        # option bmx7_over_batman false
        # option bmx7_pref_gw none
        # option bmx7_wifi_rate_max 'auto'
        # option bmx7_enable_pki false

config lime wifi
        list modes 'ap'
        list modes 'apname'
        list modes 'ieee80211s'
# list modes 'apbb'
        option country 'ES'
        option ap_ssid 'Lliurianet'
        option apname_ssid 'Lliurianet/%H'
# option apbb_ssid 'LliurianetBB/%H'

        # Mesh identifiers
        option adhoc_ssid 'LiMe'
        option adhoc_bssid 'ca:fe:00:c0:ff:ee'
        option ieee80211s_mesh_id 'LiMe'

        # Layer 2 routing management
        option ieee80211s_mesh_fwding '0'

        # Wireless card anti-lock system
        option unstuck_interval '10'
        option unstuck_timeout '300'

config lime-wifi-band '2ghz'
        option channel '11'
        option htmode 'HT20'
        option distance '1000'
        option adhoc_mcast_rate '24000'
        option ieee80211s_mcast_rate '24000'
        list modes 'ap'
        list modes 'apname'

config lime-wifi-band '5ghz'
        list channel '48'
        list channel '157'
        option htmode 'HT40'
# option htmode 'HT80'
        option distance '1000'
        option adhoc_mcast_rate '6000'
        option ieee80211s_mcast_rate '6000'
        list modes 'ieee80211s'

config generic_uci_config uhttpd_https
        list uci_set 'uhttpd.main.redirect_https=0'

Lime-node file:


# Read the documentation in /docs directory
# and on http://libremesh.org

# System options

config lime system
        option hostname 'gtw2'
        option domain 'lliuria.org'

# Network general option

config lime network
        option primary_interface 'eth4'
        option main_ipv4_address '192.168.4.254/22'

        list protocols babeld:17:eth2
        list protocols babeld_eth2_type:wired
        list protocols babeld:17:eth3
        list protocols babeld_eth3_type:wired

        list protocols lan:eth4
        list protocols anygw:eth4

# WiFi general options

config lime wifi

Network file:

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

config globals 'globals'

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

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.4.254'
        option netmask '255.255.252.0'
        option ip6assign '60'
        option ip6addr 'fdcb:26e0:ce09::91:4/64'
        option mtu '1500'

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

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

config interface 'bat0'
        option proto 'batadv'
        option routing_algo 'BATMAN_V'
        option bridge_loop_avoidance '1'
        option multicast_mode '0'
        option orig_interval '2000'
        option distributed_arp_table '0'
        option gw_mode 'client'

config device 'lm_net_br_lan_anygw_dev'
        option type 'macvlan'
        option name 'anygw'
        option ifname 'br-lan'
        option macaddr 'aa:aa:aa:cb:26:aa'

config interface 'lm_net_br_lan_anygw_if'
        option proto 'static'
        option device 'anygw'
        option auto '1'
        option ipaddr '192.168.4.1'
        option ip6addr 'fdcb:26e0:ce09::1/64'
        option metric '2147483647'
        option netmask '255.255.252.0'

config rule6 'lm_net_anygw_rule6'
        option src 'fdcb:26e0:ce09::1/128'
        option lookup '170'

config route6 'lm_net_anygw_route6'
        option interface 'lm_net_br_lan_anygw_if'
        option target 'fdcb:26e0:ce09::/64'
        option table '170'

config rule 'lm_net_anygw_rule4'
        option src '192.168.4.1/32'
        option lookup '170'

config route 'lm_net_anygw_route4'
        option interface 'lm_net_br_lan_anygw_if'
        option target '192.168.4.0'
        option netmask '255.255.252.0'
        option table '170'

config device 'lm_net_eth2_babeld_dev'
        option type 'eth3'
        option name 'eth2_17'
        option ifname 'eth2'
        option vid '17'
        option mtu '1496'

config interface 'lm_net_eth2_babeld_if'
        option proto 'static'
        option auto '1'
        option device 'eth2_17'
        option ipaddr '192.168.4.254'
        option netmask '255.255.255.255'


config device 'lm_net_eth4_babeld_dev'
        option type 'eth3'
        option name 'eth4_17'
        option ifname 'eth4'
        option vid '17'
        option mtu '1496'

config interface 'lm_net_eth4_babeld_if'
        option proto 'static'
        option auto '1'
        option device 'eth4_17'
        option ipaddr '192.168.4.254'
        option netmask '255.255.255.255'

config device 'lm_net_eth3_babeld_dev'
        option type 'eth3'
        option name 'eth3_17'
        option ifname 'eth3'
        option vid '17'
        option mtu '1496'

config interface 'lm_net_eth3_babeld_if'
        option proto 'static'
        option auto '1'
        option device 'eth3_17'
        option ipaddr '192.168.4.254'
        option netmask '255.255.255.255'

config device 'lm_net_eth0_babeld_dev'
        option type 'eth3'
        option name 'eth0_17'
        option ifname 'eth0'
        option vid '17'
        option mtu '1496'

config interface 'lm_net_eth0_babeld_if'
        option proto 'static'
        option auto '1'
        option device 'eth0_17'
        option ipaddr '192.168.4.254'
        option netmask '255.255.255.255'

config device 'lm_net_eth1_babeld_dev'
        option type 'eth3'
        option name 'eth1_17'
        option ifname 'eth1'
        option vid '17'
        option mtu '1496'

config interface 'lm_net_eth1_babeld_if'
        option proto 'static'
        option auto '1'
        option device 'eth1_17'
        option ipaddr '192.168.4.254'
        option netmask '255.255.255.255'

As I mentioned before, thank you for your time and I apologize for any inconvenience. Forums and communities like this are my only hope at this point, because I feel like I'm stuck in an endless loop with AI tools—making constant edits to lime-defaults, lime-node, and network that lead nowhere.

If nothing can be done with GNS you could might add jitter and packet loss with tc on the OpenWrt interfaces to simulate wireless? Just a shoot in the dark....

Do you mean libremesh cant works running batmanadv and babeld protocols by wired connection??

No. As far as I'm aware of both protocols, babel as a layer3 protocol, and batman adv as a 2.5 layer brouting (bridging and routing) protocol are media type aware or can be configured to do so.

Just in case. To bridge layer 2 domains over a layer 3 backbone, someone would probably look into evpn and vxlan these days...

Or use babel for the wireless and Ethernet backbone and evpn instead of batman. Just thinking out loud here.... Olsr2 would be nice if there would be an active project around :frowning:

For babel please use bird3 because bird is since years the successor of the reference implementation. Just in case your text books have gotten old...

Feel free to drop off questions regarding routing and design. But I will be no help with wireless specifics.

I’d keep the lab split into two checks: first prove the L3/routing part works over plain wired links, then add the wireless-ish problems later with tc/netem if you need to test loss/latency. Also be careful with DHCP on every user node unless each one is a separate downstream segment; otherwise it can make debugging look like a routing problem when it is really two servers answering on the same L2 side.

The main problem I'm having right now is that I'm trying to remove eth2 and eth3, where babeld is running, from br-lan.
I can do it using some brctl commands, but as soon as I run lime-config or reboot the system and execute lime-config, my configuration is lost because lime-defaults regenerates the network configuration before introducing eth2 and eth3 indise br-lan again.
I don't know how to keep those interfaces separated from br-lan from lime-defaults file. That's the point where I am right now and (I think) the main problem.

I would not try to preserve the brctl changes; LibreMesh will regenerate /etc/config/network, so those edits are only a symptom check. In the generated network you pasted, br-lan has eth4 and eth0, not eth2/eth3, but the generated babel VLAN interfaces appear for several ports. I’d first run uci show lime.network | grep protocols and compare it with /etc/config/network immediately after a clean lime-config. If eth2/eth3 are still being added to LAN there, look for another lime-defaults fragment or node config adding lan:*/all-ethernet behaviour, rather than fixing it after boot.

To remove the two eth2 and eth3 from br-lan just create two interface specific sections in the lime-node like in https://libremesh.org/reference/network/interface-specific.html#mesh-only-port . Following your previously posted lime-node it should be:

config net port2
    option linux_name 'eth2'
    list protocols 'babeld:17'

config net port3
    option linux_name 'eth3'
    list protocols 'babeld:17'