Connect to Network (can ping router) but can't access the Internet
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Connect to Network (can ping router) but can't access the Internet
As the subject says, I'm connected to the network (I can ping the router, SSH to other computers, and it can be SSH'd to) so it's there. But I'm unable to access the Internet via that machine. So far I've just tried accessing websites via links, and trying to open FTP connections and it's always the same sort of error "Network cannot be reached" etc.
I'm trying to give the computer a static network assigned IP (192.168.1.2 in this case) so that my router's port forwarding works. If I set the computer back to dhcp it works fine (but assigns 192.168.1.3) which isn't desirable.
If anyone could shed some light it would be most appreciated, I can post any info that's required.
what does netstat say? My 1st guess is that you don't have a default route set.
If you dont have that set you wont be able to get out of your network, in this case:
Code:
route add -net 0.0.0.0/0 gw <ip of gateway to the outside world>
Also it is a good choice to use static IPs if you are planning to use port forwarding. Just make sure your DHCP server does not have the IP you use as your static address in its dhcp server pool. If it does you could end up with 2 machines with the same IP address and that leads to all kinds of weird network problems.
Just another question, I restarted the computer and it didn't work again, as the route I'd added wasn't there anymore. Is there a file I can edit to append the line so that it is there all the time? Or should that not be happening.
a quick and dirty way would be to add the route command to /etc/rc.local it will then be run @ start up.
I believe w/ cent you can make a route file (so that the routes are restored with each network restart) in /etc/sysconfig/network-scripts for your eth0 interface. I can't connect to my cent box from where I am right now so i cant give you much information on syntax or the name of the file. if you chose to go this route (no pun intended) do a quick google search for redhat static route
Thanks for the nudge in the right direction Hewson, I decided to take the network-scripts route (I stole your pun!) instead of using the /etc/rc.local method.
I had to create a file called 'route-eth0' in /etc/sysconfig/network-scripts, and just put this line in:
Code:
0.0.0.0/0 via 192.168.1.1
Seems to have worked fine after restarting the network service, will give a full computer reboot a shot now. Thanks again.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.