0

I want to connect to hotspot on my phone automatically when I boot my Raspberry Pi 4 (with Kali Linux installed).

I know that I can edit /etc/network/interfaces but the configuration file I have is something like this:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
    address 192.168.0.198
    netmask 255.255.255.0
    network 192.168.0.1
    broadcast 192.168.1.255
    gateway 192.168.0.1
    wpa-ssid "WIFINAME"
    wpa-psk "WIFIPASSWD"

which is great if the hotspot had a static IP address but my phone changes the third part of the IP address 192.168.THIS_PART.1 every time I open the hotspot.

How can set the last part of the IP address to be always the same in the configuration file but also have the third part changed so I can connect with ssh to my RP4.

I'm not limited to using the /etc/network/interfaces configuration file.

1 Answer 1

0

Your phone should have a static SSID (name of the hotspot/WiFi network), e.g., phoneHotspot, i.e., the wpa-ssid in your /etc/network/interfaces configuration.

I am not an expert in Kali Linux, but wpa_supplicant configuration should do the work, see this example. The theory is that by using this approach the the dynamic IP of your phone shouldn't be an issue. Besides, you can always delete whatever information wpa_supplicant cached, and start fresh just with the SSID and the password from your /etc/wpa_supplicant.conf.

See also a similar example for Debian, also using wpa_supplicant.

Arch linux's wiki also has the wpa_supplicant very well covered, as always :)

Let me know if that helped, good luck.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.