Linux Noob Question RE internet access.

Mars

Honorary Master
Joined
Feb 4, 2006
Messages
11,321
If I putty into my CentOS server and try o do an update it tells me that he network is unreachable.
If I ping Google it also says network unreachable, however I can ping any machine on the local network.

I know I used to be able to access the internet from this box, what could have changed to stop it from accessing it now?
 

w1z4rd

Karmic Sangoma
Joined
Jan 17, 2005
Messages
49,747
Can you ping an internet ip? like 8.8.8.8? If you can your problem is dns and you can fix it by editing /etc/resolv.conf.

If not, you need to setup a gateway, dns and routing.
 

Mars

Honorary Master
Joined
Feb 4, 2006
Messages
11,321
I cannot ping 8.8.8.8

I checked resolv.conf. and the only thing in it is the default gateway...

I know I had internet access on this machine before. :confused:
 

Silver-0-surfer

Well-Known Member
Joined
Jan 5, 2008
Messages
317
resolv.conf is not for the default gw its for DNS.

check /etc/sysconfig/network-scripts/ifcfg-eth0 (if you using eth0) that should have default gw, netmask etc..
check if all thats right
 

MyWorld

Executive Member
Joined
Mar 24, 2004
Messages
5,001
In resolv.conf change the settings to the IP of your router like so:
Code:
nameserver 192.168.0.1
 

w1z4rd

Karmic Sangoma
Joined
Jan 17, 2005
Messages
49,747
Whats the ip of your router?

When you type: ifconfig what is the print out?

If you know the ip of your router/gateway then enter this command:

route add default gw 192.168.1.254 eth0

Just make sure the ip listed as 192.168.1.254 is the ip of your router/gateway

In resolv.conf you should have:

nameserver 192.168.1.254

Where once again the IP is that of your router/gateway
 
Last edited:

avert

Senior Member
Joined
Jul 13, 2009
Messages
742
or if your router is running dhcp, like 99% of them do

dhclient eth0
 
Top