Page 1 of 1

[SOLVED] Raspberry as Access Point (Hotspot) AND Client

Posted: Sat Mar 14, 2015 4:43 pm
by thuranga
Hi,
I set up my Pi successful as an access point. Everything works fine. Here is my /etc/network/interfaces :

Code: Select all

auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.178.220
    netmask 255.255.255.0
    gateway 192.168.178.1

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
    address 192.168.66.1
    netmask 255.255.255.0
    broadcast 192.168.66.255

Code: Select all

# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether b8:27:eb:98:3f:17 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.220/24 brd 192.168.178.255 scope global eth0
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 74:da:38:1a:95:90 brd ff:ff:ff:ff:ff:ff
    inet 192.168.66.1/24 brd 192.168.66.255 scope global wlan0
       valid_lft forever preferred_lft forever
Now I installed a second WLAN-Interface (wlan1) to access the new WLAN as a client with my PI too. How do I configure the network?

I tried the following:

Code: Select all

auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.178.220
    netmask 255.255.255.0
    gateway 192.168.178.1

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
    address 192.168.66.1
    netmask 255.255.255.0
    broadcast 192.168.66.255

auto wlan1
allow-hotplug wlan1
iface wlan1 inet static
    address 192.168.66.220
    netmask 255.255.255.0
    gateway 192.168.66.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
but now my hotspot (wlan0) gone away:

Code: Select all

# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether b8:27:eb:98:3f:17 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.220/24 brd 192.168.178.255 scope global eth0
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 74:da:38:1a:95:90 brd ff:ff:ff:ff:ff:ff
4: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 74:da:38:05:0f:b8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.66.220/24 brd 192.168.66.255 scope global wlan1
       valid_lft forever preferred_lft forever
Can anyone help me to set up my Pi as hotspot AND client?

Greetings
Frank

Re: Using the Raspberry as Access Point (Hotspot) AND Client

Posted: Sat Mar 14, 2015 5:16 pm
by DougieLawson
Have you removed ifplugd with sudo apt-get purge ifplugd?

Re: Using the Raspberry as Access Point (Hotspot) AND Client

Posted: Sat Mar 14, 2015 5:22 pm
by thuranga
No, I did not remove ifplugd.

Re: Using the Raspberry as Access Point (Hotspot) AND Client

Posted: Sat Mar 14, 2015 5:34 pm
by DougieLawson
thuranga wrote:No, I did not remove ifplugd.
There's your problem ifplugd is there to ensure you only ever have ONE active network interface. [I've yet to discover why ifplugd is needed or installed by default.]

[SOLVED] Using Raspberry as Access Point (Hotspot) AND Clien

Posted: Sat Mar 14, 2015 5:47 pm
by thuranga
Wow! You are great!!!

Code: Select all

# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether b8:27:eb:98:3f:17 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.220/24 brd 192.168.178.255 scope global eth0
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 74:da:38:1a:95:90 brd ff:ff:ff:ff:ff:ff
    inet 192.168.66.1/24 brd 192.168.66.255 scope global wlan0
       valid_lft forever preferred_lft forever
4: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 74:da:38:05:0f:b8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.66.220/24 brd 192.168.66.255 scope global wlan1
       valid_lft forever preferred_lft forever
Now I can ping a machine at my "old" wlan and my iPhone, which is connected via hotspot! I think this is the solution! I will check it :D

Thanx a lot!!!!!

Update:
I verified and optimized my config and now everything works fine. If anyone is interested in the config to create a hotspot, you can look here (sorry, its only in german): http://www.linux-ratgeber.de/den-raspbe ... inrichten/ and http://www.linux-ratgeber.de/den-raspbe ... inrichten/

Re: Using the Raspberry as Access Point (Hotspot) AND Client

Posted: Sat Mar 14, 2015 9:09 pm
by ronnyvdbr
Hi, you might check out this project for a web gui for your hotspot.
In the php code u will find a lot of example shell commands which explain how the configuration is done.
https://ronnyvdbr.github.io