-1

I have my Zero on two connections:

  1. Ethernet, via USB cable (with internet sharing from my laptop)
  2. USB wifi dongle, connected to a mobile hotspot

I believe I have successfully configured both connections.

`pi@raspberrypi:~ $ ifconfig

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:1368 (1.3 KiB)  TX bytes:1368 (1.3 KiB)
usb0      Link encap:Ethernet  HWaddr f2:e8:7e:a4:ac:49  
          inet addr:192.168.2.31  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::f0e8:7eff:fea4:ac49/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1595 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1062 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:158977 (155.2 KiB)  TX bytes:192668 (188.1 KiB)
wlan0     Link encap:Ethernet  HWaddr 18:fe:34:02:78:e5  
          inet addr:192.168.43.253  Bcast:192.168.43.255  Mask:255.255.255.0
          inet6 addr: fe80::5dc5:b2a1:d7a:5f3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:131 errors:0 dropped:0 overruns:0 frame:0
          TX packets:138 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:11715 (11.4 KiB)  TX bytes:17823 (17.4 KiB)`

`pi@raspberrypi:~ $ route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.43.1    0.0.0.0         UG    0      0        0 wlan0
0.0.0.0         192.168.2.1     0.0.0.0         UG    202    0        0 usb0
0.0.0.0         192.168.43.1    0.0.0.0         UG    304    0        0 wlan0
192.168.2.0     0.0.0.0         255.255.255.0   U     202    0        0 usb0
192.168.43.0    0.0.0.0         255.255.255.0   U     304    0        0 wlan0`

I can SSH into my Pi via the ethernet connection, but not the wifi connection.

When I attempt 'ssh pi@192.168.43.253', the system just hangs.

If I ping 192.168.43.253, the ping is successful.

Here is my /etc/network/interfaces file. I suspect something is wrong with it. Perhaps my ethernet is interfering with the wifi scanning. Does anyone know what is wrong?

`auto lo usb0
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
    wpa-ssid AndroidAP
    wpa-psk raspberry
allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug usb0
iface usb0 inet manual`
Milliways
  • 59,890
  • 31
  • 101
  • 209

2 Answers2

0

"Does anyone know what is wrong" Yes you fiddled with the settings.

Put it back the way it came! How do I set up networking/WiFi/Static IP

Exactly what you are trying to achieve is unclear; you seem to have connections to 2 networks. Realistically you need to do one or the other.

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • I am trying to SSH to my Pi via the USB Wifi dongle. I have two connections because I had previously configured the Pi with Ethernet connection delivered via a USB cable. – user2989813 Jan 19 '17 at 09:48
  • Your fundamental problem is that you have 2 connections, (probably) with 2 independent DHCP servers. This is external to the Pi, and you need to resolve this, preferably by using a single DHCP server. (There are other solutions of varying degrees of complexity, but these require an understanding of networking protocols.) – Milliways Jan 19 '17 at 09:58
  • Apologies, because I am quite unfamiliar with this area, but I have seen a number of other people who simultaneously have ethernet and wifi connections on their Raspberry Pis. I tried replacing my config files with the interfaces files provided in the link you shared, but this worsened my problem. With my own files, my wlan0 is connected to the correct wifi, but I am able to use this wifi to SSH in. With the fresh files (filled in with my wifi's login info) my wlan0 is not connected to this wifi at all. I suspect the issue is that my ethernet is somehow taking priority over wifi... – user2989813 Jan 19 '17 at 10:04
  • Raspbian is designed for a single connection to a router. If you do this it should work. More complex configurations are possible, but no one is going to be able to tell you how to do this, particularly as is hard to see why you want to do otherwise. – Milliways Jan 19 '17 at 10:26
0

Have you setup the wpa_supplicant.conf for Wifi ssid and password? You need to add the following lines to the file:

network={
    ssid="yourSSID"
    psk="yourWifiPassword"
    key_mgmt=WPA-PSK
}

Please disconnect your ethernet connection as others suggested if you want to use your Wifi connection.

hcheung
  • 845
  • 7
  • 14
  • 1
    Obviously the OP already did what you describe (or something similar), since his wlan0 interface has an IP address and a gateway assigned. – Dmitry Grigoryev Jan 23 '17 at 12:26