I'm a UNIX Sysadmin, specializing in Solaris and Linux. We should ALL know this stuff, but sometimes a trick or tip slips by, so every time I teach someone a neat trick (or someone teaches me a neat trick) it'll get shared here.

Tuesday, April 14, 2009

Assumptions can be dangerous...

[output truncated]

eth0 Link encap:Ethernet HWaddr 00:50:da:b4:ac:48
inet addr:10.2.12.97 Bcast:1.255.12.255 Mask:255.255.255.0

$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.2.12.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 10.2.12.1 0.0.0.0 UG 0 0 0 eth0


# ifconfig eth1 10.12.12.98 up
connection timed out.


What just happened?

Well, a further explanation is probably required.
eth0 is on a /24, and eth1 was supposed to be a /24 as well.
See the problem yet?
no?
Let's get on the console of the box:


# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:8e:cb:a8
inet addr:10.12.2.97 Bcast:10.12.2.255 Mask:255.255.255.0

eth1 Link encap:Ethernet HWaddr 00:0c:29:8e:cb:b2
inet addr:10.12.12.98 Bcast:10.255.255.255 Mask:255.0.0.0


See the problem? No? let's check the routing table:

# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.12.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1
0.0.0.0 10.12.2.1 0.0.0.0 UG 0 0 0 eth0



See it now?

This is the problem with making assumptions. In this case, the operations person made the assumption that the netmask provided in their original ifconfig would be what they wanted. It obviously was not.

You now have two conflicting routes, one route for a /24 and one route for an /8.

ifconfig, if not given a netmask will default the mask to the "class" of the IP given. In this case, a 10-dot will default to a class A, or a /8.
You can imagine what happened then.

While this might seem like a simple thing, i've had 2 operations guys bring down production boxes doing just this, in less than 3 months.

The lesson: Make sure you understand the defaults of your commands.
And, change windows are your friends. They keep people from breathing down your neck when you screw up like this.

No comments:

Post a Comment

About Me

My photo
I am currently a Unix Systems Engineer for a cloud-based EMR company. I've been making large, complex systems "go" since 1995. I've worked with Novell and Exchange in the past, and now specialize in Solaris and Linux.