Quagga如何配置BGP(转载)

1. Quagga软件的安装与启动

  1. lede如何安装quagga

        opkg update
        opkg install quagga
        opkg install quagga-zebra quagga-ripd quagga-watchquagga quagga-vtysh quagga-bgpd quagga-ospfd
        /etc/init.d/quagga start    #这是启动
        /etc/init.d/quagga enable   #自启动
  2. centos如何安装quagga

        yum update
        yum install quagga -y
  3. 加载BPG配置文件

      启动软件,Zebra和BGPd一起工作,zebra负责和内核通信交互信息,bgpd守护进程负责bgp的路由发布选择等业务。当它们中的任何一个停止运行时,您的路由都将不再发布;
      复制示例文件,作为模板cp /usr/share/doc/quagga-*/bgpd.conf.sample /etc/quagga/bgpd.conf. 启动bgpd守护进程的前置条件是需要存在/etc/quagga/bgpd.conf,同时需要满足执行权限644等基本需求;启动的实例脚本如下:

    #!/usr/bin/sh
    echo """router bgp 600
    bgp router-id 10.42.104.68
    network 10.10.1.10/32
    neighbor 10.42.104.124 remote-as 300
    neighbor 10.42.104.125 remote-as 300
    ! neighbor 10.0.0.2 route-map set-nexthop out
    ! neighbor 10.0.0.2 ebgp-multihop
    ! neighbor 10.0.0.2 next-hop-self
    !route-map set-nexthop permit 10
    !  match ip address all
    !  set ip next-hop 10.0.0.1
    !
    log file bgpd.log
    """ > /etc/quagga/bgpd.conf
    
    chmod 644 /etc/quagga/bgpd.conf
    systemctl start zebra
    systemctl enable zebra
    systemctl start bgpd
    systemctl enable bgpd

    shell终端内输入"vtysh" 可以进入quagga vty,进行配置调整,语法类似思科CISCO; 执行configure terminal进入配置模式,简写'conf t';

2. BGP配置示例

router bgp 4242420524
 bgp router-id 172.20.58.193
 neighbor 172.20.158.143 remote-as 4242421331
 neighbor 172.20.158.143 interface LA_NIA
 neighbor 172.20.158.143 description dn42-LA-NIA-AS4242421331-2020-3-21

 neighbor 172.21.100.193 remote-as 4242423088
 neighbor 172.21.100.193 interface LA_SUNNET
 neighbor 172.21.100.193 description dn42-LA-SUNNET-AS4242423088-2020-3-21

 neighbor fe80::2333 remote-as 4242422541
 neighbor fe80::2333 description dn42-TOK-OXYGEN-AS4242422541-2020-3-21
 neighbor fe80::3088:193 remote-as 4242423088
 neighbor fe80::3088:193 description dn42-LA-SUNNET-AS4242423088-2020-3-21
 neighbor fe80::1331:143:6 remote-as 4242421331
 neighbor fe80::1331:143:6 description dn42-LA-NIA-AS4242421331-2020-3-21
!
 address-family ipv6
 network fd91:7b3d:8d19::/48
 neighbor fe80::2333 activate
 neighbor fe80::3088:193 activate
 neighbor fe80::1331:143:6 activate
 exit-address-family

3. 常见操作

官方文档https://www.quagga.net/docs/quagga.html#Filtering
DN42网络的前缀过滤方式https://dn42.dev/howto/Quagga

  • 查看BGP汇总

        show bgp ipv6 unicast summary
        show  ipv6  bgp  summary
        show  ip  bgp  summary
  • 查看向BGP peer通告的路由

        show bgp ipv6 neighbors  advertised-routes
        show  ip bgp  neighbors  172.20.158.65 advertised-routes
  • 显示从邻居学到的路由

        show  ip bgp  neighbors  172.20.158.65 routes
        show  ipv6 bgp  neighbors  fe80::1331:143:6 routes

转载自https://www.wsfnk.com/archives/1295.html

发表评论

邮箱地址不会被公开。 必填项已用*标注