22.03.3: Local DHCP is not working when have 2 LAN Interfaces

I am using a OpenWrt device with PPPoE and MAP-E connections.
and I want usually communicate via MAP-E(+IPv6), and PPPoE(IPv4 Only) for like VPN servers.
(my MAP-E connection is fast and stable. but have port limits, and PPPoE connection is slowly.)

so I tried make two LAN interfaces with DHCP, but be after two LAN interfaces, both DHCPs are not given IPv4 local IP addresses. (when have single LAN interface, DHCP is working.)

Please let me know if there is a good solution.

I'm sorry if anything wrong English in Here.

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/wireless
cat /etc/config/dhcp
cat /etc/config/firewall
2 Likes

Thank you for your help

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 packet_steering '1'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth1.1'

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

config interface 'wan'
	option device 'eth0.2'
	option proto 'pppoe'
	option username ‘pppoe@id’
	option password ‘password’
	option ipv6 'auto'
	option peerdns '0'
	option dns '127.0.0.1'

config interface 'wan6'
	option device 'eth0.2'
	option proto 'dhcpv6'
	option reqaddress 'try'
	option reqprefix 'auto'
	option peerdns '0'
	option dns '0::1'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '1 2 3 4 6t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '5 0t'

config interface 'ra'
	option proto 'static'
	option device '@wan6'
	list ip6addr '2400:~’
	option ip6gw '2400:~’
	option ip6prefix '2400:~’

config interface 'map'
	option proto 'map'
	option maptype 'map-e'
	option peeraddr '2001:~’
	option ipaddr '153.~’
	option ip4prefixlen '20'
	option ip6prefix '2400:~’
	option ip6prefixlen '38'
	option ealen '18'
	option psidlen '6'
	option offset '6'
	option legacymap '1'
	option peerdns '0'
	option dns '127.0.0.1'

config interface 'v4lan'
	option proto 'static'
	option device 'br-lan'
	option ipaddr '192.168.2.1'
	option delegate '0'

config rule
	option in 'v4lan'
	option out 'wan'
	option lookup '200'

config rule
	option in 'lan'
	option lookup 'main'

cat /etc/config/wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0'
	option channel '36'
	option band '5g'
	option htmode 'VHT80'
	option txpower ’10'
	option country 'JP'
	option cell_density '1'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid ‘OpenWrt_5G’
	option multicast_to_unicast '1'
	option ifname 'wlan56'
	option disassoc_low_ack '0'
	option encryption 'sae-mixed'
	option key ‘password’
	option wpa_disable_eapol_key_retries '1'

config wifi-device 'radio1'
	option type 'mac80211'
	option path 'soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0'
	option channel '1'
	option band '2g'
	option htmode 'HT40'
	option txpower ’10'
	option country 'JP'
	option cell_density '1'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option ssid ‘OpenWrt_2G'
	option multicast_to_unicast '1'
	option ifname 'wlan26'
	option disassoc_low_ack '0'
	option encryption 'sae-mixed'
	option key ‘password’
	option wpa_disable_eapol_key_retries '1'

config wifi-iface 'wifinet2'
	option device 'radio0'
	option mode 'ap'
	option ssid ‘OpenWrt_5Gv4'
	option encryption 'sae-mixed'
	option multicast_to_unicast '1'
	option ifname 'wlan54'
	option disassoc_low_ack '0'
	option key ‘password’
	option wpa_disable_eapol_key_retries '1'
	option network 'v4lan'

config wifi-iface 'wifinet3'
	option device 'radio1'
	option mode 'ap'
	option ssid ‘OpenWrt_2Gv4'
	option multicast_to_unicast '1'
	option ifname 'wlan24'
	option disassoc_low_ack '0'
	option encryption 'sae-mixed'
	option key ‘password’
	option wpa_disable_eapol_key_retries '1'
	option network 'v4lan'

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'
	option noresolv '1'
	option dnssec '1'
	option dnsseccheckunsigned '1'
	list server '127.0.0.1#5453'
	list server '0::1#5453'
	list server ‘(DNS settings for domestic, company, NTP etc.)’

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'relay'
	option ndp 'relay'

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 'wan6'
	option interface 'wan6'
	option ignore '1'
	option master '1'
	option ra 'relay'
	option dhcpv6 'relay'
	option ndp 'relay'

config dhcp 'v4lan'
	option interface 'v4lan'
	option start '100'
	option limit '150'
	option leasetime '12h'

cat /etc/config/firewall

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

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

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

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 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 zone
	option name 'v4lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	list network 'v4lan'

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

config forwarding
	option src 'v4lan'
	option dest 'v4wan'

The issue is that you are connecting v4lan to br-lan -- this basically creates a situation where both the standard lan and v4lan are connected to each other -- there is no separation.

What is your goal here? Do you want to set v4lan on a separate SSID? Do you want it on ethernet ports? If ethernet, do you want to have some of the ports dedicated to the lan and others dedicated to the v4lan? Or, do you want to trunk them together (for this to work, the device downstream must be VLAN aware -- a managed switch or a VLAN aware computer/device is required here)?

1 Like

What my goal is...

  1. use the PPPoE connection If SSID characters ending in v4
  2. use the PPPoE connection for Server (VPN and others) on OpenWrt
  3. I want the specified Ethernet port (or MAC address) to connect over the specified WAN.

You will need to install policy based routing or mwan3 to direct specific traffic to each of the effective WANs. That will handle that part of the equation.

Which ethernet port are you trying to use for this purpose? Currently, all ethernet ports are configured for a single network (the lan), so if you want to use one or more of them for your secondary network, we will need to specify the port(s) appropriately.

Thanks! I will look into how to make the policies for mwan3 and how to set the routes.
It is good study for me.

and This is my plan for how to use Physical Ports

WAN(Single Port) → OpenWrt Router →
(LAN 1/MAP-E) Switching hub → Normal Devices
(LAN 2/MAP-E) Switching hub → Normal Devices
(LAN 3/PPPoE) Switching hub → TV streaming box, Gaming Devices
(LAN 4/PPPoE) Web Sever

Based on your described ethernet connections, it sounds like you'll want two ethernet ports for each network. So, you'll do something like this

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth1.1'

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

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '1 2 6t'

config switch_vlan
	option device 'switch0'
	option vlan '3'
	option ports '3 4 6t'

config device
	option name 'br-lan2'
	option type 'bridge'
	list ports 'eth1.3'


config interface 'lan2'
	option device 'br-lan2'
	option proto 'static'
	option ipaddr '192.168.2.1'
	option netmask '255.255.255.0'

You'll also want to setup a DHCP server for lan2, connect it with an SSID, and (probably) create a new firewall zone for lan2 (although you could use the lan firewall zone if you want).

1 Like

Thank you very much!

It's are nice solution. In addition to this it, I could write routing and tables and firewall settings.
so Working PERFECTLY!

I've been lost for a month to try work it, but you solved just for some times.
My knowledge is so limited, but also because there was no information available when I searched for it in the languages I know.

Have a good time!

Awesome! Glad I was able to help you solve the issues!

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