Wednesday, 8 August 2018

Tinkering OpenWRT (10) : WiFi Configuration Again

I don't know why my AS9331 board couldn't even ping 192.168.1.1 and I'm getting the following error:
        pingsendto:Network is unreachable

Step 1:

Updated my /etc/config/wireless and /etc/config/network as shown below.

/etc/config/wireless
config wifi-device 'radio0'
        option type 'mac80211'
        option hwmode '11g'
        option path 'platform/ar933x_wmac'
        option htmode 'HT40'
        #option disabled '0'   #REMOVE THIS LINE TO ENABLE WIFI:
        option channel '1'
        option txpower '30'
        option country 'US'

config wifi-iface
        option network 'wan0'
        option ssid 'FIDO_NETWORK'
        option encryption 'psk2'
        option device 'radio0'
        option mode 'sta'
        option bssid 'B8:4C:3F:F:62:68'
        option key '12345678'

config wifi-iface
        option  device  radio0
        option  network lan
        option  mode    ap
        option  ssid    OpenWrt
        option  encryption none

###############################################

/etc/config/network
config switch 'eth1'
        option reset '0'
        option enable_vlan '0'

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 proto 'static'
        option ipaddr '192.168.1.1'           # this has to be your router addr
        option netmask '255.255.255.0'

config interface 'wan0'
        option ifname 'wlan0'
        option proto 'dhcp'
        option macaddr '00:CA:01:07:23:96'  # this is the mac addr of the board (router)
        #if mac address not provided, it will take a loooong time (~10min) to connect to the wifi

config interface 'wan1'
        option ifname 'eth0'
        option proto 'dhcp'
        option ifname eth0
        option proto dhcp


Step 2:
/sbin/wifi up

#######################################################

For some reason the above stopped working anymore. There must be some problems. For example, 192.168.1.1 cannot be in lan configuration because this ipaddr indicates the ip address when this AR9931 device acts as the AP for other clients to connect. It has to be something else.

Here are my new configurations and it works!!!

Step 1: Factory Reset
$ firstboot

Step 2:
/etc/config/network

config switch 'eth1'
        option reset '0'
        option enable_vlan '0'

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 proto 'static'
        option ipaddr '192.168.6.1'
        option netmask '255.255.255.0'

config interface 'wan0'
        option ifname 'wlan0'
        option proto 'dhcp'

config interface 'wan1'
        option ifname 'eth0'
        option proto 'dhcp'
    option ifname eth0
    option proto dhcp


Step 3:
/etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        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'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv6 'server'
        option ra 'server'

config dhcp 'wan0'
        option interface 'wan0'
        option ignore '1'

config dhcp 'wan1'
        option interface 'wan1'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'

Step 4:
/etc/config/wireless

config wifi-device  radio0
        option type     mac80211
        option channel  8
        option hwmode   11g
        option path     'platform/ar933x_wmac'
        option htmode   HT40

config wifi-iface
        option device   radio0
        option network  lan
        option mode     ap
        option ssid     JoySince
        option encryption none

config wifi-iface
        option device 'radio0'
        option network 'wan0'
        option mode 'sta'
        option ssid 'wifi ssid name'
        option encryption 'psk2'
        option key 'wifi password'

Step 5:
/etc/init.d/network restart


ref:
https://my.oschina.net/lvsin/blog/392817     !!!!!!
https://my.oschina.net/lvsin/blog/384410
https://blog.csdn.net/gaopeiliang/article/details/40430915


No comments:

Post a Comment