Can ping but can't connect (curl, wget, apt-get, etc.) (rasberry pi server)

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.


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