wifi Openwrt development of the set ap

Topology:

Wan port access external networks or the higher router, lan wlan port and belong to a local area network;

Configuration / etc / config / wireless file

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'

Then modify / etc / config / network file

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'

Then restart the network

/etc/init.d/network restart

If you turn off the firewall test found, the wifi can not access the Internet, you need to open the firewall, add a firewall in the boot rc.local

/etc/init.d/firewall start &
exit 0

If you open the firewall or outside the network can not access, you can modify firewall rules / 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

Increase over the red part of the lan port data can be forwarded to the WAN port, but this should be the default configuration of the openwrt good, so normal firewall rules are no additional configuration;

Guess you like

Origin www.cnblogs.com/weishengzhong/p/11362762.html