Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:network:wifi:guestwifi:configuration [2020/10/06 03:42] – obsolete proto=tcpudp to avoid luci-specific compatibility issues: https://forum.openwrt.org/t/is-tcpudp-a-valid-protocol-name/76048 vgaeteradocs:guide-user:network:wifi:guestwifi:configuration_command_line_interface [2023/10/15 20:23] – [Step by step] consider netmask redundant on OpenWrt 23.05.0 as tcpdump capture reveals "Subnet-Mask (1), length 4: 255.255.255.0" in the DHCP Offer and ACK messages no matter which one was requested by the client vgaetera
Line 1: Line 1:
-====== Guest WLAN using CLI ====== +====== Guest Wi-Fi using CLI ====== 
-See also: [[docs:guide-user:network:wifi:guestwifi:extra|Guest WLAN extras]]+See also: [[docs:guide-user:network:wifi:guestwifi:extras|Guest Wi-Fi extras]]
  
 This page provides a script that creates an additional separated guest network and a new guest firewall zone for your OpenWrt device. This page provides a script that creates an additional separated guest network and a new guest firewall zone for your OpenWrt device.
Line 13: Line 13:
 # Configuration parameters # Configuration parameters
 NET_ID="guest" NET_ID="guest"
-WIFI_DEV="$(uci get wireless.@wifi-iface[0].device)"+WIFI_DEV="$(uci -q get wireless.@wifi-iface[0].device)"
  
 # Fetch upstream zone # Fetch upstream zone
Line 19: Line 19:
 network_flush_cache network_flush_cache
 network_find_wan NET_IF network_find_wan NET_IF
-FW_WAN="$(fw3 -q network "${NET_IF}")"+FW_WAN="$(fw4 -q network ${NET_IF})"
  
 # Set up guest WLAN # Set up guest WLAN
 uci -q batch << EOF uci -q batch << EOF
 +delete network.${NET_ID}_dev
 +set network.${NET_ID}_dev=device
 +set network.${NET_ID}_dev.type=bridge
 +set network.${NET_ID}_dev.name=br-${NET_ID}
 delete network.${NET_ID} delete network.${NET_ID}
 set network.${NET_ID}=interface set network.${NET_ID}=interface
 set network.${NET_ID}.proto=static set network.${NET_ID}.proto=static
-set network.${NET_ID}.ipaddr=192.168.3.1 +set network.${NET_ID}.device=br-${NET_ID} 
-set network.${NET_ID}.netmask=255.255.255.0+set network.${NET_ID}.ipaddr=192.168.3.1/24
 commit network commit network
-delete wireless.guest+delete wireless.${NET_ID}
 set wireless.${NET_ID}=wifi-iface set wireless.${NET_ID}=wifi-iface
 set wireless.${NET_ID}.device=${WIFI_DEV} set wireless.${NET_ID}.device=${WIFI_DEV}
Line 69: Line 73:
 set firewall.${NET_ID}_dhcp.dest_port=67 set firewall.${NET_ID}_dhcp.dest_port=67
 set firewall.${NET_ID}_dhcp.proto=udp set firewall.${NET_ID}_dhcp.proto=udp
 +set firewall.${NET_ID}_dhcp.family=ipv4
 set firewall.${NET_ID}_dhcp.target=ACCEPT set firewall.${NET_ID}_dhcp.target=ACCEPT
 commit firewall commit firewall
 EOF EOF
-/etc/init.d/network reload +service network reload 
-/etc/init.d/dnsmasq restart +service dnsmasq restart 
-/etc/init.d/firewall restart+service firewall restart
 </code> </code>
  
  • Last modified: 2024/05/28 00:54
  • by stokito