enabling ip forwarding - installation and configuration of Quagga - configuring OSPF

http://140.105.28.115/sandbox/groups/school2010/wiki/9ac7b/attachments/71c41/LAB-2-exercises.pdf?sessionID=9a8210f774a7df11859cbf3e9f73084e7f06f7ee


Materials covered in this lab include:


enabling ip forwarding
installation and configuration of Quagga
configuring OSPF between our three (or more) systems



IP forwarding needs to be enabled in the Linux kernel before the system will forward between interfaces.

This is done via a kernel sysctl value.

To enable forwarding from the command line type:

sysctl -w net.ipv4.ip_forward=1

To enable forwarding for ipv6 from the command line type:

sysctl -w net.ipv6.conf.all.forwarding=1

To insure that these values survive a reboot it is necessary to edit /etc/sysctl.conf where you uncomment

#net.ipv4.ip_forward=1

and

#net.ipv6.conf.all.forwarding=1

Once this is done, it is now possible to create a subnet and assign an ip address to a second interface and then forward a packet arriving on one interface to a destination located on another.

Installing Quagga

Quagga is the routing software suite that we're going to use to support dynamic routing.

We can install it on ubuntu by typing:

$ sudo apt-get install quagga

once installed:

cd /etc/quagga

We need to edit the daemons file, we are going to enable the zebra and ospfd daemons

edit /etc/quagga/daemons and change:

zebra=no
ospfd=no

to yes

before either of the daemons will start configuration files need to be copied into place.

$ sudo cp /usr/share/doc/quagga/examples/zebra.conf.sample /etc/quagga/zebra.conf
$ sudo cp /usr/share/doc/quagga/examples/ospfd.conf.sample /etc/quagga/ospfd.conf

and have their permissions changed:

$ sudo chown quagga.quaggavty /etc/quagga/*.conf
$ sudo chmod 640 /etc/quagga/*.conf

now you can start the routing daemons by typing:

/etc/init.d quagga start

verify that they have started by typing:

ps -fu quagga

The quagga daemons have a cisco style cli, each one listens on it's own port, by default they only listen on localhost. You can telnet to them by typing:

telnet localhost 2601 (for zebra)
telnet localhost 2604 (for ospfd)

log in with the default password (zebra)

lets configure vtysh so that we don't have to use telnet to each individual daemon.

Copy the vtysh config file into place:

cp /usr/share/doc/quagga/examples/vtysh.conf.sample /etc/quagga/vtysh.conf

Edit

/etc/quagga/vtysh.conf

set the hostname entry to:

hostname localhost

then save the file and fix the permissions again:

chown quagga.quaggavty /etc/quagga/*.conf
chmod 640 /etc/quagga/*.conf

then restart quagga

/etc/init.d/quagga restart

set the vtysh pager to something reasonable otherwise actually using it is rather ugly.

$ sudo echo VTYSH_PAGER=more >> /etc/environement

rather than reread the environment we can simply do the following to make this shell work better.

$ export VTYSH_PAGER=more

Interacting with the router

now type:

$ sudo vtysh

once you're at the prompt, you're talking to the combined zebra and ospf routing processes.

# show running-config

the cli from now on is cisco style.

For the sake of generating a combined configuration file type:

# write

Now there is a Quagga.conf configuration file that accurately reflects the contents of both preexisting configuration files...

# exit

you can now remove /etc/quagga/zebra.conf and /etc/quagga/ospfd.conf and restart quagga and the daemons will use the new config.

Configuration

for those of you that know Cisco routers this will seem fairly familiar.

from the command line

$ sudo vtysh
# configure terminal
# router-id 10.X.254.Y

where the X is the group and Y is the pc number

configure interface eth0:1

# interface eth0:1
# ip address 10.x.0.y/26
# description backbone
# ipv6 nd suppress-ra
# exit

configure interface eth0:2

# interface eth0:2
# description host subnet N

replace N with your PC number

# ip address 10.x.y.1/24
# ipv6 nd suppress-ra
# exit

back up one more level

# exit
# show running-config

then write the configuration

# write

Configure OSPF

# conf t
# router ospf
# network 10.X.0.0/16 area 0.0.0.0
# exit

Add a password for the ospf process on the network interface where we're going to be using it.

# interface eth0:1
# ospf authentication-key groupX

where X is the group number.

Back out and write the configuration

# exit
# exit
# write

Now, we are going to configure a static route for an attached subnet, and redistribute that route into ospf

# conf t
# ip route 10.X.Y.0/24 eth0:2
# router ospf
# redistribute static
# exit
# exit
# write

Checking the status of your ospf process

localhost# show ip route
localhost# show ip ospf neighbor

Done with ospf exercise, you should now be able to ping any of the router interfaces within your group.
posted @ 2017-06-04 20:41  张同光  阅读(145)  评论(0编辑  收藏  举报