enabling ip forwarding - installation and configuration of Quagga - configuring OSPF
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 cp /usr/share/doc/quagga/examples/zebra.conf.sample /etc/quagga/zebra.conf
sudo chown quagga.quaggavty /etc/quagga/*.conf
sudo echo VTYSH_PAGER=more >> /etc/environement
rather than reread the environment we can simply do the following to make this shell work better.
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.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于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最大的设计失误
· 单元测试从入门到精通