Hello everyone,
I'm trying to configure my network on Flint 2 with non-vendor vanilla OpenWrt 25.12.2 r32802-f505120278 installed.
I SSH into the router via a PC wired to LAN1 port of the router.
In principle, here is what I am trying achieve (minus the Wi-Fi setup):
| VLAN ID | VLAN name | Subnet | VLANs it can talk to | Has internet access? |
|---|---|---|---|---|
| 10 | Management | 10.10.10.0/24 | All | Yes |
| 20 | Trusted | 10.10.20.0/24 | Media | Yes |
| 30 | Guest | 10.10.30.0/24 | None | Yes |
| 40 | Media | 10.10.40.0/24 | None | Yes |
| 50 | IoT | 10.10.50.0/24 | None | No |
| 60 | Surveillance | 10.10.60.0/24 | None | No |
The problem is that after running the commands (below), disconnecting and reconnecting the PC to LAN1, my PC does not receive an IPv4 address (only IPv6), cannot reach the internet nor the router itself. Connecting the PC to other ports of the router seems to work as intended.
What could be the problem? Also, do you have any tips or comments on how I could improve the setup script?
Here are the commands I run:
# Bridge configuration
uci set network.@device[0].name='br-lan'
uci set network.@device[0].type='bridge'
uci set network.@device[0].vlan_filtering='1'
# VLAN setup
uci set network.vlan10=bridge-vlan
uci set network.vlan10.device='br-lan'
uci set network.vlan10.vlan='10'
uci set network.vlan10.ports='lan1:u*'
uci set network.vlan20=bridge-vlan
uci set network.vlan20.device='br-lan'
uci set network.vlan20.vlan='20'
uci set network.vlan20.ports='lan2:u* lan3:u* lan4:u*'
uci set network.vlan30=bridge-vlan
uci set network.vlan30.device='br-lan'
uci set network.vlan30.vlan='30'
uci set network.vlan40=bridge-vlan
uci set network.vlan40.device='br-lan'
uci set network.vlan40.vlan='40'
uci set network.vlan40.ports='lan5:u*'
uci set network.vlan50=bridge-vlan
uci set network.vlan50.device='br-lan'
uci set network.vlan50.vlan='50'
uci set network.vlan60=bridge-vlan
uci set network.vlan60.device='br-lan'
uci set network.vlan60.vlan='60'
# VLAN interfaces
uci set network.lan.device='br-lan.10'
uci set network.lan.proto='static'
uci set network.lan.ipaddr='10.10.10.1'
uci set network.lan.netmask='255.255.255.0'
uci set network.trusted=interface
uci set network.trusted.device='br-lan.20'
uci set network.trusted.proto='static'
uci set network.trusted.ipaddr='10.10.20.1'
uci set network.trusted.netmask='255.255.255.0'
uci set network.guest=interface
uci set network.guest.device='br-lan.30'
uci set network.guest.proto='static'
uci set network.guest.ipaddr='10.10.30.1'
uci set network.guest.netmask='255.255.255.0'
uci set network.media=interface
uci set network.media.device='br-lan.40'
uci set network.media.proto='static'
uci set network.media.ipaddr='10.10.40.1'
uci set network.media.netmask='255.255.255.0'
uci set network.iot=interface
uci set network.iot.device='br-lan.50'
uci set network.iot.proto='static'
uci set network.iot.ipaddr='10.10.50.1'
uci set network.iot.netmask='255.255.255.0'
uci set network.surveillance=interface
uci set network.surveillance.device='br-lan.60'
uci set network.surveillance.proto='static'
uci set network.surveillance.ipaddr='10.10.60.1'
uci set network.surveillance.netmask='255.255.255.0'
# DHCP
uci set dhcp.lan=dhcp
uci set dhcp.lan.interface='lan'
uci set dhcp.lan.start='100'
uci set dhcp.lan.limit='150'
uci set dhcp.lan.leasetime='12h'
uci set dhcp.trusted=dhcp
uci set dhcp.trusted.interface='trusted'
uci set dhcp.trusted.start='100'
uci set dhcp.trusted.limit='150'
uci set dhcp.trusted.leasetime='12h'
uci set dhcp.guest=dhcp
uci set dhcp.guest.interface='guest'
uci set dhcp.guest.start='100'
uci set dhcp.guest.limit='150'
uci set dhcp.guest.leasetime='12h'
uci set dhcp.media=dhcp
uci set dhcp.media.interface='media'
uci set dhcp.media.start='100'
uci set dhcp.media.limit='150'
uci set dhcp.media.leasetime='12h'
uci set dhcp.iot=dhcp
uci set dhcp.iot.interface='iot'
uci set dhcp.iot.start='100'
uci set dhcp.iot.limit='150'
uci set dhcp.iot.leasetime='12h'
uci set dhcp.surveillance=dhcp
uci set dhcp.surveillance.interface='surveillance'
uci set dhcp.surveillance.start='100'
uci set dhcp.surveillance.limit='150'
uci set dhcp.surveillance.leasetime='12h'
# Firewall zones
uci set firewall.@zone[0].name='lan'
uci set firewall.@zone[0].input='ACCEPT'
uci set firewall.@zone[0].output='ACCEPT'
uci set firewall.@zone[0].forward='ACCEPT'
uci add firewall zone
uci set firewall.@zone[-1].name='trusted'
uci set firewall.@zone[-1].input='REJECT'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='REJECT'
uci add_list firewall.@zone[-1].network='trusted'
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='trusted'
uci set firewall.@forwarding[-1].dest='wan'
uci add firewall zone
uci set firewall.@zone[-1].name='guest'
uci set firewall.@zone[-1].input='REJECT'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='REJECT'
uci add_list firewall.@zone[-1].network='guest'
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='guest'
uci set firewall.@forwarding[-1].dest='wan'
uci add firewall zone
uci set firewall.@zone[-1].name='media'
uci set firewall.@zone[-1].input='REJECT'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='REJECT'
uci add_list firewall.@zone[-1].network='media'
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='media'
uci set firewall.@forwarding[-1].dest='wan'
uci add firewall zone
uci set firewall.@zone[-1].name='iot'
uci set firewall.@zone[-1].input='REJECT'
uci set firewall.@zone[-1].output='REJECT'
uci set firewall.@zone[-1].forward='REJECT'
uci add_list firewall.@zone[-1].network='iot'
uci add firewall zone
uci set firewall.@zone[-1].name='surveillance'
uci set firewall.@zone[-1].input='REJECT'
uci set firewall.@zone[-1].output='REJECT'
uci set firewall.@zone[-1].forward='REJECT'
uci add_list firewall.@zone[-1].network='surveillance'
# Inter-VLAN communication
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='lan'
uci set firewall.@forwarding[-1].dest='trusted'
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='lan'
uci set firewall.@forwarding[-1].dest='guest'
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='lan'
uci set firewall.@forwarding[-1].dest='media'
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='lan'
uci set firewall.@forwarding[-1].dest='iot'
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='lan'
uci set firewall.@forwarding[-1].dest='surveillance'
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='trusted'
uci set firewall.@forwarding[-1].dest='media'
# Firewall rules
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-DHCP-DNS-Trusted'
uci set firewall.@rule[-1].src='trusted'
uci set firewall.@rule[-1].proto='tcp udp'
uci set firewall.@rule[-1].dest_port='53 67 68'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-Ping-Trusted'
uci set firewall.@rule[-1].src='trusted'
uci set firewall.@rule[-1].proto='icmp'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-DHCP-DNS-Guest'
uci set firewall.@rule[-1].src='guest'
uci set firewall.@rule[-1].proto='tcp udp'
uci set firewall.@rule[-1].dest_port='53 67 68'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-Ping-Guest'
uci set firewall.@rule[-1].src='guest'
uci set firewall.@rule[-1].proto='icmp'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-DHCP-DNS-Media'
uci set firewall.@rule[-1].src='media'
uci set firewall.@rule[-1].proto='tcp udp'
uci set firewall.@rule[-1].dest_port='53 67 68'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-Ping-Media'
uci set firewall.@rule[-1].src='media'
uci set firewall.@rule[-1].proto='icmp'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-DHCP-DNS-IoT'
uci set firewall.@rule[-1].src='iot'
uci set firewall.@rule[-1].proto='tcp udp'
uci set firewall.@rule[-1].dest_port='53 67 68'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-Ping-IoT'
uci set firewall.@rule[-1].src='iot'
uci set firewall.@rule[-1].proto='icmp'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-DHCP-DNS-Surveillance'
uci set firewall.@rule[-1].src='surveillance'
uci set firewall.@rule[-1].proto='tcp udp'
uci set firewall.@rule[-1].dest_port='53 67 68'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-Ping-Surveillance'
uci set firewall.@rule[-1].src='surveillance'
uci set firewall.@rule[-1].proto='icmp'
uci set firewall.@rule[-1].target='ACCEPT'
# Apply
uci commit
reboot