Make Ethernet device use IOT interface

Those are not the same -- note that in the upper screenshot, knoxpi resolves to an IPv6 address, while on the IoT network it is just IPv4.

If you're not actually using IPv6, disable it in your LAN DHCP configuration.
If you want IPv6 on your IoT network, enable it there.

If you need IPv6 on your LAN and not on the IoT network, you can probably fix the DNS entry for your pi (by manually setting it) so that it always resolves with the IPv4 address.

1 Like

Ah ok! That makes alot of sense, I don't tend to use IPv6 so it never even crossed my mind. How do I go about enabling it exactly?

You mean disabling it?

remove this:

No I meant enable it for the IOT interface, not disabling it for the lan interface (as I'm not real sure if anything on the lan interface depends on it, so I don't want to mess with the lan interface)

In that case, you'll add that same line to the DHCP config for the IoT network.

1 Like

Sadly, this didn't fix the issue :frowning:

config dhcp 'IOT'
        option interface 'IOT'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv6 'server'
        option ra 'server'
        list ra_flags 'managed-config'

config interface 'IOT'
        option proto 'static'
        option ipaddr '192.168.4.1'
        option netmask '255.255.255.0'
        option device 'br-iot'
        option ip6assign '64'

TBH, IPv6 is not one of my areas of expertise. I'm not sure the best way to solve the issue if my basic recommendations didn't work.

You may simply want to add in a manual DNS entry into your configuration so that you only get the IPv4 addresses when the hostname is used.

1 Like

I tried adding a static route to it and it still not working sadly (which is really bad because that means I can't set a static IP to the device).. im not sure what's going on with it

A static route is not what you want.

You might want to setup a static lease (aka DHCP reservation) -- For most practical purposes, this has a similar effect to manually setting a static IP on a device, but with the simplicity of keeping the device setup as a DHCP client on the network. And when you do this, IIRC, it will also create the appropriate DNS entries.

Or, you want to set a DNS entry (which simply maps the hostname to the IP address).

But a static route is something entirely different and not necessary for your configuration.

I have no idea what's going on.. I've tried adding a static lease and it still won't change the IP address, and still can't get the hostname to point to the device. And now I have a bunch of duplicate DHCP entries in OpenWRT. I ended up having to set the static ip on the pi itself and not on the router

You'd need to force the Pi to renew its lease -- otherwise it will hold onto the existing lease until it expires.

The DHCP leases in the router will be flushed eventually, or can be cleared easily by simply rebooting your router since they are only stored in RAM (this won't affect static leases).

AH! I rebooted the router and now it's all working again, got the DHCP server setting the IP4 address.. still unsure how to set the IP6 address however :thinking:
Thanks for the help!

You might open a new thread specifically for that issue. That might help get the right eyes on the problem.

Meanwhile, wrt this thread…

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

1 Like

Final Config of solution!

{
        "kernel": "5.4.179",
        "hostname": "ArcherA7",
        "system": "Qualcomm Atheros QCA956X ver 1 rev 0",
        "model": "TP-Link Archer A7 v5",
        "board_name": "tplink,archer-a7-v5",
        "release": {
                "distribution": "OpenWrt",
                "version": "21.02.2",
                "revision": "r16495-bf0c965af0",
                "target": "ath79/generic",
                "description": "OpenWrt 21.02.2 r16495-bf0c965af0"
        }
}
package dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option localservice '1'
        option ednspacket_max '1232'
        option rebind_protection '1'
        option rebind_localhost '1'
        list rebind_domain 'example.local'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

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 'GUEST'
        option interface 'GUEST'
        option start '100'
        option limit '150'
        option leasetime '12h'
        list ra_flags 'none'

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

package 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 'fd7d:f549:f969::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0.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 device
        option name 'eth0.2'
        option macaddr '98:da:c4:7c:0d:24'

config interface 'wan'
        option device 'eth0.2'
        option proto 'dhcp'

config interface 'wan6'
        option device 'eth0.2'
        option proto 'dhcpv6'

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

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

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0t 1'
        option vid '2'

config interface 'GUEST'
        option proto 'static'
        option ipaddr '10.20.60.20'
        option netmask '255.255.255.0'

config interface 'IOT'
        option proto 'static'
        option ipaddr '192.168.4.1'
        option netmask '255.255.255.0'
        option device 'br-iot'
        option ip6assign '64'

config device
        option type 'bridge'
        option name 'br-iot'
        list ports 'eth0.3'

config switch_vlan
        option device 'switch0'
        option vlan '3'
        option vid '3'
        option description 'RaspberryPi'
        option ports '0t 5'

package firewall

config defaults
        option input 'ACCEPT'
        option output 'ACCEPT'
        option synflood_protect '1'
        option forward 'DROP'
        option drop_invalid '1'

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

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

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 src_ip 'fc00::/6'
        option dest_ip 'fc00::/6'
        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 rule
        option name 'Support-UDP-Traceroute'
        option src 'wan'
        option dest_port '33434:33689'
        option proto 'udp'
        option family 'ipv4'
        option target 'REJECT'
        option enabled '0'

config include
        option path '/etc/firewall.user'

config zone
        option name 'GuestZone'
        option output 'ACCEPT'
        option forward 'DROP'
        option input 'DROP'
        list network 'GUEST'

config zone
        option name 'IOTZone'
        option output 'ACCEPT'
        option forward 'DROP'
        option input 'DROP'
        list network 'IOT'
        option masq '1'
        list device 'eth0.3'

config forwarding
        option src 'GuestZone'
        option dest 'wan'

config forwarding
        option src 'IOTZone'
        option dest 'wan'

config rule
        option name 'Guest DHCP and DNS'
        option src 'GuestZone'
        option dest_port '53 67 68'
        option target 'ACCEPT'

config rule
        option name 'IOT DHCP and DNS'
        option src 'IOTZone'
        option dest_port '53 67 68'
        option target 'ACCEPT'

config forwarding
        option src 'lan'
        option dest 'IOTZone'

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