AR100, AR120, AR150, AR160, AR200, AR1200, AR2200, AR3200, and AR3600 V200R010 CLI-based Configuration Guide - IP Unicast Routing

This document describes the concepts and configuration procedures of IP Service features on the device, and provides the configuration examples.

Example for Configuring AS_Path Filters

Example for Configuring AS_Path Filters

Networking Requirements

On the network shown in Figure 9-30, Router B establishes EBGP connections with Routers A and C. The user wants to disable the devices in AS 10 from communicating with devices in AS 30.

Figure 9-30 Networking diagram for configuring AS_Path filters

Configuration Roadmap

The configuration roadmap is as follows:

  1. Establish EBGP connections between Routers A and B and between Routers B and C and configure these devices to import direct routes so that the ASs can communicate with each other through these EBGP connections.
  2. Configure AS_Path filters on Router B and use filtering rules to prevent AS 20 from advertising routes of AS 30 to AS 10 or routes of AS 10 to AS 30.

Procedure

  1. Configure an IP address for each interface.

    # Configure IP addresses for all interfaces of Router A.

    <Huawei> system-view
    [Huawei] sysname RouterA
    [RouterA] interface gigabitethernet 1/0/0
    [RouterA-GigabitEthernet1/0/0] ip address 9.1.1.1 255.255.255.0
    [RouterA-GigabitEthernet1/0/0] quit
    [RouterA] interface gigabitethernet 2/0/0
    [RouterA-GigabitEthernet2/0/0] ip address 200.1.2.1 255.255.255.0
    [RouterA-GigabitEthernet2/0/0] quit

    The configurations of RouterB and RouterC are similar to the configuration of RouterA, and are not mentioned here.

  2. Establish EBGP connections.

    # Configure Router A.

    [RouterA] bgp 10
    [RouterA-bgp] router-id 1.1.1.1
    [RouterA-bgp] peer 200.1.2.2 as-number 20
    [RouterA-bgp] import-route direct

    # Configure Router B.

    [RouterB] bgp 20
    [RouterB-bgp] router-id 2.2.2.2
    [RouterB-bgp] peer 200.1.2.1 as-number 10
    [RouterB-bgp] peer 200.1.3.2 as-number 30
    [RouterB-bgp] import-route direct
    [RouterB-bgp] quit

    # Configure Router C.

    [RouterC] bgp 30
    [RouterC-bgp] router-id 3.3.3.3 
    [RouterC-bgp] peer 200.1.3.1 as-number 20
    [RouterC-bgp] import-route direct
    [RouterC-bgp] quit

    # View routes advertised by Router B. Routes advertised by Router B to Router C are used as an example. You can see that Router B advertises the direct route imported by AS 10.

    <RouterB> display bgp routing-table peer 200.1.3.2 advertised-routes
     BGP Local router ID is 2.2.2.2
     Status codes: * - valid, > - best, d - damped,
                   h - history,  i - internal, s - suppressed, S - Stale
                   Origin : i - IGP, e - EGP, ? - incomplete
    
    
     Total Number of Routes: 5
          Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
    
     *>   9.1.1.0/24        200.1.3.1                           0      20 10?
     *>   10.1.1.0/24        200.1.3.1                             0      20 30?
     *>   200.1.2.0          200.1.3.1       0                     0      20?
     *>   200.1.2.1/32       200.1.3.1       0                     0      20?
     *>   200.1.3.0/24       200.1.3.1       0                     0      20?
     

    View the routing table of Router C. You can see that Router C has learned the direct route from Router B.

    <RouterC> display bgp routing-table
     BGP Local router ID is 3.3.3.3
     Status codes: * - valid, > - best, d - damped,
                   h - history,  i - internal, s - suppressed, S - Stale
                   Origin : i - IGP, e - EGP, ? - incomplete
    
     Total Number of Routes: 9
          Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
    
     *>   9.1.1.0/24        200.1.3.1                            0      20 10?
     *>   10.1.1.0/24        0.0.0.0         0                     0      ?
     *>   10.1.1.1/32        0.0.0.0         0                     0      ?
     *>   127.0.0.0          0.0.0.0         0                     0      ?
     *>   127.0.0.1/32       0.0.0.0         0                     0      ?
     *>   200.1.2.0          200.1.3.1       0                     0      20?
     *>   200.1.3.0/24       0.0.0.0         0                     0      ?
     *                       200.1.3.1       0                     0      20?
     *>   200.1.3.2/32       0.0.0.0         0                     0      ?
     

  3. Configure AS_Path filters on Router B and apply the AS_Path filters to routes to be advertised by Router B.

    # Create AS_Path filter 1 to deny the routes carrying AS number 30. The regular expression "_30_" indicates any AS list that contains AS 30 and "*" matches any character.

    [RouterB] ip as-path-filter path-filter1 deny _30_
    [RouterB] ip as-path-filter path-filter1 permit .*

    # Create AS_Path filter 2 to deny the routes carrying AS 10.

    [RouterB] ip as-path-filter path-filter2 deny _10_
    [RouterB] ip as-path-filter path-filter2 permit .*

    # Apply the AS_Path filters to routes to be advertised by Router B.

    [RouterB] bgp 20
    [RouterB-bgp] peer 200.1.2.1 as-path-filter path-filter1 export
    [RouterB-bgp] peer 200.1.3.2 as-path-filter path-filter2 export
    [RouterB-bgp] quit

  4. # View routes advertised by Router B.

    # View routes advertised by Router B to AS 30. You can see that Router B does not advertise the direct route imported by AS 10.

    <RouterB> display bgp routing-table peer 200.1.3.2 advertised-routes
     BGP Local router ID is 2.2.2.2
     Status codes: * - valid, > - best, d - damped,
                   h - history,  i - internal, s - suppressed, S - Stale
                   Origin : i - IGP, e - EGP, ? - incomplete
    
    
     Total Number of Routes: 2
          Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
    
     *>   200.1.2.0          200.1.3.1       0                     0      20?
     *>   200.1.3.0/24       200.1.3.1       0                     0      20?
     

    The route does not exist in the BGP routing table of Router C.

    <RouterC> display bgp routing-table
     BGP Local router ID is 3.3.3.3
     Status codes: * - valid, > - best, d - damped,
                   h - history,  i - internal, s - suppressed, S - Stale
                   Origin : i - IGP, e - EGP, ? - incomplete
    
     Total Number of Routes: 8
          Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
    
     *>   10.1.1.0/24        0.0.0.0         0                     0      ?
     *>   10.1.1.1/32        0.0.0.0         0                     0      ?
     *>   127.0.0.0          0.0.0.0         0                     0      ?
     *>   127.0.0.1/32       0.0.0.0         0                     0      ?
     *>   200.1.2.0          200.1.3.1       0                     0      20?
     *>   200.1.3.0/24       0.0.0.0         0                     0      ?
     *                       200.1.3.1       0                     0      20?
     *>   200.1.3.2/32       0.0.0.0         0                     0      ?
    

    # View routes advertised by Router B to AS 10. You can see that Router B does not advertise the direct route imported by AS 30.

    <RouterB> display bgp routing-table peer 200.1.2.1 advertised-routes
     BGP Local router ID is 2.2.2.2
     Status codes: * - valid, > - best, d - damped,
                   h - history,  i - internal, s - suppressed, S - Stale
                   Origin : i - IGP, e - EGP, ? - incomplete
    
    
     Total Number of Routes: 2
          Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
    
     *>   200.1.2.0          200.1.2.2       0                     0      20?
     *>   200.1.3.0/24       200.1.2.2       0                     0      20?
     

    The route does not exist in the BGP routing table of Router A.

    <RouterA> display bgp routing-table
     BGP Local router ID is 1.1.1.1
     Status codes: * - valid, > - best, d - damped,
                   h - history,  i - internal, s - suppressed, S - Stale
                   Origin : i - IGP, e - EGP, ? - incomplete
    
     Total Number of Routes: 8
          Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
    
     *>   9.1.1.0/24         0.0.0.0         0                     0      ?
     *>   9.1.1.1/32         0.0.0.0         0                     0      ?
     *>   127.0.0.0          0.0.0.0         0                     0      ?
     *>   127.0.0.1/32       0.0.0.0         0                     0      ?
     *>   200.1.2.0          0.0.0.0         0                     0      ?
     *                       200.1.2.2       0                     0      20?
     *>   200.1.2.1/32       0.0.0.0         0                     0      ?
     *>   200.1.3.0/24       200.1.2.2       0                     0      20?
    

