8

Background: I am trying to set up a rasberry pi server. Everything was going well and my pi could apt-get update etc, until I got the port forwarding to work and ssh to work outside of the LAN. I have been trying to get a webpage up as well so I created a port forward for a port other than 80, since my ISP was blocking it.

Problem: After getting access to the pi by ssh outside LAN, I was unable to use apt-get or get any connection to websites with my pi. The ping is still working well though.

What I have tried: I have tried many different configurations of the iptables, as well as completely flushing it and starting over several times with configurations people have suggested. None of it seems to work. At the moment, the iptables are completely flushed.

Here is an example output of the pings and wget/curls:

pi@raspberrypi:~$ sudo apt-get update
0% [Connecting to mirrordirector.raspbian.org (5.153.225.207)] [Connecting to w^Cpi@raspberrypi:~$ wget -q -O- google.com
^C
pi@raspberrypi:~$ ping google.com
PING google.com (74.125.224.98) 56(84) bytes of data.
64 bytes from lax02s19-in-f2.1e100.net (74.125.224.98): icmp_req=1 ttl=52 time=58.8 ms
64 bytes from lax02s19-in-f2.1e100.net (74.125.224.98): icmp_req=2 ttl=52 time=53.8 ms
64 bytes from lax02s19-in-f2.1e100.net (74.125.224.98): icmp_req=3 ttl=52 time=62.2 ms
64 bytes from lax02s19-in-f2.1e100.net (74.125.224.98): icmp_req=4 ttl=52 time=71.2 ms
64 bytes from lax02s19-in-f2.1e100.net (74.125.224.98): icmp_req=5 ttl=52 time=67.3 ms
^C
--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 53.846/62.705/71.224/6.137 ms
pi@raspberrypi:~$

I have to ctrl-c out of the tasks obviously because they hang, but that's the output.

Does anyone know what other problem may be causing this?

EDIT

I found the problem was somehow my ip adress was added to the port blocking in my router, so if you have similar problems check that even if you don't believe you touched it.

5
  • if you are pinging the public address of a system that is performing port forwarding, you are pinging the router, not the server. are you pinging the server from within or outside its LAN? I'd also install UFW and make sure it is configured to allow outgoing connections and incoming responses. iptables is powerful, but often unnecessarily complicated. Commented Jan 14, 2015 at 17:41
  • I am trying to ping addresses outside my LAN from my server. I would like the server to have the ability to connect to the internet and download files as needed so I can ssh into it and do work or add things as necessary.
    – chase
    Commented Jan 15, 2015 at 1:06
  • OK, this seems pretty confusing now. So you have a your machine (call it rp) behind your router and you have forwarded ssh and http on say 8080 port to your rp on your router and after this your rp cannot ping Google or download files from Internet?
    – Mahdi
    Commented Jan 15, 2015 at 2:03
  • Almost - everything you said except it actually can ping, just not download.
    – chase
    Commented Jan 15, 2015 at 2:31
  • post your pi's iptables and your router's configuration.
    – gogators
    Commented Jan 15, 2015 at 19:12

1 Answer 1

5

This seems like a DNS lookup problem. Can you test something like:

nslookup www.google.com

If it responds with an IP address, then you have your DNS working, otherwise, you need to fix you DNS issue first by editing your /etc/resolv.conf to contain something like:

nameserver 8.8.4.4

13
  • apparently I don't have nslookup as a command, but I added the nameserver 8.8.8.8 and nameserver 8.8.4.4 to the file and the problem persists. I did not have those values already in the file, it was three other ip's which I believe were primary WAN DNS, secondary WAN DNS, and third WAN DNS.
    – chase
    Commented Jan 15, 2015 at 1:04
  • I noticed after rebooting the resolv.conf file returns to having only the three entries in it and deletes the 8.8.8.8 and 8.8.4.4 entries..... I don't know if it should do that but I wouldn't think that is normal.
    – chase
    Commented Jan 15, 2015 at 1:10
  • Sorry, I forgot to mention that after editing that file you need to restart your network services. Do you manually set your IP or it is from DHCP (automatic)?
    – Mahdi
    Commented Jan 15, 2015 at 1:51
  • When you ping a host (e.g. ping www.google.com) will you get an IP address for it and is it successfull? BTW, you can get nslookup by installing dnsutils package: sudo apt-get install dnsutils
    – Mahdi
    Commented Jan 15, 2015 at 1:54
  • My ip is set dynamically. I tried restarting the network services after adding the nameservers but it still gives me nothing on curl or wget commands and hangs at 0% [Connecting to mirrordirector.rasbpian.org ]
    – chase
    Commented Jan 15, 2015 at 2:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .