Pi 3B+: Trying to add an USB network card as second "LAN port"

This system is in my car. I have these interfaces:

  1. The Pi's internal wifi is set up as a client for my home or cabin network, to connect there whenever I'm at home or at my cabin, so when the car is parked there that's WAN.

  2. A 4G modem is set up as WAN when the car's not at home.

  3. The Pi's LAN port is connected to a Pi 4 which runs Home Assistant, media player software, Node-RED and a few other things, and which also functions as the car's wifi router by using it's own internal network.

Then I have an ESP-32 set up as ESPresense, which senses if my or my wife's phone or keys (they have a BLE beacon attached to them) comes within range and unlocks the car automatically. I have the MQTT on that connected to a broker installed on OpenWrt, but it's running via the Pi 4. I want it to connect directly to the OpenWrt Pi broker instead.

So I have attached an Edimax miniature wifi dongle and then installed kmod-rtl8192cu drivers. The dongle works, I can connect to it with my PC. But I don't get an IP address, and even setting a static address on the PC doesn't help me ping the OpenWrt LAN (192.168.5.1). Here's the configurations, first wireless:

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'platform/soc/3f300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1'
	option channel '36'
	option band '5g'
	option htmode 'VHT80'
	option cell_density '0'

config wifi-iface 'wifinet0'
	option device 'radio0'
	option mode 'sta'
	option network 'CLIENT NAME'
	option ssid 'CLIENT SSD'
	option encryption 'psk2'
	option key 'CLIENT KEY'

config wifi-device 'radio1'
	option type 'mac80211'
	option path 'platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0'
	option channel '1'
	option band '2g'
	option htmode 'HT20'
	option country 'NO'
	option cell_density '0'
	option distance '1'
	option legacy_rates '1'
	option txpower '5'

config wifi-iface 'wifinet1'
	option device 'radio1'
	option mode 'ap'
	option ssid 'MQTT'
	option network 'MQTT'
	option encryption 'psk2'
	option key 'MQTT KEY'

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'
	option confdir '/tmp/dnsmasq.d'
	option serversfile '/etc/tor.jail'

config dhcp 'lan'
	option interface 'lan'
	option leasetime '12h'
	option dhcpv4 'server'
	option start '2'
	option limit '5'
	list ra_flags 'none'

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 host
	option name 'Mastiffmobilen'
	option dns '1'
	option mac 'DC:A6:32:8D:53:0F'
	option ip '192.168.5.2'

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

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'

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

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

config interface 'CLIENT SSD NAME'
	option proto 'dhcp'
	option metric '1'

config interface '4G'
	option proto 'dhcp'
	option device 'eth1'
	option metric '256'

config interface 'MQTT'
	option type 'bridge'
	option proto 'static'
	list ipaddr '192.168.5.100'
	option gateway '192.168.5.1'
	option broadcast '192.168.5.1'
	option device 'wlan1'

config device
	option name 'wlan2'
	option ipv6 '0'

I see that the option for lan and MQTT are different, lan is "br-lan" and MQTT is "bridge". But I think that's only because the lan is using a physical lan, while the MQTT is bridged to the SSD set up under Wireless. Is that correct? Can somebody please give me a hit to what I should change? The MQTT is added to the LAN zone.

I see that the MQTT network is designated "upstream" in the overview, is that correct?

Another thing that points to the same thing is that when it's running, I can't get online from the Pi 4 connected to the OpenWrt, so it seems like it's trying to use that MQTT connection as WAN, not LAN.

Solved! I had misunderstood the way it's all done! I deleted the interface and only used Wireless, where I attached it to the LAN network. So now it's working! :grin:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.