欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

prefux-list 过滤实验

程序员文章站 2022-04-09 19:41:18
...

prefux-list 过滤实验

拓扑图

prefux-list 过滤实验

IP地址

设备名称 接口 ip地址 网关
PCA - 10.0.0.2/24 10.0.0.1
PCB - 10.0.1.2/24 10.0.1.1
PCC - 192.168.3.2/24 192.168.3.1
RTA G0/0 10.0.0.1/24 -
S1/0 192.168.1.1/30 -
G0/1 10.0.1.1/24 -
RTB S1/0 192.168.1.2/30 -
S2/0 192.168.2.1/30 -
RTC G0/0 192.168.3.1/24 -
S2/0 192.168.2.2/30 -

/24 表示这个IP掩码是255.255.255.0

/30 表示这个IP掩码是255.255.255.252

RTA

<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C]int g0/0
[H3C-GigabitEthernet0/0]ip add 10.0.0.1 255.255.255.0
[H3C-GigabitEthernet0/0]no shu
[H3C-GigabitEthernet0/0]no shutdown
[H3C-GigabitEthernet0/0]qui
[H3C-GigabitEthernet0/0]quit
[H3C]int s1/0
[H3C-Serial1/0]ip add 192.168.1.1 255.255.255.252
[H3C-Serial1/0]no shu
[H3C-Serial1/0]no shutdown
[H3C-Serial1/0]qui
[H3C-Serial1/0]quit
[H3C]int g0/1
[H3C-GigabitEthernet0/1]ip add 10.0.1.1 255.255.255.0
[H3C-GigabitEthernet0/1]no shu
[H3C-GigabitEthernet0/1]no shutdown
[H3C-GigabitEthernet0/1]qui
[H3C-GigabitEthernet0/1]quit
[H3C]rip
[H3C-rip-1]netw
[H3C-rip-1]network 10.0.0.0
[H3C-rip-1]network 192.168.1.0
[H3C-rip-1]ver
[H3C-rip-1]version 2
[H3C-rip-1]undo su
[H3C-rip-1]undo summary
[H3C-rip-1]qui
[H3C-rip-1]quit
[H3C]int s1/0
[H3C-Serial1/0]rip su
[H3C-Serial1/0]rip summary-address 10.0.0.0 23
[H3C-Serial1/0]qui
[H3C-Serial1/0]quit
[H3C]dis ip rou
[H3C]dis ip routing-table

Destinations : 23       Routes : 23

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
10.0.0.0/24        Direct  0   0           10.0.0.1        GE0/0
10.0.0.0/32        Direct  0   0           10.0.0.1        GE0/0
10.0.0.1/32        Direct  0   0           127.0.0.1       InLoop0
10.0.0.255/32      Direct  0   0           10.0.0.1        GE0/0
10.0.1.0/24        Direct  0   0           10.0.1.1        GE0/1
10.0.1.0/32        Direct  0   0           10.0.1.1        GE0/1
10.0.1.1/32        Direct  0   0           127.0.0.1       InLoop0
10.0.1.255/32      Direct  0   0           10.0.1.1        GE0/1
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/30     Direct  0   0           192.168.1.1     Ser1/0
192.168.1.0/32     Direct  0   0           192.168.1.1     Ser1/0
192.168.1.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.1.2/32     Direct  0   0           192.168.1.2     Ser1/0
192.168.1.3/32     Direct  0   0           192.168.1.1     Ser1/0
192.168.2.0/30     RIP     100 1           192.168.1.2     Ser1/0
192.168.3.0/24     RIP     100 2           192.168.1.2     Ser1/0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
[H3C]




[H3C]dis ip routing-table

Destinations : 23       Routes : 23

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
10.0.0.0/24        Direct  0   0           10.0.0.1        GE0/0
10.0.0.0/32        Direct  0   0           10.0.0.1        GE0/0
10.0.0.1/32        Direct  0   0           127.0.0.1       InLoop0
10.0.0.255/32      Direct  0   0           10.0.0.1        GE0/0
10.0.1.0/24        Direct  0   0           10.0.1.1        GE0/1
10.0.1.0/32        Direct  0   0           10.0.1.1        GE0/1
10.0.1.1/32        Direct  0   0           127.0.0.1       InLoop0
10.0.1.255/32      Direct  0   0           10.0.1.1        GE0/1
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/30     Direct  0   0           192.168.1.1     Ser1/0
192.168.1.0/32     Direct  0   0           192.168.1.1     Ser1/0
192.168.1.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.1.2/32     Direct  0   0           192.168.1.2     Ser1/0
192.168.1.3/32     Direct  0   0           192.168.1.1     Ser1/0
192.168.2.0/30     RIP     100 1           192.168.1.2     Ser1/0
192.168.3.0/24     RIP     100 2           192.168.1.2     Ser1/0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
[RTA]:SAVE

RTB

<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C] int s1/0
[H3C-Serial1/0]ip add 192.168.1.2 255.255.255.252
[H3C-Serial1/0]no shu
[H3C-Serial1/0]no shutdown
[H3C-Serial1/0]qui
[H3C-Serial1/0]quit
[H3C]int s2/0
[H3C-Serial2/0]ip add 192.168.2.1 255.255.255.252
[H3C-Serial2/0]no shu
[H3C-Serial2/0]no shutdown
[H3C-Serial2/0]quit
[H3C]hostname RTB
[RTB]rip
[RTB-rip-1]net
[RTB-rip-1]network 192.168.1.0
[RTB-rip-1]ne
[RTB-rip-1]network 192.168.2.0
[RTB-rip-1]ve
[RTB-rip-1]version 2
[RTB-rip-1]undo
[RTB-rip-1]undo su
[RTB-rip-1]undo summary
[RTB-rip-1]qui
[RTB-rip-1]quit
[RTB]dis ip rou
[RTB]dis ip routing-table

Destinations : 20       Routes : 20

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
10.0.0.0/23        RIP     100 1           192.168.1.1     Ser1/0
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/30     Direct  0   0           192.168.1.2     Ser1/0
192.168.1.0/32     Direct  0   0           192.168.1.2     Ser1/0
192.168.1.1/32     Direct  0   0           192.168.1.1     Ser1/0
192.168.1.2/32     Direct  0   0           127.0.0.1       InLoop0
192.168.1.3/32     Direct  0   0           192.168.1.2     Ser1/0
192.168.2.0/30     Direct  0   0           192.168.2.1     Ser2/0
192.168.2.0/32     Direct  0   0           192.168.2.1     Ser2/0
192.168.2.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.2.2/32     Direct  0   0           192.168.2.2     Ser2/0
192.168.2.3/32     Direct  0   0           192.168.2.1     Ser2/0
192.168.3.0/24     RIP     100 1           192.168.2.2     Ser2/0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

[RTB]ip prefix-list abc  index 10 deny 10.0.0.0 23
[RTB]ip prefix-list abc index 20 permit 0.0.0.0 0 less-equal 32
[RTB]
[RTB]
[RTB]
[RTB]
[RTB]dis ip rou
[RTB]dis ip routing-table

Destinations : 20       Routes : 20

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
10.0.0.0/23        RIP     100 1           192.168.1.1     Ser1/0
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/30     Direct  0   0           192.168.1.2     Ser1/0
192.168.1.0/32     Direct  0   0           192.168.1.2     Ser1/0
192.168.1.1/32     Direct  0   0           192.168.1.1     Ser1/0
192.168.1.2/32     Direct  0   0           127.0.0.1       InLoop0
192.168.1.3/32     Direct  0   0           192.168.1.2     Ser1/0
192.168.2.0/30     Direct  0   0           192.168.2.1     Ser2/0
192.168.2.0/32     Direct  0   0           192.168.2.1     Ser2/0
192.168.2.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.2.2/32     Direct  0   0           192.168.2.2     Ser2/0
192.168.2.3/32     Direct  0   0           192.168.2.1     Ser2/0
192.168.3.0/24     RIP     100 1           192.168.2.2     Ser2/0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
[RTB]  rip
[RTB-rip-1]filter-policy prefix-list abc import
[RTB-rip-1]qui
[RTB]dis ip routing-table

Destinations : 19       Routes : 19

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/30     Direct  0   0           192.168.1.2     Ser1/0
192.168.1.0/32     Direct  0   0           192.168.1.2     Ser1/0
192.168.1.1/32     Direct  0   0           192.168.1.1     Ser1/0
192.168.1.2/32     Direct  0   0           127.0.0.1       InLoop0
192.168.1.3/32     Direct  0   0           192.168.1.2     Ser1/0
192.168.2.0/30     Direct  0   0           192.168.2.1     Ser2/0
192.168.2.0/32     Direct  0   0           192.168.2.1     Ser2/0
192.168.2.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.2.2/32     Direct  0   0           192.168.2.2     Ser2/0
192.168.2.3/32     Direct  0   0           192.168.2.1     Ser2/0
192.168.3.0/24     RIP     100 1           192.168.2.2     Ser2/0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

[RTB]dis ip prefix-list name abc
Prefix-list: abc
 Permitted 4
 Denied 4
        index: 10        Deny   10.0.0.0/23
        index: 20        Permit 0.0.0.0/0               le  32
[RTB]dis ip prefix-list name abc
Prefix-list: abc
 Permitted 5
 Denied 5
        index: 10        Deny   10.0.0.0/23
        index: 20        Permit 0.0.0.0/0               le  32
[RTB]dis ip prefix-list name abc
Prefix-list: abc
 Permitted 5
 Denied 5
        index: 10        Deny   10.0.0.0/23
        index: 20        Permit 0.0.0.0/0               le  32
[RTB]dis ip prefix-list name abc
Prefix-list: abc
 Permitted 5
 Denied 5
        index: 10        Deny   10.0.0.0/23
        index: 20        Permit 0.0.0.0/0               le  32

[RTB]save

RTC

<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C]hostname RTC
[RTC]int g0/0
[RTC-GigabitEthernet0/0]ip add 192.168.3.1 255.255.255.0
[RTC-GigabitEthernet0/0]no shu
[RTC-GigabitEthernet0/0]no shutdown
[RTC-GigabitEthernet0/0]qui
[RTC-GigabitEthernet0/0]quit
[RTC]int s2/0
[RTC-Serial2/0]ip add 192.168.2.2 255.255.255.252
[RTC-Serial2/0]no shu
[RTC-Serial2/0]no shutdown
[RTC-Serial2/0]qui
[RTC-Serial2/0]quit
[RTC]dis ip rou
[RTC]dis ip routing-table

Destinations : 19       Routes : 19

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
10.0.0.0/23        RIP     100 2           192.168.2.1     Ser2/0
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/30     RIP     100 1           192.168.2.1     Ser2/0
192.168.2.0/30     Direct  0   0           192.168.2.2     Ser2/0
192.168.2.0/32     Direct  0   0           192.168.2.2     Ser2/0
192.168.2.1/32     Direct  0   0           192.168.2.1     Ser2/0
192.168.2.2/32     Direct  0   0           127.0.0.1       InLoop0
192.168.2.3/32     Direct  0   0           192.168.2.2     Ser2/0
192.168.3.0/24     Direct  0   0           192.168.3.1     GE0/0
192.168.3.0/32     Direct  0   0           192.168.3.1     GE0/0
192.168.3.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.3.255/32   Direct  0   0           192.168.3.1     GE0/0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
[RTC] dis ip rou
[RTC]dis ip routing-table

Destinations : 18       Routes : 18

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/30     RIP     100 1           192.168.2.1     Ser2/0
192.168.2.0/30     Direct  0   0           192.168.2.2     Ser2/0
192.168.2.0/32     Direct  0   0           192.168.2.2     Ser2/0
192.168.2.1/32     Direct  0   0           192.168.2.1     Ser2/0
192.168.2.2/32     Direct  0   0           127.0.0.1       InLoop0
192.168.2.3/32     Direct  0   0           192.168.2.2     Ser2/0
192.168.3.0/24     Direct  0   0           192.168.3.1     GE0/0
192.168.3.0/32     Direct  0   0           192.168.3.1     GE0/0
192.168.3.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.3.255/32   Direct  0   0           192.168.3.1     GE0/0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
[RTC]save


PCA

prefux-list 过滤实验

PCB

prefux-list 过滤实验

PCC

prefux-list 过滤实验

相关标签: H3C