Asad Umar
Asad Umar

Reputation: 86

switch raspberry pi from ap to client

I have a raspi with hostapd configured. what i want to do is run a nodejs server so if there is internet via eth0 it makes a hotspot and when there is no internet via eth0 it connects to known wifi networks. my problem is in my interfaces file which looks like this

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet static
    address 172.24.1.1
    netmask 255.255.255.0
    network 172.24.1.0
    broadcast 172.24.1.255

iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

when i comment out

iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

i can use hostapd to make an AP. but not connect to wifi as a client. if i comment out

iface wlan0 inet static
    address 172.24.1.1
    netmask 255.255.255.0
    network 172.24.1.0
    broadcast 172.24.1.255

i can connect to a wifi network but hostapd wont let me make a AP. if i leave both as they are nothing seems to work.

Thank you all in advance.

Upvotes: 1

Views: 380

Answers (0)

Related Questions