I can't access the internet through my raspberry pi when connected through ssh
Let me try an answer then since I think we are getting there:
a) Remove the port forwarding and the static IP for your pi first, i.e. let everything go its default way and make sure that the pi can then ping outwards.
b) See what the pi has as its ip address, most likely 192.168.x.y, depending on how your hub is set up.
c) Try to assign exactly this address as a static ip for your pi. It may be that your hub does not allow this. Then check whether your hub can be told to give out dynamic addresses only in a fixed range, like 192.168.x.100 to x.200. Then try to assign a static address to your pi outside this range. Should work.
d) Only now think about port forwarding. Forward the port to the IP address you just specified.
e) Now use no-ip.com as before. The idea is that initial outside traffic that ultimately should reach the pi needs to be addressed from the outside to your hub, not to the pi, but on the forwarded port. The hub takes care of forwarding it, as the name says, port forwarding :-)
Related videos on Youtube
maxisme
Updated on September 18, 2022Comments
-
maxisme over 1 year
Proof of the error
When I try ping
8.8.8.8
through SSH I get this:PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. --- 8.8.8.8 ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 2007ms
What I have tried
My /etc/resolv.conf looks like this:
nameserver 8.8.8.8 nameserver 8.8.4.4
My /etc/network/interfaces looks like this:
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 31.51.249.21 netmask 255.255.255.0 gateway 31.51.249.18 dns-nameservers 8.8.8.8 8.8.4.4
My network
When I type the command ifconfig -a:
eth0 Link encap:Ethernet HWaddr b8:15:qd:32:a5:6c inet addr:31.51.249.21 Bcast:31.51.249.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:330247 errors:0 dropped:46340 overruns:0 frame:0 TX packets:63355 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:47649638 (45.4 MiB) TX bytes:14773496 (14.0 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:1309 errors:0 dropped:0 overruns:0 frame:0 TX packets:1309 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:146798 (143.3 KiB) TX bytes:146798 (143.3 KiB)
When I type the command route -n:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 31.51.249.18 0.0.0.0 UG 0 0 0 eth0 31.51.249.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Please help me with what might be the cause of this. It is preventing me from being able to install anything onto my raspberry! I would be so grateful for any help on why this might be happening!
-
Harald over 9 yearsYour network and routing looks as if it could work, but: your pi has the ip-address 31.51.249.21, which looks like a pooled address from your provider (whoever btcentralplus.com is). But the gateway seems to have also such an address, so I guess it is your laptop or desktop, which would probably not be the right gateway. If this is the case, check what
route -n
gives you on that other machine for the gateway and use this on the pi too. -
maxisme over 9 yearsI am also very confused by it all. But it seems that
...18
is the static ip on my "bt hub"??? Could that be right? -
Harald over 9 yearsYes, that would be right then. But how is your pi then connected to the Internet such that it gets its own ip address from bt. Of course bt setup may be different, but here in Germany a home has usually only one externally visible IP address and everything inside gets IP-addresses from the hub/router/modem/you-name-it that has this one external address. Put slightly different: should your pi not get its address from the hub/router? The it would likely be a 10... 172... or 192.168... .
-
maxisme over 9 yearsI have set up port forwarding (to the pi) which required setting a static ip for the device (which the hub did) and no-ip.com on the hub (so that a domain can be notified on the change of the "one externally visible IP")! Is that what you are asking? Thank you for your help so far!
-
-
maxisme over 9 yearsI have one major problem and that is that the pi is 200 miles away! I can connect to the pi with SSH and I can create a very unstable share screen with a laptop there. I don't see how this method would help either. I know that my hub will not allow to change the address of the static IP. God this is driving me crazy haha!! I just need to install mysql!!