2

My Rpi needs to connect to an EC2 instance. This works fine when the Pi is connected to internet using ethernet or my home wi-fi, but stops working when connected via an iPhone hotspot. I'm using a static IP (192.168.178.200), configured in dhcpcd.conf, and provided it with some extra DNS domains from google and openDNS.

Using the hotspot, I cannot ping google (timeout), although pinging 8.8.8.8 results in:

From 192.168.178.200 icmp_seq=1 Destination Host Unreachable. 

This points towards a DNS issue. However, I have provided it with additional DNS servers via dhcpcd.conf. My /etc/resolv.conf looks like this:

# Generated by resolvconf
#Google DNS
nameserver 8.8.8.8

#OpenDns Servers
nameserver 208.67.222.222
nameserver 208.67.220.220
nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 208.69.38.205
nameserver 8.8.8.8

I know it's somewhat double (added some lines through resolv.head), but that should not cause issues.

When trying to SSH, using my EC2's public IP (so not even the DNS address) it says "no route to host".

Again, this only happens when connected to the hotspot. Anyone a clue what may cause this?

EDIT: Output from ip addr:

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
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
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether b8:27:eb:0a:54:b1 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:5f:01:e4 brd ff:ff:ff:ff:ff:ff
inet 192.168.178.200/24 brd 192.168.178.255 scope global wlan0
   valid_lft forever preferred_lft forever
inet6 fe80::2bf6:d22:1559:80a6/64 scope link 
   valid_lft forever preferred_lft forever

And output fromip route:

default via 192.168.178.1 dev wlan0 src 192.168.178.200 metric 303 
192.168.178.0/24 dev wlan0 proto kernel scope link src 192.168.178.200 metric 303
  • Can you please edit your question and add the output of this commands: ip addr and ip route when you are connected to the access point. – Ingo Dec 16 '18 at 20:09
1

With the information so far the situation for me looks like this: your home network has the subnet 192.168.178.0/24 with the routers ip address 192.168.178.1. Wired connection and wifi are bridged on the router so both use the same subnet 192.168.178.0/24. With a static ip address 192.168.178.200 and manual configuration the RasPi is a host on this network, so everything works as it should.

If you use the iPhone as hotspot then it also uses a subnet but I don't believe that it is just 192.168.178.0/24. Why should it use just this? It does not know anything about the configuration of the RasPi. As far as I know Apple uses mostly link-local ip addresses from the reserved address range 169.254.0.0/16.

The packages take a route to the destination over hops (router). With traceroute 8.8.8.8 you can see what hops are on the route. If any hop has a problem "Destination Host Unreachable" then it will report it with an icmp message to the source host, your RasPi, maybe

From 192.168.178.1 icmp_seq=2 Destination Host Unreachable.

This means your router cannot connect. But the error message you get says that already your RasPi has no route to the destination and this indicates it is on the wrong network. With traceroute 8.8.8.8 you will see that it stuck from the beginning.

There are mainly two solutions: configure your iPhone to use subnet 192.168.178.0/24 or setup the RasPi to use DHCP. This typical shows that using a static ip address on a mobile device is not a good idea. With DHCP enabled the RasPi will get its configuration from the local network. Connected to the access point from the iPhone it does not find a DHCP server. Then it will also use a link-local ip address (supported by avahi) so it will get part of the subnet from the iPhone. Maybe there is some fine tuning to do to get it to run in both situations.

  • Thanks Ingo - after your post I have decided to revisit my decision for a static IP. I made some changes allowing me to use a dynamic IP, solving this and some other problems. – Kaz Vermeer Jan 3 at 13:50
  • @KazVermeer Glad to help you :-) If my answer helped you it would be nice if you could accept it with the tick on the left side. This will finish the question and show others that is has already an answer. – Ingo Jan 3 at 22:36

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.