一.下面配置适合qsdk的源代码设置步骤。
1、采用iwlist ath0 scan或者iwlist ath0 scanning,搜索当前无线网络,提取信道与加密模式。
如下图所:
2、 修改/etc/config/wireless 文件,添加STA网卡配置,如下所示:
config wifi-device wifi0
option type qcawifi
option channel 6
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 0
option noscan 1
option txpower 24
config wifi-iface
option device wifi0
option network lan
option mode ap
option ssid QCA9531_0027
option encryption none
config wifi-iface
option device 'wifi0'
option network 'wwan'
option mode 'sta'
option encryption 'psk2'
option ssid 'TROLink_YF'
option key '12345678'
3、修改/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 interface 'lan'
option ifname 'eth1'
option type 'bridge'
option proto 'static'
option ipaddr '10.10.18.1'
option netmask '255.255.255.0'
config interface 'wan'
option ifname 'eth0'
option proto 'dhcp'
config switch
option name 'eth1'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'eth1'
option vlan '1'
option ports '0 1 2 3 4'
config interface 'wwan'
option ifname 'ath01'
option proto 'dhcp'
4、修改/etc/config/firewall添加WWAN,如下所示:
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
option disabled '0'
config zone
option name 'lan'
option network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'wan'
option network 'wan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option masq '1'
option mtu_fix '1'
config zone
option name 'wwan'
option network 'wwan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option masq '1'
option mtu_fix '1'
config forwarding
option src 'lan'
option dest 'wwan'
5、运行:/etc/init.d/network restart && /etc/init.d/firewall restart 重启网络。
6、通过命令route查看是否成功,如下图所示:
二.下面配置适合LEDL或者openwrt的源代码设置步骤。
**************************************************************************
A.采用iwlist wlan0 scan或者iwlist wlan0 scanning,搜索当前无线网络,提取信道与加密模式。
B.修改/etc/config/wireless 文件,添加STA网卡配置,如下所示:
config wifi-device 'radio0'
option type 'mac80211'
option channel '6'
option hwmode '11g'
option path 'platform/qca953x_wmac'
option htmode 'HT40+'
option disabled '0'
option noscan '1'
config wifi-iface 'default_radio0'
option device 'radio0'
option network 'lan'
option mode 'ap'
option ssid 'QCA9531_0027'
option encryption 'none'
config wifi-iface
option device 'radio0'
option network 'wwan'
option mode 'sta'
option encryption 'psk2'
option ssid 'TROLink_YF'
option key '12345678'
C.修改/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 'fdd2:f4c2:f315::/48'
config interface 'lan'
option type 'bridge'
option ifname 'eth1'
option proto 'static'
option ipaddr '10.10.18.1'
option netmask '255.255.255.0'
option ip6assign '60'
config interface 'wan'
option ifname 'eth0'
option proto 'dhcp'
config interface 'wan6'
option ifname 'eth0'
option proto 'dhcpv6'
config switch
option name 'eth1'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'eth1'
option vlan '1'
option ports '0 1 2 3 4'
config interface wwan
option proto dhcp
D.修改/etc/config/firewall添加WWAN,如下所示:
config defaults
option syn_flood 1
option input ACCEPT
option output ACCEPT
option forward REJECT
# Uncomment this line to disable ipv6 rules
# option disable_ipv6 1
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'
list network 'wwan'
option input ACCEPT
option output ACCEPT
option forward ACCEPT
option masq 1
option mtu_fix 1
config zone
option name wwan
list network 'wwan'
list network 'wwan6'
list network 'wwan'
option input ACCEPT
option output ACCEPT
option forward ACCEPT
option masq 1
option mtu_fix 1
config forwarding
option src lan
option dest 'wwan'
E.运行:/etc/init.d/network restart && /etc/init.d/firewall restart 重启网络。
F.通过命令route查看是否成功,如下图所示:
参考网址: