H3C BGP-filter-policy

 

[R1-bgp]display bgp routing-table

 

 Total Number of Routes: 4

 

 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

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>  1.1.1.1/32         0.0.0.0         0                     0       i

 *>  2.2.2.2/32         192.168.1.2     0                     0       200i

 *>  3.3.3.3/32         192.168.1.2                           0       200i

 *>  172.16.1.1/32      192.168.1.2                           0       200i

 

 

[R1]bgp 100

[R1-bgp]filter-policy ip-prefix 1 import

[R1]ip ip-prefix 1 index 10 deny 3.3.3.3 32

[R1]ip ip-prefix 1 此处还要一个命令,相当与允许所有。下面有!!

 

[R1]display bgp routing-table             

 

 Total Number of Routes: 1

 

 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

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

 *>  1.1.1.1/32         0.0.0.0         0                     0       i

为什么只拒绝了3.3.3.3的,2.2.2.2和172.16.1.1的也被拒绝了呢?

下面两个命令是一样的!我用的上面的命令!

[R1]ip ip-prefix 1 permit 0.0.0.0 0 greater-equal 0 less-equal 32

[R1]ip ip-prefix 1 index 20 permit 0.0.0.0 0 greater-equal 0 less-equal 32

 

 

 

 

原文地址:https://www.cnblogs.com/niezhongle/p/11213575.html