22 February 2014

Netmask doesn't make sense with host route, SIOCADDRT: No such process,

I had this weird situation that no where in hell I could make my new VM get connected to the network.

It was a new machine just installed with RHEL 6.5, the VM settings were all good, it has connected to the right Virtual Network which it suppose to connect to in VM settings, the other VMs residing on the same Esxi host are all good and settings are all same, and I was like gazillion times checked every bloody settings.

The IP that I had received from our beloved network team was like below:

IP       : 10.8.230.64
Netmask  : /26 (255.255.255.192)
Gateway  : 10.8.230.1

I have assigned this bloody IP  to eth0, the result of ifconfig was same as other VMs but not exactly the same:

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:56:B7:4A:60
          inet addr:10.8.230.7  Bcast:10.8.230.127  Mask:255.255.255.192
          inet6 addr: fe80::250:56ff:feb7:4a60/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2316339922 (2.1 GiB)  TX bytes:5178740184 (4.8 GiB)

in other VMs:

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:56:B7:4A:60
          inet addr:10.8.230.7  Bcast:10.8.230.63  Mask:255.255.255.192
          inet6 addr: fe80::250:56ff:feb7:4a60/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:20325009 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21530575 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2316514207 (2.1 GiB)  TX bytes:5178978642 (4.8 GiB)


And I was wondering how come network card comes up with different Broadcast while the settings of both VMs are the same.


Another issue was that default gateway was't set:

# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.8.230.0      0.0.0.0         255.255.255.192 U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0

and when I tried to set the default gateway manually, I receive this error:

# route add default gw 10.8.230.1 eth0
SIOCADDRT: No such process

and when I tried to estate the obvious and first add the route to the gateway, error was:

# route add 10.8.230.1/26 dev eth0
route: netmask 0000003f  doesn't make sense with host route

and I'm like whattt on earth?! I even couldn't ping the default gw which makes me check the VM network settings from VMware side like 10 times!


Finally after all usual checks, I needed to check the obvious! I put the network team given IP and its netmask to an IP calculator, guess what?! Following is the result of the IP calculator:


Address:   10.8.230.7            00001010.00001000.11100110.00 000111
Netmask:   255.255.255.192 = 26  11111111.11111111.11111111.11 000000
Wildcard:  0.0.0.63              00000000.00000000.00000000.00 111111
=>
Network:   10.8.230.0/26         00001010.00001000.11100110.00 000000 (Class A)
Broadcast: 10.8.230.63           00001010.00001000.11100110.00 111111
HostMin:   10.8.230.1            00001010.00001000.11100110.00 000001
HostMax:   10.8.230.62           00001010.00001000.11100110.00 111110
Hosts/Net: 62                    (Private Internet)


You got it?! The given IP is out of the bloody range based on its netmask! 
IP range 10.8.230.0 with mask /26 (255.255.255.192) has max of 10.8.230.62 and my IP was: 10.8.230.64, fantastic!


Gawd! Sometimes really need to check the obvious and not just simply rely on your network team!





No comments:

Post a Comment