Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've installed a fresh copy of the latest CentOS via iLO (HP's integrated lights out 2). The setup type was Web Server. My server doesn't seem to be able to connect to the Internet anymore. I've lost the old settings for DHCP and hostname but I have the old settings for eth0 and DNS server, still there's something else I should be doing to be able to use wget, yum, ping and to have SSH access from other locations, but I can't seem to find what that is.

Any pointers? Thanks.

Edit: route command:

route
Kernel IP routing table
Destination Gateway Genmask       Flags Metric Ref Use Iface
xx.xx.68.0  *       255.255.255.0 U     0      0    0  eth0
link-local  *       255.255.0.0   U     1002   0    0  eth0

Note that the server IP is xx.xx.68.176, should I change the route?

share|improve this question
    
do you have a route to a gateway? –  user Jan 13 '12 at 11:43
    
@user I've updated my question –  altvali Jan 13 '12 at 11:53
1  
Could you post your /etc/sysconfig/network-scripts/ifcfg-eth0 and /etc/sysconfig/network files, then perhaps we can advise on whether/how to put a GATEWAY= entry therein? –  MadHatter Jan 13 '12 at 13:54

3 Answers 3

up vote 2 down vote accepted

Do a

route add default gw xx.xx.68.1(?) #Gateway's IP

Or follow what @ewwhite said you should configure your network properly because there are scripts like if-up,if-down that take care of interface mishaps like yours

EDIT: Even better after @Lucas' comment go to your /etc/network/interface and add

iface eth0 inet static
address xx.xx.68.176
netmask 255.255.255.0
gateway xx.xx.68.xx

You can always send a new request to your dhcp server by doing which will get lost after a reboot

dhclient eth0

or by adding to your /etc/network/interface

iface eth0 inet static
share|improve this answer
    
It's better to do it in /etc/network/interfaces, saves you a lot of headaches when you reboot. –  Lucas Kauffman Jan 13 '12 at 12:52
    
I agree with the above reasoning, but that code looks an awful lot like a debian-style interfaces file, and isn't (afaik) suitable for use with a CentOS-style /etc/sysconfig/network-scripts/ifcfg-eth0 file) –  MadHatter Jan 13 '12 at 13:53
    
I agree with MadHatter, I've learned that in CentOS 5.2+ /etc/network/interfaces was replaced with /etc/sysconfig/network-scripts/ifcfg-eth0 ; I've found the right gateway (it was xx.xx.68.253) and it all seemed to work until a couple of minutes ago when I've left the office and got word that the SSH access no longer works. I'll be marking the right answer when this mistery is solved –  altvali Jan 13 '12 at 17:04

Can you run system-config-network, fill in your network configuration information and restart the network services? /sbin/service network restart

share|improve this answer

I'd say you are missing the default route - sometimes called the gateway.

share|improve this answer
    
How about updating your answer to talk about how to update routing information on CentOS? Right now your answer while correct is not very useful. –  Red Tux Jan 13 '12 at 12:19
    
Uh, I would have, but this xxx.yyy etc. game gets old fast - Some detail on the rest of the network would have helped. I see others are filling the gap tho'. –  Alien Life Form Jan 13 '12 at 14:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.