Wifi intialization

rm /etc/config/wireless
wifi detect > /etc/config/wireless
vi /etc/config/wireless

Enable wireless:

# REMOVE THIS LINE TO ENABLE WIFI:
# option disabled 1

STA mode

Edit etc/config/network and etc/config/wireless

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 'switch_vlan'
      option 'vlan'       '1'
      option 'device'     'eth0'

config interface lan
      option ifname   'eth0.1 eth0.2'
      option type     bridge
      option proto    dhcp
      option ipaddr   192.168.1.1
      option netmask  255.255.255.0
      option 'macaddr' '54:e6:aa:bb:cc:10'
      option defaultroute 1

config interface wwan
      option proto            dhcp

etc/config/wireless

config wifi-device  radio0
      option type     mac80211
      option channel  11
      option macaddr  00:0c:43:30:54:88
      option hwmode   11ng
      option htmode   HT20
      list ht_capab   GF
      list ht_capab   SHORT-GI-20
      list ht_capab   SHORT-GI-40
      list ht_capab   TX-STBC
      list ht_capab   RX-STBC12
      option txpower  20

config wifi-iface
      option device   radio0
      option network  wwan
      option mode     sta
      option ssid      ************
      option encryption psk2
      option key **********

After reboot Route, iwconfig and ifconfig should look like:

ifconfig

br-lan  Link encap:Ethernet  HWaddr 54:E6:AA:BB:CC:10  
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        TX packets:1205 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0 
        RX bytes:0 (0.0 B)  TX bytes:492845 (481.2 KiB)

eth0    Link encap:Ethernet  HWaddr 00:0C:43:30:54:77  
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        TX packets:2472 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000 
        RX bytes:0 (0.0 B)  TX bytes:999298 (975.8 KiB)
        Interrupt:5 

eth0.1  Link encap:Ethernet  HWaddr 54:E6:AA:BB:CC:10  
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        TX packets:1236 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0 
        RX bytes:0 (0.0 B)  TX bytes:494271 (482.6 KiB)

eth0.2  Link encap:Ethernet  HWaddr 54:E6:AA:BB:CC:10  
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        TX packets:1236 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0 
        RX bytes:0 (0.0 B)  TX bytes:494271 (482.6 KiB)

lo      Link encap:Local Loopback  
        inet addr:127.0.0.1  Mask:255.0.0.0
        UP LOOPBACK RUNNING  MTU:16436  Metric:1
        RX packets:19 errors:0 dropped:0 overruns:0 frame:0
        TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0 
        RX bytes:1346 (1.3 KiB)  TX bytes:1346 (1.3 KiB)

wlan0   Link encap:Ethernet  HWaddr 00:0C:43:30:54:88  
        inet addr:192.168.101.67  Bcast:192.168.101.255  Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:2787 errors:0 dropped:0 overruns:0 frame:0
        TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000 
        RX bytes:170741 (166.7 KiB)  TX bytes:7689 (7.5 KiB)

iwconf

lo        no wireless extensions.

eth0      no wireless extensions.

eth0.1    no wireless extensions.

eth0.2    no wireless extensions.

br-lan    no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"**************"  
          Mode:Managed  Frequency:2.467 GHz  Access Point: 00:19:3B:FB:11:E4   
          Bit Rate=28.9 Mb/s   Tx-Power=20 dBm   
          RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=32/70  Signal level=-78 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:3  Invalid misc:2   Missed beacon:0

You can use iwlist scan to see available networks.

AP Router mode

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 'switch_vlan'
        option 'vlan'       '1'
        option 'device'     'eth0'

config interface lan
        option ifname   'eth0.1 eth0.2 wlan0'
        option type     bridge
        option proto    dhcp
        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/wireless

config 'wifi-device' 'radio0'
        option 'type' 'mac80211'
        option 'macaddr' '00:0c:43:30:54:88'
        option 'hwmode' '11ng'
        option 'htmode' 'HT20'
        list 'ht_capab' 'GF'
        list 'ht_capab' 'SHORT-GI-20'
        list 'ht_capab' 'SHORT-GI-40'
        list 'ht_capab' 'TX-STBC'
        list 'ht_capab' 'RX-STBC12'
        option 'txpower' '20'
        option 'country' '00'
        option 'disabled' '0'
        option 'channel' '9'
        option txpower  '15'
config 'wifi-iface'
        option 'device' 'radio0'
        option 'network' 'wifi'
        option 'mode' 'ap'
        option 'ssid' 'OpenWrt'
        option 'encryption' 'psk2'
        option 'key' '********'

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' 

etc/config/firewall

Add these lines:

config 'zone'
        option 'name'       'wifi'
        option 'input'      'ACCEPT'
        option 'output'     'ACCEPT'
        option 'forward'    'REJECT'
        
config 'forwarding'
        option 'src'        'wifi'
        option 'dest'       'lan'        
        
config 'forwarding'
        option 'src'        'lan'
        option 'dest'       'wifi'        
        
config 'forwarding'
        option 'src'        'wifi'
        option 'dest'       'lan'         

AP Bridge mode

TODO

AD-HOC mode

TODO

Restart wireless

wifi stop  
wifi start

See connection status:

iwconfig

and

ifconfig

Links

Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki