CCIE Pursuit Blog

May 29, 2007

Cool OSPF/EIGRP Trick

Filed under: Cool Commands,IOS,Tech Tips — cciepursuit @ 11:15 am

So you’re labbing away and the scenario asks for an interface to be configured with an IP address in the 137.1.2.0/27 subnet.  You don’t reach for the IP calculator as you know that this will not be available on the lab, but instead you activate the part of your brain that speaks binary and come up with the correct configuration:

interface GigabitEthernet0/0
 description ->VLAN22 137.1.2.0/27
 ip address 137.1.2.2 255.255.255.224
 duplex auto
 speed auto
end

Now you need to advertise this network in OSPF or EIGRP.  Crap.  Now you need to convert the subnet mask to wildcard bits*.  This isn’t rocket science, but it is another opportunity for you to make a minor error that will bite you in the butt later.

*I know that the best method for doing this is to simply use the IP address of the interface with an all-zeros wildcard mask, but I’ll blog on that another time.

Thankfully, there is an IOS “trick” you can use with EIGRP (I assume IGRP as well) and OSPF.  Instead of entering a wildcard mask, just enter in the subnet mask (the same one you configured the interface with) and IOS will make the conversion for you:

Use the Subnet Mask Instead of the Wildcard Mask:
r2(config)#router os 100
r2(config-router)#net 137.1.2.2 255.255.255.224 area 0

IOS Makes the Conversion for you:
r2(config-router)#do sh run | sec ospf
router ospf 100
 log-adjacency-changes
 network 137.1.2.0 0.0.0.31 area 0

Advertisements

1 Comment »

  1. that is awesome, thanks!

    Comment by Shay — October 15, 2008 @ 9:47 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: