![使用 OpenWrt 设置 WiFi 网络](https://linux22.com/image/1447697/%E4%BD%BF%E7%94%A8%20OpenWrt%20%E8%AE%BE%E7%BD%AE%20WiFi%20%E7%BD%91%E7%BB%9C.png)
我有带有OpenWrt的路由器MR3020。
我需要wifi 网络可从另一个网络访问路由器的管理面板和互联网。
我有另一个网络“BigWifi”(不是我的),我将路由器连接到它。BigWifi 本身会向客户端提供 IP,因此我只需通过 LAN(RJ-45)连接路由器即可。如果将路由器设置为桥接(WAN 和 LAN 桥接),互联网可以正常工作,但无法访问管理面板,我的 IP 位于 BigWifi 网络的子网中。如果我删除此桥接器(WAN 和 LAN 未桥接)——我可以访问面板,我的 IP 位于我的 WiFi 网络子网中,但无法访问互联网。我应该如何配置我的路由器才能同时访问互联网和路由器的管理面板?
我已阅读有关路由的信息,但它对我没有帮助。
我的文件:
在/etc/config/网络:
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
option ifname 'eth0'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
config interface 'wifi'
option proto 'static'
option ipaddr '192.168.2.1'
option netmask '255.255.255.0'
在/etc/config/无线:
config wifi-device radio0
option type mac80211
option channel 11
option macaddr c4:6e:1f:c7:b6:62
option hwmode 11ng
option htmode HT20
list ht_capab SHORT-GI-20
list ht_capab SHORT-GI-40
list ht_capab RX-STBC1
list ht_capab DSSS_CCK-40
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 0
config wifi-iface
option device radio0
option network wifi
option mode ap
option ssid OpenWrt
option encryption none
在/etc/config/防火墙:
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'wan'
option output 'ACCEPT'
option masq '1'
option mtu_fix '1'
option input 'ACCEPT'
option forward 'REJECT'
option network ' '
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-DHCPv6'
option src 'wan'
option proto 'udp'
option src_ip 'fe80::/10'
option src_port '547'
option dest_ip 'fe80::/10'
option dest_port '546'
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 include
option path '/etc/firewall.user'
config zone
option input 'ACCEPT'
option forward 'REJECT'
option network ' '
option output 'ACCEPT'
option name 'lan'
option masq '1'
option mtu_fix '1'
config forwarding
option dest 'wan'
option src 'lan'
在/etc/config/dhcp:
config dnsmasq
option domainneeded 1
option boguspriv 1
option filterwin2k 0 # enable for dial on demand
option localise_queries 1
option rebind_protection 1 # disable if upstream must serve RFC1918 addresses
option rebind_localhost 1 # enable for RBL checking and similar services
#list rebind_domain example.lan # whitelist RFC1918 responses for domains
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.auto'
#list server '/mycompany.local/1.2.3.4'
#option nonwildcard 1
#list interface br-lan
#list notinterface lo
#list bogusnxdomain '64.94.110.11'
config dhcp lan
option interface lan
option start 100
option limit 150
option leasetime 12h
config dhcp wan
option interface wan
option ignore 1
config dhcp wifi
option interface wifi
option start 100
option limit 150
option leasetime 12h