16

I'm using latest version of Debian-based Linux Kali. Maybe it is an XY problem, as the main problem is after I log in to the system I get a blank screen and mouse pointer. Somebody on the Internet recommend me to change window manager.

But I'm unable to do this as I can't connect to wifi.

I found tutorial how to do this here

And I tried to do it step by step, but it doesn't work for me. In that tutorial that author wrote that I need use the command ip link set wlan0 ip to bring up the wifi interface. In his example the output looks like this

root@kali:~# ip link show w
lan0 4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DORMANT qlen 1000
  link/ether 00:60:64:37:4a:30 brd ff:ff:ff:ff:ff:ff

root@kali:~# ip link set wlan0 up

root@kali:~# ip link show wlan0
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT qlen 1000
    link/ether 00:60:64:37:4a:30 brd ff:ff:ff:ff:ff:ff

On the other hand when I call

   ip link set wlan0 up
   ip link show wlan0

I get:

  4: wlan0: <NO_CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT qlen 1000
   link/ether 00:60:64:37:4a:30 brd ff:ff:ff:ff:ff:ff

and after running wpa supplicant with valid network details

wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf

iw wlan0 link still returns Not connected.

How do I solve this problem and what shall I do next?

  • Can you scan using iwlist scan ? – GAD3R May 17 '16 at 19:01
  • 1
    @GAD3R yes i can – user902383 May 17 '16 at 20:10
  • some are different: so i used; ifup wlp1s0 to bring the network up and ifdown wlp1s0 to bring it down. – George Aug 2 '18 at 17:25
19

I'm assuming wpa_supplicant and iw is installed.

  1. To connect to wifi through wpa_supplicant you need to create a wpa_supplicant.conf file

    nano /etc/wpa_supplicant.conf
    

    with the following lines:

    network={
             ssid="wifi_name"
             psk="wifi_key"
    }
    

Or you can use wpa_passphrase to create the configuration file (copy and past):

wpa_passphrase "Your_SSID" Your_passwd 

Also you can write the wpa_supplicant.conf directly through:

wpa_passphrase "Your_SSID" Your_passwd > /etc/wpa_supplicant.conf

to connect type the following command:

sudo ip link set wlan0 down
sudo ip link set wlan0 up
sudo wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant.conf -Dnl80211,wext
sudo dhclient wlan0

Note: Multiple comma separated driver wrappers in option -Dnl80211,wext makes wpa_supplicant use the first driver wrapper that is able to initialize the interface (see wpa_supplicant(8)). This is useful when using mutiple or removable (e.g. USB) wireless devices which use different drivers.

You can connect through wpa_supplicant without wpa_supplicant.conf file:

wpa_supplicant -B -i wlan0 -c <(wpa_passphrase "Your_SSID" Your_passphrase) && dhclient wlan0

You can visit the official documentation of Arch-linux to get more information about the configuration file and arguments.

  1. you can connect through nmcli

    nmcli d wifi connect Your_SSID password Your_Psswd_here iface Your_interface
    

Example:

nmcli d wifi connect MYSSID password 12345678 iface wlan0
  1. Also you can connect through wpa_cli:

Open the terminal and type wpa_cli

To scan, type:

scan
scan_results

Create a network:

add_network

This will output a number, which is the network ID, for example 0 Next, we need to set the SSID and PSK for the network.

set_network 0 ssid "SSID_here"
set_network 0 psk "Passphrase_here"

Once the wireless has connected, it should automatically get an IP address. if it doesn’t you can run the dhclient to get an IP address via DHCP.

The dhclient command ca be replaced with 2 ip commands:

ip addr add IP-ADDRESSE/24 dev wlan0
ip route add default via ROUTE

Further reading :

Connecting with wpa_cli

Connecting with wpa_passphrase

nmcli examples

  • 1
    your first solution is exactly like one in that tutorial, with one difference you create file by yourself, and there they used wpa_passphrase, but connecting via nmcli solved my problem, thanks – user902383 May 17 '16 at 20:14
  • Please add for debian user of barebone arm system needs to add interface to /etc/network/intefaces auto wlp1s0 iface wlp1s0 inet dhcp pre-up wpa_supplicant -i wlp1s0 -c /etc/wpa_supplicant.conf -B Then rebooting little box and it has ip already... – ndasusers Feb 8 '18 at 1:02
  • I wonder if there is a "pseudogui" available. When I setup the box, I was presented selection of ethernet or wifi. I selected wifi, then seleted SSID from a list, entered encryption, password, if I wanted dhcp or static IP, Then network worked to complete the installation. Why isn't this setup which works for the setup copied to the final system? Why is all this cli nessecary? – Lenne Mar 30 '18 at 13:13
  • 1
    nmtui is not available after install. Having to get online to get a gui to get online is a chicken-and-egg problem. I managed to save the /target/etc/network/interfaces during install; after install the lines for the wifi is removed. – Lenne Mar 30 '18 at 16:00
1

To install wpa_supplicant on Debian, type

sudo apt install wpasupplicant

in the terminal. To create the wpa_supplicant.conf file, type in

echo 'network={ssid="nameOfYourWiFiNetwork" psk="thePassword"}' >> /etc/wpa_supplicant.conf
  • 1
    In my opinion the OP is a specific question and this is not an answer to it. – andreatsh Jan 5 '17 at 22:13
  • 1
    indeed, the OP said "...and after running wpa supplicant with valid network details: – Jeff Schaller Jan 5 '17 at 23:09
  • He was only missing the dhclient call. – ychaouche Sep 25 '17 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.