解析VTY Shell配置路由器

防火墙配置

由于 RIP 协议使用 UDP 作为传输协议,并被分配了 520 端口,因此我们需要在 firewalld 配置中允许该端口。


  1. firewall-cmd --add-port=520/udp permanent
  2. firewalld-cmd -reload

现在,我们可以使用以下命令启动 FRR 服务:


  1. systemctl start frr

使用 VTY 进行配置

现在,我们需要使用 VTY Shell 配置 RIP。

在主机 Alpha 上:


  1. [root@alpha ~]# vtysh
  2.  
  3. Hello, this is FRRouting (version 7.2RPKI).
  4. Copyright 1996-2005 Kunihiro Ishiguro, et al.
  5.  
  6. alpha# configure terminal
  7. alpha(config)# router rip
  8. alpha(config-router)# network 192.168.122.0/24
  9. alpha(config-router)# network 10.10.10.0/24
  10. alpha(config-router)# route 10.10.10.5/24
  11. alpha(config-router)# do write
  12. Note: this version of vtysh never writes vtysh.conf
  13. Building Configuration...
  14. Configuration saved to /etc/frr/ripd.conf
  15. Configuration saved to /etc/frr/staticd.conf
  16. alpha(config-router)# do write memory
  17. Note: this version of vtysh never writes vtysh.conf
  18. Building Configuration...
  19. Configuration saved to /etc/frr/ripd.conf
  20. Configuration saved to /etc/frr/staticd.conf
  21. alpha(config-router)# exit

类似地,在主机 Beta 上:


  1. [root@beta ~]# vtysh
  2.  
  3. Hello, this is FRRouting (version 7.2RPKI).
  4. Copyright 1996-2005 Kunihiro Ishiguro, et al.
  5.  
  6. beta# configure terminal
  7. beta(config)# router rip
  8. beta(config-router)# network 192.168.122.0/24
  9. beta(config-router)# network 10.12.11.0/24
  10. beta(config-router)# do write
  11. Note: this version of vtysh never writes vtysh.conf
  12. Building Configuration...
  13. Configuration saved to /etc/frr/zebra.conf
  14. Configuration saved to /etc/frr/ripd.conf
  15. Configuration saved to /etc/frr/staticd.conf
  16. beta(config-router)# do write memory
  17. Note: this version of vtysh never writes vtysh.conf
  18. Building Configuration...
  19. Configuration saved to /etc/frr/zebra.conf
  20. Configuration saved to /etc/frr/ripd.conf
  21. Configuration saved to /etc/frr/staticd.conf
  22. beta(config-router)# exit

完成后,像下面这样检查两台主机路由:


  1. [root@alpha ~]# ip route show
  2. default via 192.168.122.1 dev eth0 proto static metric 100
  3. 10.10.10.0/24 dev eth1 proto kernel scope link src 10.10.10.12 metric 101
  4. 10.12.11.0/24 via 192.168.122.50 dev eth0 proto 189 metric 20
  5. 192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.100 metric 100

我们可以看到 Alpha 上的路由表通过 192.168.122.50 包含了 10.12.11.0/24 的条目,它是通过 RIP 提供的。

类似地,在 Beta 上,该表通过 192.168.122.100 包含了 10.10.10.0/24 的条目。

【声明】:芜湖站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

相关文章