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

We have a sandbox server running CentOS that we run inside our office. Our ISP has assigned us a block of 5 static IPs. We now want to assign it a static IP.

DEVICE=eth0
BOOTPROTO=none # have also tried "static" here
HWADDR=00:13:72:*:*:*
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=173.*.*.161
GATEWAY=10.1.10.1

/etc/resolv.cnf is also set with the appropriate name servers from our ISP.

When I ifdown eth0 then ifup eth0 I get...

SIOCADDRT: Network is unreachable

When I switch to DCHP, the machine has an IP assigned and there are no connection problems.

Any ideas?

share|improve this question

4 Answers 4

up vote 5 down vote accepted

The IP Address and gateway are in 2 totally different networks. So change your gateway or IP address to an address within the same network.

NETMASK=255.255.255.0
IPADDR=173.*.*.161    <--
GATEWAY=10.1.10.1     <--
share|improve this answer
    
yep. you are correct. not sure how I missed that one. thanks. –  nategood Apr 9 '10 at 22:03

You gateway address and your ip address must be on the same subnet. When the machine gets a DHCP assigned IP, what is the default gateway that gets assigned? Try using that.

share|improve this answer

Personally, I'd pull down the networks and configure it manually so you can see what is what.

ifconfig the device manually (ifconfig eth0 1.1.1.1 up I think it was)

Try and ping a gateway, then add it manually route add default gw 1.2.3.4 once you figure out exactly what it was. Everything should fall through from there.

Note, you may need the netmask in your ifconfig command.

share|improve this answer

Further to PowerSp00n's answer regarding the wrong gateway (and you really do have 5 IP addresses) your subnet mask should be 255.255.255.248 (/29).

share|improve this answer
    
This isn't true, a block of IP addresses you get isn't the same as a subnet. An ISP can give you a few addresses out of an larger subnet. –  PowerSp00n Apr 10 '10 at 10:23
    
he said "block of 5 IP addresses" -- the key term here is block, if it was a few IP addresses from different subnets (which is rare anyways) it wouldn't be called a block. –  gravyface Apr 10 '10 at 12:44
    
Like I said, a block of IP addresses isn't (always) the same as a subnet. A subnet is a block and a block can be a subnet. You can't assume he has a subnet and is using the wrong netmask. –  PowerSp00n Apr 10 '10 at 16:16

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.