Jump to content

Multiple USB network adapters using same UCI intf name/ config


Recommended Posts

I have my NANO successfully configured to use both a USB Wi-Fi dongle (wlan2) and a USB Ethernet adapter (eth1), however I would like to create a interface definition in /etc/config/network that would allow both to share configuration parameters (and, by extension, firewall rules). The OpenWRT Wiki provides some guidance for configuring multiple network settings for a single physical device but I can't seem to work out how to do the opposite: single network/ firewall configuration regardless of which physical device is connected to the USB port. Of course, it's possible to duplicate the configuration for each interface, but the simplicity/ consistency of a single setup for whichever "WAN" interface happens to be connected is preferable. Any thoughts?

Link to comment
Share on other sites

What "parameters" do you mean ?


allow both to share configuration parameters

Like a Loadbalancer for a WAN Interface ?


configuring multiple network settings for a single physical

Sorry but i´m confused what you exactly mean....

Link to comment
Share on other sites

Not looking to create a bridge, insofar as only one of the interfaces in question will ever be connected at a time.

/etc/config/wireless contains:

config wifi-iface
	option device 'radio2'
	option ifname 'wlan2'
	option mode 'sta'
	option network 'wan'

Which associates the wlan2 interface w/ the WAN config block in /etc/config/network:

config interface 'wan'
	option proto	'dhcp'
	option dns	','

And, perhaps more importantly, w/ the WAN zone of the firewall and its related rules. In a perfect world, I would like to have the WAN settings from /etc/config/network and /etc/config/firewall applied to both the USB WLAN interface or the USB Ethernet, regardless of which is connected. However, if I add

option ifname	'eth1'

to the config interface 'wan' section /etc/config/network, those settings will no longer be applied to the WLAN interface. The ultimate goal is to have a single config block in /etc/config/network and /etc/config/network cover the settings for both interfaces.

Link to comment
Share on other sites

Upon closer inspection, it appears that /etc/config/firewall allows for multiple networks to be added to a zone:

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

I mistakenly thought that the zone name was directly linked to the logical network name and, therefore, a new interface would require creation of a new zone. Glad to be wrong about that.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...