How to setup wifi connection on a laptop

Scan from within luci, click on connect of the ESSID you want to connect to - and let yourself guide by luci through the rest.

I don't have access to luci....

It looks as though I should be able to connect using

iw wlan0 connect -w ssid passphrase

but can't figure out the correct syntax

No, you can't (that only, kind of, works for WEP, which isn't supported by OpenWrt at all anymore), it doesn't (and never did) for WPA based encryptions, which need more than the kernel can provide without userspace help.

If you don't have luci (installing it might be sensible), you need to configured /etc/config/wireless correctly.

1 Like

I guess luci is running but don't have any means of using it at the moment, so it's down to getting the wireless options right...Do I really need to set channel, band and htmode? And if not how do I know the correct values?

As for the wifi-iface, is it correct to set network, mode, encryption to wan, sta, wpa?

I understand that I also need to add this to /etc/config/network

config interface 'wan'
option proto 'dhcp'

Is that correct?

  • For a STA - band and htmode
  • For an AP - Yes, all 3
  • A fresh or Factory Reset device will provide a default config
  • (Unless you're asking us how to configure your WiFi, then I'm confused)

Is this a reference to WiFi or configuring your WAN interface?

I ask because:

  • what you posted should be the default for the WAN config; and
  • you edit /etc/config/wireless to setup WiFi, not the network file

P.S. - I was about to send you a private message to ask a question - then I realized I already sent you one the other day. Please take some time to look at it/respond at your earliest convenience.

1 Like

I was told I needed to amend /etc/config/network so that the wifi interface IP address would be configured by DHCP.

Doing a scan finds the required ssid which shows as

Cell 01
Mode: Master Channel: 1
Encryption: WPA2 PSK (CCMP)
HT Operation:
Primary Channel: 1
Secondary Channel Offset: no secondary
Channel Width: 40 MHz or higher

Should any of these values be incorporated into my /etc/config/wireless ?

I guess 'channel' should be 1 and 'encryption' should be 'wpa2' or 'psk' ...

Where/by whom? *

  • Setting an interface is Static/DCHP Client/etc. is done in the network file
  • In the wireless file, you simply set the wireless to said interface (see Wiki you posted)

*This would be the setting:

option encryption 'psk2+ccmp'

*- Please take some time to answer my PM, thanks.

I'm not really familiar with how this particular forum software works. Not sure where to locate PMs.

1 Like

On the menu - clicking on your B icon in the upper-right corner, a menu will appear - click here:

No worries, I provided all the information regarding your inquires in the post.*

I'm just inquiring so I understand your skill level - you seem to have forgotten things about OpenWrt, and as you've been a Community Member for quite a few years - I was concerned and asking via Private Message.

I hope it helps.

My apologies, I misunderstood that you were attempting to add DHCP client setting to wireless. My bad - as I noted already:

That config should already exist, so it's unclear why you're inquiring.

I apologize for any confusion and hope that clarifies things. I was writing as if you were aware of that information. I hope this provided clarity.

*It says you already read it...

1 Like

Per your PM, here's a sample STA config:

config wifi-iface 'wifinet1' #<---may differ on yours
        option ssid 'upstrream_SSID'
        option device 'radio0' #<---may differ in name/band
        option mode 'sta'
        option key 'xxxxxxxxxxxxx' #<---may differ on yours
        option network 'wwan' #<---or use wan, since it already exist
        option encryption 'psk2+ccmp'

I noted that there should already be a wifi-device default config, and AP configs, so I hope this helps you setup. I"m not sure what you need exactly, as there should be default wan config (in network) and a default wifi-device settings (in wireless).

I'm still unable to connect so I'd like to confirm my /etc/config/network is setup correctly to enable automatic IP address allocation..

I have an

config interface 'loopback'

config globals 'globals'

config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'

config interface 'lan'
option device 'br-lan'
option proto 'dhcp'
option ip6assign

to this I added

config interface 'wan'
option proto 'dhcp'

Is this OK?

config iterface

  • Please place your output into a codebox for easy reading by others
  • The last line in your post seems incomplete - or maybe you didn't pate the complete file?

screen354

  • Next, I'm unsure if this is the complete config - again, there should have been a network default config present which should have been OK (you may need to add wan only WAN)
    • "Loopback" and "Globals" seems incomplete
  • There should also be a default wireless config

Yes, this is correct for a WiFi-only wan, per my last post - we can:

config wifi-iface 'wifinet1' #<---may differ on yours
        option ssid 'upstrream_SSID'
        option device 'radio0' #<---may differ in name/band
        option mode 'sta'
        option key 'xxxxxxxxxxxxx' #<---may differ on yours
        option network 'wan' #<---you used wan
        option encryption 'psk2+ccmp'

Be sure to delete the default AP mode interface (since Intel doesn't support AP) and remove the option disabled line from the wifi-device block. Check the log for wifi-related errors. Run iw dev and you should have one device of mode Managed. If it has connected to the AP you'll also see the SSID and channel of operation. Channel 1 is in the 2 GHz band so option band should be 2g.

2 Likes

After some time away from my laptop, I'm getting back to where I left off...

iw dev:-

phy0

Interface wlan0
ifindex 5
wdev 0x2
addr 00:21:5c:42:47:75
type managed
txpower 15.00 dBm

The wifi LED is on and iwinfo wlan0 scan includes my wifi router.

My /etc/config/wireless includes a
config wifi-iface 'default radio'
which includes ssid, key and encryption

My /etc/config/network includes
config interface 'wan'
option proto 'dhcp'

I must be close to getting this working. What more do I need to configure?