I have had a hell of a time trying to figure out what is wrong with my network setup, so I decided to write up a quick how-to for fixing the connectivity issues. Your solution will depend on the type of error you get. Here is the general guide to follow:
1. Find the name of the interface. Type "ifconfig" to find out your hardware interfaces that are available. Look for wl0 or wlan0 interface if you are connecting to the internet through wireless. Anotherwords look for an interface that will connect you to the internet.
2. Find your LAN ip address. Determine if your wlan0 interface is assigned an "inet addr" number. If not, in your Network->Interfaces->WAN tab make sure to select protocol DHCP and assign the correct Gateway and DNS server where you get your wireless/wired LAN IP address assignments.
3. Try to ping local interface. If your "ping google.com" is still not working, try to ping your own LAN ip from step 2.
4. Try to ping DNS server. Ping the local LAN DNS server to find out if there are any connectivity issues.
5. Find out if it is a name server resolution problem. Try to "ping 8.8.8.8". If you can ping ip, but cannot ping a name, then it is a DNS issue and you could possibly try using google nameservers 8.8.8.8 and 8.8.4.4 in /etc/config/resolv.conf or LuCI->Network->Hostnames to avoid ipv6 connectivity issues.
6. It could be the other way around, when the name is resolved to an ip address as in: "PING google.com (74.125.65.147): 56 data bytes", yet the network is still unreachable. In that case you will have to look at your routing table. Type "route" in the terminal. If you have something like the following, your routing table is not correct:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 * 255.255.255.0 U 0 0 0 wlan0
You will need to add default routing rule that will direct traffic through your gateway. Even if you have specified Gateway and DNS server for your wireless interface (see step 2), you still need to add the default routing rule. The easiest way is to go LuCI->Network->Static Routes. Add a new rule for wan interface with the Target 0.0.0.0, Netmask 0.0.0.0, and your Gateway IP. Now if you execute "route" in the terminal you should see something like this:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.2.1 255.255.255.255 UGH 0 0 0 wlan0
192.168.2.0 * 255.255.255.0 U 0 0 0 wlan0
At this point my internet connectivity was restored.
I found it kind of strange that even if wlan0 is my only interface, and I have assigned a Gateway for that interface, I would still have to manually add the default routing rule. Anyone has any explanations for this, or has any other network troubleshooting tips, please share them!