How to setup wifi connection on a laptop

Many thanks to all that helped.

I now have an /etc/config/wireless in which there are two wifi-device 'radios' both of which are disabled.

Should I change the disabled option to '0'?

Is this were I should set the SSID and passphrase of where I want to connect?

Also, how do I do a scan of available SSIDs?

you're not using the webui ? things are a lot easier through it.

I'm not able to use the webgui at this point. I need to be able to do everything from the command line.

It actually helps to understand what you are actually doing.

1 Like

the basic radio stuff might get added once the radio's detected.

the specifics when the wifi's configured.

here's a wifi uplink sample.

config wifi-iface 'wifinet2'
        option device 'radio0'
        option mode 'sta'
        option network 'wwan'
        option ssid 'some.wifi'
        option encryption 'psk2'
        option key 'some.passphrase'
1 Like

I've updated /etc/config/wireless with the above values and run service network reload, but don't see a wifi interface when I run ifconfig. What have I overlooked?

What should I see in dmesg which shows that the WiFi card is recognised and accessible?

Did you only install the firmware for the intel card, or did you add the kernel module (afaik kmod-iwl4965) too?
How about the other parts, @mk24 mentioned (wpad-openssl etc.)?

I don't know for sure in OpenWrt, but in Debian Linux there are some lines containing 'iwlwifi'.

I seem to have installed quite a bit....lsmod shows I have cfg80211 lib80211 amoung numerous other things... /etc/config/wireless got created so I guess I must have done something right.

I amended /etc/config/wireless as advised above, but when running service network reload, the file has four entries appended. Those entries corresponded to the original file.

lspci lists Intel PRO/Wireless 4965, but I can't confirm whether I have installed the appropriate drivers. I thought I had, but don't know how to confirm.

Doing a search for openwrt intel pro/wireless 4965 finds this:-

I though I had installed this, but opkg list | grep kmod-iwl didn't find anything, so I guess that is what's missing.

There is a kmod-iwl4965 which I would also expect to pull in iwl4965-firmware.

Run iw list it should show you have one radio (phy0). Remove /etc/config/wireless and reboot to regenerate a new /etc/config/wireless that contains only the one radio. This should lead to iw dev showing one phy and one device (disabled) which you can use for scans with iwinfo wlan0 scan (the scan process will temporarily enable the radio). Nearby APs should be detected and reported. If all of this works then you can edit /etc/config/wireless to enable a STA interface which connects to your upstream network.

2 Likes

iw list shows tons of stuff, none of which means much to me....

eventually I ran iw list | grep Wiphy which showed phy0, phy1, phy2.

/etc/config/wireless was created with six entries, two for each phy.
iw dev shows three interfaces.

iwinfo wlan2 scan found some SSIDs including the one I wanted, so it looks like I need to adjust the appropriate wifi-device and I should be able to connect.

I assume that phy0 corresponds to radio0...

Not making much progress, although currently looking for clues in:-

which shows a minimal configuration like this:-

config wifi-device 'wl0'
option type 'broadcom'
option channel '6'

I'm trying to understand what wifi-iface and wifi-device actually refers and why do I have three of each...

How do I get an IP address on the WiFi interface?

On FreeBSD I would run dhclient wlan0. Is it possible to do something like this on OpenWrt?

So far I have managed to start up the WiFi interface on my laptop somehow... not sure exactly how.

iw dev shows two interfaces, wlan1 and wlan2.

Neither of the labels are mentioned in /etc/config/wireless. That file includes several 'wifi-iface's but none are labelled wlan1 or wlan2, so where do these names come from?

And how does a wifi-device relate to a wifi-interface?

Yes, it's quite confusing when one isn't familiar with this.
I'm neither, especially not on X86 hardware.
That's why it's (highly) recommended to do this via the webUI.
Once you know what is what on your device it might be easier to edit the config files instead of using UCI or webUI.
But for the first setup the webUI is way much easier to handle.

But maybe i could be at least of a little help:
That's how it looks like on my VDSL-router.
Maybe this will give you an idea or two.

# This is the hardware part for the 2,4 GHz radio #
config wifi-device 'radio0'   # 0 for the first, 1 for the second etc.
        option type 'mac80211'
        option path 'platform/soc/a000000.wifi' 
        option band '2g'  # 2,4 GHz
        option htmode 'HT20'
        option country 'DE'
        option cell_density '0'
        option channel '13'

# This is the software part for the 2,4 GHz radio #
config wifi-iface 'default_radio0'   
        option device 'radio0'   # The 2,4 GHz radio
        option network 'lan'
        option mode 'ap'
        option ssid 'SSID of 2,4 GHz radio'
        option key 'your wifi password'
        option encryption 'sae-mixed'   # Which type of encryption 

# This is the hardware part for the 5 GHz radio #
config wifi-device 'radio1'  # 0 for the first, 1 for the second etc.
        option type 'mac80211'
        option path 'platform/soc/a800000.wifi'
        option band '5g'  # 5 GHz
        option htmode 'VHT80'
        option country 'DE'
        option cell_density '0'
        option channel '120'

# This is the software part for the 5 GHz radio #
config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'SSID of 5 GHz radio'
        option encryption 'sae-mixed'
        option key 'your wifi password'
1 Like

You'll need to create a wan network in /etc/config/network:

config interface 'wan'
    option proto 'dhcp'

The proto dhcp causes OpenWrt to start a DHCP client on that network. The network should be named exactly 'wan' in lower case. This is because that name already exists in the firewall for proper NAT forwarding to the Internet, and rejection of incoming connections.
Then in /etc/config/wireless, associate the wifi-iface with the wan network:

config wifi-iface
    option network 'wan'
    ...

At run time this interface will probably be named 'wlan0' however that does not matter, as the wan functionality, DHCP client, and firewall association will follow the dynamically generated name whatever it may be.

1 Like

Thanks for the explanation of how to start DHCP on the WiFi interface.

At the moment I'm struggling to find out where to enter these deatails. In an effort to get some clarity in my /etc/config/wireless, I deleted it and rebooted and got one generated by the system which created three wifi-devices and three wifi-ifaces.

Running iw dev shows phy#2 phy#1 phy#0. How do I know which each refers to ?b

After not making any progress for a week or so, I thought I'd give it another go by starting from scratch, but am unable to get /etc/config/wireless created automatically.

dmesg shows that my Intel PRO/Wireless 3945 is recognised.

lsmod | grep 3945 shows

cfg80211
compat
iwl3945
iwlegacy
mac80211

iw dev and iw list do not show anything

Can anyone suggest what I might have overlooked?

Any messages about missing firmware files (dmesg)? dmesg | grep -i -e iwl -e ipw -e 80211 -e firmware, as well as ip a might also provide further clues.

1 Like

There is something like

ACPI [firmware bug] query ignored

and three entries related to iwl3945.

Is /etc/config/wireless automatically created once the correct driver is detected?

Looks like something is missing but I don't know what.

It should be, yes.

If you manage to scan (iw dev … scan) and get results back, wireless should basically work.

1 Like

Looks like I incorrectly installed kmod-iwl4965 or iwl4965-firmware.

I do now have a /etc/config/wireless which only has a single wifi-device and wifi-interface which I never got before.

Scanning works OK and I can see the SSID I want to connect to, but can't yet figure out how to connect to it. I've set the ssid and key in the wifi-iface and set encryption to wpa. Mode is set to sta and network to wan.

Do I need to set channel, band and htmode. They are set to 36, 5g, HT20 by default.

How do I manually connect to the broadband router?

The wifi led is on and the list of ssids scanned shows the one I want to connect to, so I should be close to connecting.