Thursday, July 9, 2009

Using zebra for OSPF


Zebra


Grab zebra.conf and ospfd.conf, copy them to /usr/local/etc.

Now start zebra:
# service zebra restart

And connect to the zebra daemon:
# telnet localhost zebra

If you can't connect then check /var/log/zebra.log to see if it has any excuses.

The default password is 'fish', now we are going to change it.

First we put zebra in 'enable' mode (this is a lot like suing to root).
zebra> enable

Yup, the password is fish again. The prompt should change to a # after you've typed it. (you should see something like this):
zebra> enable
Password:
zebra#

Now we need to tell zebra we're going to configure it, so type:
zebra# configure terminal

At this point it's probably helpful to point out that zebra supports command line editing, tab completion, and command history...

If your offered multiple choices when you hit tab you can type '?' to get brief help on the commands available.

Your screen should look something like this:
zebra# configure terminal 
zebra(config)#

First things first, lets change those passwords
zebra(config)# 
zebra(config)# password “passwd”
zebra(config)# enable password “passwd”

Ok, lets check the changes we made, first, type exit to get out of configure mode, then:
zebra# show running-config

You can abrieviate it to sh run if you like.

You can now page through the config file, now with new encrypted passwords!

You'll also notice something else - remember all those comments that where in the config file? Well zebra ignores them, and they will dissapear... (yes, this does suck).

Press space to page through the end of the config file

Now we'd better change the hostname to the hostname (or nodename) of this box. This will help if you ever cut and paste stuff from zebra to show other people for debuging reasons, or if you have multiple machines.

Enter config mode as we did before and then type:
zebra(config)# hostname “yourhostname”
“yourhostname”(config)#

As you can see the prompt changes to the hostname you just set

Saving your changes


This is important! if you forget to do this all your changes will be lost

in enable mode type copy running-config startup-config, you should see something like this:
“yourhostname”# copy running-config startup-config 
Configuration saved to /usr/local/etc/zebra.conf
“yourhostname”#

copy running-config startup-config can be, (and usually is), abbreviated to cop run sta. Say it out load in any pub and anyone who's ever been anywhere near a cisco will look around them in surprise and alarm.

Seriously tho, this is the most common cause of problems with zebra and cisco IOS, you forget to save the config, the box gets rebooted later (weeks? months?) and it dosn't work.

So as you lie awake in bed tonight repeat cop run sta to yourself 50 times. One day you may even thank me for it.

On another note (unless your configureing static routes) you'll probably never need to touch zebra again.

ospfd


Ok, run ospfd:
# service ospfd restart

and connect to it:
% telnet localhost ospfd

Now log in as you did with zebra, and change the passwords and the hostname.
list interfaces
choose which ones to use
enable ospf
router-id
redistribute connected route-map just-10
passive-interface unused interfaces
add a 'description' to the interfaces you plan to use.
add a 'cost' to the interfaces you plan to use.
generate a md5 'key' (just 8 hex digits).
then, in the 'router ospf' section:
network base/mask area 0
now exit out of config mode
'sh ip ospf neighbor'
'sh ip ospf database'
run a packet sniffer to check
'terminal moniter' to get logging to your terminal
'no terminal moniter' to switch it off.
fiddle.

0 comments:

Post a Comment