1

Maybe I'm doing a rookies mistake but I can't find out what I'm doing wrong. On a Centos Box, I want to put static ip on my server so edited /etc/sysconf/network-scripts/ifcfg-eth0 as follow:

# Intel Corporation 82579V Gigabit Network Connection
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.7.255
DHCPCLASS=
HWADDR=4C:72:B9:24:20:1B
IPADDR=192.168.2.200
NETMASK=255.255.240.0
NETWORK=192.168.0.0/20
ONBOOT=yes
TYPE=Ethernet
NOZEROCONF=yes

Edited also /etc/sysconfig/network to this:

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=conmutador
GATEWAY=192.168.1.1

And finally /etc/resolv.conf

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=conmutador
GATEWAY=192.168.1.1

As expected I'm successfully pinging clients on 192.168.0.0, 192.168.1.0, 192.168.2.0 subnets but when I try to ping the router (192.168.1.1) doesn't get any answer... Also not having internet access of course (as the box can't reach the router). What am I doing wrong ?

UPDATE... Changed to follow Gregg's advice:

# Intel Corporation 82579V Gigabit Network Connection
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.7.255
HWADDR=4C:72:B9:24:20:1B
IPADDR=192.168.2.200
NETMASK=255.255.240.0
NETWORK=192.168.0.0
GATEWAY=192.168.0.1
ONBOOT=yes
TYPE=Ethernet
NOZEROCONF=yes

etc/sysconfig/network:

 NETWORKING=yes
 NETWORKING_IPV6=no
 HOSTNAME=conmutador

/etc/resolv.conf:

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=conmutador

Still having the problem...

UPDATE 2

netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.0.0     *               255.255.240.0   U         0 0          0 eth0
default         192.168.0.1     0.0.0.0         UG        0 0          0 eth0
Luis M. Valenzuela
  • 107
  • 1
  • 1
  • 9
  • Check if the system has an ARP entry for the gateway (after trying to ping it): `arp -n 192.168.1.1`. – mgorven Feb 22 '13 at 21:37
  • You posted the same thing for your network file and your resolv.conf file. At any rate, do you have the ability to do a packet capture on the router? If so, check to see if it's receiving the ICMP packets and then dropping them due to an access rule – Safado Feb 22 '13 at 21:37
  • Also, your broadcast is the broadcast of a /21 network.. but as Gregg mentioned, just remove the /20 altogether – Safado Feb 22 '13 at 21:40
  • is it CentOS 6? Check the interface name. On my node I got em0 instead of eht0. what is the outpot of netstat -r? – kofemann Feb 22 '13 at 22:27

1 Answers1

0

you don't need the /20 on the NETWORK directive you already have the NETMASK defined. you can also remove DHCPCLASS line altogether. Your /etc/resolv is totally wrong it should have the nameserver dnsserverIP not be the same as sysconfig/network. Also your gateway should be in your ifcfg-eth0 file, not your networking file. I assume your actual IP/subnet info is accurate, im too tired to subnet a /20 in my head. :)

Actually your subnetting doesn't look right to me. Are you sure that your Gateway is 192.168.1.1? How do you know this network is a /20? Where are you getting this info?

Yeah, it's wrong. I think your Gateway would have to be 192.168.0.1 and your BCAST would be 192.168.15.255 if it's really a /20.

  • Done the changes you told me Gregg, but still having the same problem... # Intel Corporation 82579V Gigabit Network Connection DEVICE=eth0 BOOTPROTO=static BROADCAST=192.168.7.255 HWADDR=4C:72:B9:24:20:1B IPADDR=192.168.2.200 NETMASK=255.255.240.0 NETWORK=192.168.0.0 GATEWAY=192.168.0.1 ONBOOT=yes TYPE=Ethernet NOZEROCONF=yes – Luis M. Valenzuela Feb 22 '13 at 21:46
  • Are you certain that your IP info is correct? The network you refer to doesn't make sense to me, where did you get the gateway and broadcast info from? Where did you get that network address info? They have to match each other properly. –  Feb 22 '13 at 21:49
  • Actually, I'm not even sure this can work.. You have a class c address with a class b subnet I think.. Networking is not my strong suite, but something is definitely wrong.. Where are you getting this network info? You sure this isnt just a /24? –  Feb 22 '13 at 21:50
  • I've got the ip form http://jodies.de/ipcalc – Luis M. Valenzuela Feb 22 '13 at 21:58
  • Gregg, you can do it... it's called "supernetting". His /21 is essentially the same as 8 class C's. In this case the subnet id is 192.168.0.0 and the broadcast is 192.168.7.255 – Safado Feb 22 '13 at 21:58
  • What I'm trying to achieve is to keep similar stuff in a different subnet...ip-phones and servers on 192.168.2.xxx, computers on 192.168.1.xxx and servers, routers and switches on 192.168.0.xxx – Luis M. Valenzuela Feb 22 '13 at 22:02
  • Then you probably shouldn't be using a supernet.. One thing you have to consider is that they all have the same broadcast network... which will cause a lot of chatter! Why not create multiple /24 networks? One network for the computers, one for the servers, one for the routers, etc.. – Safado Feb 22 '13 at 22:05
  • Oh and Gregg, in regard to your latest edit ... your gateway can be ANY ip address within the usable range of the network. It doesn't have to be 192.168.0.1.... it has to be the IP address of his gateway, which is router, which can have whatever IP address he wants to give it within his subnet. Besides, that's still not the issue of why he can't reach the router, as 192.168.1.1 is still in the range of his network, so it's going to be switched and not routed, so the gateway isn't even going to be used. – Safado Feb 22 '13 at 22:07
  • Thanks Safado. I have never personally seen a Gateway address that wasn't the first usable host address of a network, but I guess it is possible to use any available IP. –  Feb 22 '13 at 22:11
  • Safado, and how do you manage to share the common stuff to all subnets, like router, servers, etc ? – Luis M. Valenzuela Feb 22 '13 at 22:12
  • When you say "share stuff" I'm assuming you mean how do they communicate? At this point, each subnet would have to have its own gateway. If you only have one router, you'll have to set up VLANs on sub-interfaces of that gateway. Then when devices from one subnet needs to talk to a server on another, the traffic is routed through the gateway instead of switched like in your original setup. – Safado Feb 22 '13 at 23:01
  • Thanks Safado. The problem is that in the router I have, I can't make vlans...that's why I was trying to supernet... guess due the network will hardly have more than 253 host (inlcluding the router and servers) I'll have to put everything on the same network segment... – Luis M. Valenzuela Feb 22 '13 at 23:19