DHCP not working on network device

Hello,

I have created a new Network device for a router port (lan4) and bound it to a new static interface. I have set DHCP but when I attach my pc to that port it doesn't receive the ip address. Setting it manually works.

Following my config files:

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 ula_prefix 'fd0d:d7fd:c648::/48'

config device
        option name 'wan'
        option macaddr '62:38:e0:d6:4d:10'

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

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'

config device
        option name 'lan4'

config interface 'direct'
        option proto 'static'
        option device 'lan4'
        option ipaddr '172.16.0.1'
        option netmask '255.255.255.0'

dhcp:

config dnsmasq 'direct_dns'
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/direct/'
        option domain 'direct'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases.direct'
        option resolvfile '/etc/resolv.conf.direct'
        option nonwildcard '1'
        list interface 'direct'
        list notinterface 'loopback'

config dhcp 'direct'
        option instance 'direct_dns'
        option interface 'direct'
        option start '100'
        option limit '150'
        option leasetime '1h'
        option force '1'

firewall:

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

config zone
        option name 'direct'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        list network 'direct'

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

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'

What am I missing?

Thanks in advance,
HL

Did you try restarting the network service?

In luci - System => Startup => scroll down to Network and click restart

In shell - /etc/init.d/network restart

Also - is your router using swconfig for its switch or the newer DSA? I’ve only seen lan separation under devices when using DSA. If you’re using swconfig, you’ll need to setup vlans to separate the lan ports.

What is the device you are using as a router? The config looks incomplete unless there are only 2 network ports (wan and lan4).

please show the output of the following:

ubus call system board

And if you omitted parts of the config files, please show the entire thing (except for any private/sensitive information -- just redact that)

Yes, I restarted the network service (also restarted the router).

I'm using DSA.

Following the output:

{
        "kernel": "5.10.146",
        "hostname": "***omitted***",
        "system": "ARMv7 Processor rev 1 (v7l)",
        "model": "Linksys WRT3200ACM",
        "board_name": "linksys,wrt3200acm",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "22.03.2",
                "revision": "r19803-9a599fee93",
                "target": "mvebu/cortexa9",
                "description": "OpenWrt 22.03.2 r19803-9a599fee93"
        }
}

Did you omit parts of the config? If so, please show them. If not...

You would be best served by simply resetting the router to defaults. There isn't anything particularly complex here, and there lots of things missing. You can easily modify the main lan network to use the 172.16.0.0/24 network without any other complications. Or you can easily split the lan4 port out from the br-lan. As of now, though, there is something wrong and the defaults might be the best starting point.

Hi psherman,

No, I didn't omit parts. I have removed the br-lan because I don't need it. I am trying to configure a specific port direct connection that shoud provide an ip address to attached device. Like you said there shouldn't be nothing particurarly complex but I don't understand why it is not working.

Thanks

one thing I can think of...

change device --> option ports 'lan4'

If that doesn't work, reset to defaults and we'll get it working