zoukankan      html  css  js  c++  java
  • Quagga BGP and exabgp: work together for BGP blackhole implementation

    Quagga BGP and exabgp: work together for BGP blackhole implementation

    In our test case we will deploy two machines: 10.0.3.114 for exabgp (it announce /32 prefix for blackholing on core router side) and 10.0.3.115 (it emulates core router). We will do this work on Debian 8 Jessie.

    Install exabgp:

    pip install exabgp

    Create ExaBGP configuration:

    vim /etc/exabgp_blackhole.conf

    Here you can find example for exabgp configuration:

    group Core_v4 {
    hold-time 180;
    local-as 65001;
    peer-as 1234;
    router-id 10.0.3.114;
    graceful-restart 1200;
     
    static {
    route 10.10.10.1/32 next-hop 10.0.3.114 community 65001:666;
    }
     
    neighbor 10.0.3.115 {
    local-address 10.0.3.114;
    description "Quagga";
    }
    }

    We specify current machine IP as next hop because without it Quagga ignores it: 10.0.3.114 rcvd UPDATE about 10.10.10.1/32 — DENIED due to: martian next-hop;

    Start exabgp:

    env exabgp.daemon.user=root exabgp.daemon.daemonize=true exabgp.daemon.pid=/var/run/exabgp.pid exabgp.log.destination=/var/log/exabgp.log exabgp /etc/exabgp_blackhole.conf

    I recommend you to open log file and look at it:

    tail -f /var/log/exabgp.log exabgp

    Now we will install Quagga.

    Install package:

    apt-get install -y quagga

    Enable BGP daemon in Quagga:

    vim /etc/quagga/daemons

    And change following lines:

    zebra=yes
    bgpd=yes

    Then you should create config files and fix permissions for they:

    touch /etc/quagga/zebra.conf
    touch /etc/quagga/bgpd.conf
    touch /etc/quagga/quagga.conf
    chown quagga:quagga /etc/quagga/bgpd.conf
    chown quagga:quagga /etc/quagga/zebra.conf
    chown quagga:quagga /etc/quagga/quagga.conf

    Create BGP configuration:

    vi /etc/quagga/bgpd.conf

    Example for configuration (please be aware! It’s not suitable for production):

    hostname SoftBGP
    password zebra987
    enable password zebra987
    log file /var/log/quagga/bgpd.log
     
    debug bgp events
    debug bgp filters
    debug bgp fsm
    debug bgp keepalives
    debug bgp updates
     
    router bgp 1234
    bgp router-id 10.0.3.115
    bgp log-neighbor-changes
     
    neighbor 10.0.3.114 remote-as 65001

    Apply configuration:

    /etc/init.d/quagga restart

    Wow! We see this announce in Quagga:

    /usr/bin/vtysh -d bgpd -c "show ip bgp summary"
    BGP router identifier 10.0.3.115, local AS number 1234
    RIB entries 1, using 112 bytes of memory
    Peers 1, using 4568 bytes of memory
     
    Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
    10.0.3.114 4 65001 12 18 0 0 0 00:01:12 1
     
    Total number of neighbors 1

    Check announced subnets from exabgp:

    /usr/bin/vtysh -d bgpd -c "show ip bgp"
    BGP table version is 0, local router ID is 10.0.3.115
    Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
    i internal, r RIB-failure, S Stale, R Removed
    Origin codes: i - IGP, e - EGP, ? - incomplete
     
    Network Next Hop Metric LocPrf Weight Path
    *> 10.10.10.1/32 10.0.3.114 0 65001 i
     
    Total number of prefixes 1
  • 相关阅读:
    [Swift]关键字:class与staitc的区别
    [Swift]LeetCode1171. 从链表中删去总和值为零的连续节点 | Remove Zero Sum Consecutive Nodes from Linked List
    [Swift]LeetCode1172. 餐盘栈 | Dinner Plate Stacks
    [Swift]LeetCode1170. 比较字符串最小字母出现频次 | Compare Strings by Frequency of the Smallest Character
    [Swift]LeetCode1169. 查询无效交易 | Invalid Transactions
    [Swift]LeetCode1167. 连接棒材的最低费用 | Minimum Cost to Connect Sticks
    [Swift]LeetCode1166.设计文件系统 | Design File System
    [Swift]LeetCode1165. 单行键盘 | Single-Row Keyboard
    [Swift]LeetCode1168. 水资源分配优化 | Optimize Water Distribution in a Village
    METRO风格
  • 原文地址:https://www.cnblogs.com/dream397/p/13287829.html
Copyright © 2011-2022 走看看