0

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?

3 Answers3

2

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

Alien Life Form
  • 2,279
  • 2
  • 21
  • 31
  • 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
2

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
user
  • 1,408
  • 8
  • 10
  • 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 – Valentin Brasso Jan 13 '12 at 17:04
1

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

ewwhite
  • 194,921
  • 91
  • 434
  • 799