Configuration Files

  • Configuration file of Router A

    #
     sysname RouterA
    #
    interface GigabitEthernet1/0/0
     ip address 9.1.1.1 255.255.255.0
    #
    interface GigabitEthernet2/0/0
     ip address 200.1.2.1 255.255.255.0
    #
    bgp 10
     router-id 1.1.1.1
     peer 200.1.2.2 as-number 20
    #
     ipv4-family unicast
      undo synchronization
      import-route direct
      peer 200.1.2.2 enable
    #
    return
  • Configuration file of Router B

    #
     sysname RouterB
    #
    interface GigabitEthernet1/0/0
     ip address 200.1.3.1 255.255.255.0
    #
    interface GigabitEthernet2/0/0
     ip address 200.1.2.2 255.255.255.0
    #
    bgp 20
     router-id 2.2.2.2
     peer 200.1.2.1 as-number 10
     peer 200.1.3.2 as-number 30
     #
     ipv4-family unicast
      undo synchronization
      import-route direct
      peer 200.1.2.1 enable
      peer 200.1.2.1 as-path-filter path-filter1 export
      peer 200.1.3.2 enable
      peer 200.1.3.2 as-path-filter path-filter2 export
    #
     ip as-path-filter path-filter1 deny _30_
     ip as-path-filter path-filter1 permit .*
     ip as-path-filter path-filter2 deny _10_
     ip as-path-filter path-filter2 permit .*
    #
    return
  • Configuration file of Router C

    #
     sysname RouterC
    #
    interface GigabitEthernet1/0/0
     ip address 10.1.1.1 255.255.255.0
    #
    interface GigabitEthernet2/0/0
     ip address 200.1.3.2 255.255.255.0
    #
    bgp 30
     router-id 3.3.3.3
     peer 200.1.3.1 as-number 20
    #
     ipv4-family unicast
      undo synchronization
      import-route direct
      peer 200.1.3.1 enable
    #
    return