标签:fir 打开 outer 外网 option 默认 def reject one
拓扑结构:
Wan口接外网或者上级router,lan口和wlan同属一个局域网;
配置/etc/config/wireless文件
config wifi-device ‘radio0‘ option type ‘mac80211‘ option path ‘platform/10300000.wmac‘ option htmode ‘HT20‘ option disabled ‘0‘ option txpower ‘0‘ option hwmode ‘11g‘ option channel ‘11‘ config wifi-iface ‘default_radio0‘ option device ‘radio0‘ option network ‘lan‘ option mode ‘ap‘ option encryption ‘none‘ option ssid ‘OpenWrt‘
接着修改/etc/config/network文件
config interface ‘loopback‘ option ifname ‘lo‘ option proto ‘static‘ option ipaddr ‘127.0.0.1‘ option netmask ‘255.0.0.0‘ config globals ‘globals‘ option ula_prefix ‘fd3d:25cc:a776::/48‘ config interface ‘wan‘ option ifname ‘eth0.1‘ option proto ‘static‘ option ipaddr ‘192.168.2.238‘ option netmask ‘255.255.255.0‘ option gateway ‘192.168.2.1‘ option dns ‘114.114.114.114‘ config device ‘wan_dev‘ option name ‘eth0.1‘ option macaddr ‘00:0c:43:06:76:2a‘ config interface ‘wan6‘ option ifname ‘eth0.1‘ option proto ‘dhcpv6‘ config interface ‘lan‘ option type ‘bridge‘ option ifname ‘eth0.2‘ option proto ‘static‘ option ipaddr ‘192.168.10.1‘ option netmask ‘255.255.255.0‘ option dns ‘114.114.114.114‘ config device ‘lan_dev‘ option name ‘eth0.2‘ option macaddr ‘00:0c:43:06:76:29‘ config switch option name ‘switch0‘ option reset ‘1‘ option enable_vlan ‘1‘ config switch_vlan option device ‘switch0‘ option vlan ‘1‘ option ports ‘0 6t‘ config switch_vlan option device ‘switch0‘ option vlan ‘2‘ option ports ‘1 2 3 4 6t‘
然后重启network
/etc/init.d/network restart
测试发现如果开机关闭防火墙,则wifi不可访问外网,需要打开防火墙,在rc.local内加入开机启动防火墙
/etc/init.d/firewall start & exit 0
如果打开防火墙后外网还是无法访问,可以修改防火墙规则 /etc/config/firewall
config zone option name lan list network ‘lan‘ option input ACCEPT option output ACCEPT option forward ACCEPT config zone option name wan list network ‘wan‘ list network ‘wan6‘ option input REJECT option output ACCEPT option forward REJECT option masq 1 option mtu_fix 1 config forwarding option src lan option dest wan
增加以上红色部分,使lan口数据可以转发到WAN口,不过这项在openwrt应该是默认配置好的,所以正常情况防火墙规则是不需要另外配置的;
标签:fir 打开 outer 外网 option 默认 def reject one
原文地址:https://www.cnblogs.com/weishengzhong/p/11362762.html