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:

sudoaptgetinstallquaggaonceinstalled:cd/etc/quaggaWeneedtoeditthedaemonsfile,wearegoingtoenablethezebraandospfddaemonsedit/etc/quagga/daemonsandchange:zebra=noospfd=notoyesbeforeeitherofthedaemonswillstartconfigurationfilesneedtobecopiedintoplace. sudo cp /usr/share/doc/quagga/examples/zebra.conf.sample /etc/quagga/zebra.conf
sudocp/usr/share/doc/quagga/examples/ospfd.conf.sample/etc/quagga/ospfd.confandhavetheirpermissionschanged: sudo chown quagga.quaggavty /etc/quagga/*.conf
sudochmod640/etc/quagga/.confnowyoucanstarttheroutingdaemonsbytyping:/etc/init.dquaggastartverifythattheyhavestartedbytyping:psfuquaggaThequaggadaemonshaveaciscostylecli,eachonelistensonitsownport,bydefaulttheyonlylistenonlocalhost.Youcantelnettothembytyping:telnetlocalhost2601(forzebra)telnetlocalhost2604(forospfd)loginwiththedefaultpassword(zebra)letsconfigurevtyshsothatwedonthavetousetelnettoeachindividualdaemon.Copythevtyshconfigfileintoplace:cp/usr/share/doc/quagga/examples/vtysh.conf.sample/etc/quagga/vtysh.confEdit/etc/quagga/vtysh.confsetthehostnameentryto:hostnamelocalhostthensavethefileandfixthepermissionsagain:chownquagga.quaggavty/etc/quagga/.confchmod640/etc/quagga/.confthenrestartquagga/etc/init.d/quaggarestartsetthevtyshpagertosomethingreasonableotherwiseactuallyusingitisratherugly. sudo echo VTYSH_PAGER=more >> /etc/environement

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

exportVTYSHPAGER=moreInteractingwiththerouternowtype: 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 @   张同光  阅读(156)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示