0

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?

nategood
  • 165
  • 1
  • 10

4 Answers4

6

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     <--
PowerSp00n
  • 1,506
  • 1
  • 8
  • 8
1

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.

kbyrd
  • 3,604
  • 2
  • 23
  • 34
0

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.

Jay
  • 6,439
  • 24
  • 34
0

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).

gravyface
  • 13,947
  • 16
  • 65
  • 100
  • 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