HCNA-23 路由协议的汇总 1、基本地址配置和RIPv1配置 <Huawei>system-view [Huawei]sysnamer1 [r1]interfaceGigabitEthernet 0/0/0 [r1-GigabitEthernet0/0/0]ipaddress 192.168.12.1 24 [r1-GigabitEthernet0/0/0]quit [r1]rip1 //创建RIP协议进程号1 [r1-rip-1]network 192.168.12.0 //宣告参与网段 [r1-rip-1]quit <Huawei>system-view [Huawei]sysnamer2 [r2]interfaceGigabitEthernet 0/0/0 [r2-GigabitEthernet0/0/0]ipaddress 192.168.12.2 24 [r2-GigabitEthernet0/0/0]quit [r2]interfaceGigabitEthernet 0/0/1 [r2-GigabitEthernet0/0/1]ipaddress 192.168.23.2 24 [r2-GigabitEthernet0/0/1]quit [r2]displayip interface brief //查看接口IP概要 [r2]rip 1 [r2-rip-1]network192.168.12.0 [r2-rip-1]network192.168.23.0 [r2-rip-1]quit <Huawei>system-view [Huawei]sysnamer3 [r3]interfaceGigabitEthernet 0/0/0 [r3-GigabitEthernet0/0/0]ipaddress 192.168.23.3 24 [r3-GigabitEthernet0/0/0]quit [r3]interfaceloopback 1 //创建环回口 接口编号1 [r3-LoopBack1]ipaddress 8.8.1.5 24 [r3-LoopBack1]quit [r3]interfaceloopback 2 [r3-LoopBack2]ipaddress 8.8.2.5 24 [r3-LoopBack2]quit [r3]interfaceloopback 3 [r3-LoopBack3]ipaddress 8.8.3.5 24 [r3-LoopBack3]quit [r3]interfaceloopback 4 [r3-LoopBack4]ipaddress 8.8.4.5 24 [r3-LoopBack4]quit [r3]displayip interface brief [r3]rip 1 [r3-rip-1]network192.168.23.0 [r3-rip-1]network8.0.0.0 [r3-rip-1]quit 查看R1和R2的路由表 <r1>displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost Flags NextHop Interface 8.0.0.0/8 RIP 100 2 D 192.168.12.2 GigabitEthernet 0/0/0 …… 192.168.23.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 <r2>displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 11 Routes : 11 Destination/Mask Proto Pre Cost Flags NextHop Interface 8.0.0.0/8 RIP 100 1 D 192.168.23.3 GigabitEthernet 0/0/1 …… 观察到R3发过来的汇总路由条目8.0.0.0/8,没有任何明细路由条目。
R3GE0/0/0接口上抓包发现RIPv1协议报文中没有携带掩码信息,只有相应网络号和度量值,即RIPv1只发布汇总后的有类路由。RIPv1默认开启自动汇总,且无法关闭!!也不支持手动汇总。 <r3>displaydefault-parameter rip //查看RIP默认配置信息 -------------------------------------------- Protocol Level Default Configurations -------------------------------------------- RIP version : 1 Preference : 100 Checkzero : Enabled Default-cost : 0 Auto Summary :Enabled Host-route : Enabled …… 能看到默认配置信息中自动汇总是开启状态!
2、配置RIPv2自动汇总 [r1]rip1 [r1-rip-1]version2 //配置RIP版本为v2 [r2]rip1 [r2-rip-1]version2 [r3]rip1 [r3-rip-1]version2
当配置完RIPv2后,继续在R3的GE0/0/0接口抓包时发现,RIPv2报文中携带了掩码信息。另外RIPv2支持自动汇总,默认是开启的,并且与RIPv1的不同是,RIPv2可以关闭。 下面再查看R1与R2的路由表与之前有何不同: <r1>displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 12 Routes : 12 Destination/Mask Proto Pre Cost Flags NextHop Interface 8.8.1.0/24 RIP 100 2 D 192.168.12.2 GigabitEthernet 0/0/0 8.8.2.0/24 RIP 100 2 D 192.168.12.2 GigabitEthernet 0/0/0 8.8.3.0/24 RIP 100 2 D 192.168.12.2 GigabitEthernet 0/0/0 8.8.4.0/24 RIP 100 2 D 192.168.12.2 GigabitEthernet 0/0/0 …… 192.168.23.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet 0/0/0 …… <r2>display ip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 14 Routes : 14 Destination/Mask Proto Pre Cost Flags NextHop Interface 8.8.1.0/24 RIP 100 1 D 192.168.23.3 GigabitEthernet 0/0/1 8.8.2.0/24 RIP 100 1 D 192.168.23.3 GigabitEthernet 0/0/1 8.8.3.0/24 RIP 100 1 D 192.168.23.3 GigabitEthernet 0/0/1 8.8.4.0/24 RIP 100 1 D 192.168.23.3 GigabitEthernet 0/0/1 与之前不同的是,RIPv2接收到的路由条目是具体的明细路由条目,并不是和RIPv1一样汇总路由,即此时RIPv2默认自动汇总并没有生效。 这是因为华为设备以太网和串口都默认启用了水平分割功能。为了防止环路和不连续子网问题的产生,在启用了水平分割或毒性逆转的接口上,RIPv2的默认自动汇总就会失效,所以从R3宣告过来的都是具体的明细路由条目。 下面配置让RIPv2默认自动汇总生效: 第一种方法: [r3]rip1 [r3-rip-1]summaryalways //配置为总是汇总 此时再看R1的路由表: [r1]displayip routing-table //查看IP路由表 RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost Flags NextHop Interface 8.0.0.0/8 RIP 100 2 D 192.168.12.2 GigabitEthernet 0/0/0 …… 192.168.23.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet 0/0/0 …… 第二种方法: [r3]interfaceGigabitEthernet 0/0/0 [r3-GigabitEthernet0/0/0]undorip split-horizon //配置接口取消RIP 水平分割 此时再看R1的路由表: <r1>displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost Flags NextHop Interface 8.0.0.0/8 RIP 100 2 D 192.168.12.2 GigabitEthernet 0/0/0 …… 192.168.23.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet 0/0/0 …… 不论是在RIP协议里配置始终汇总,还是在接口里取消水平分割,都可以促使RIPv2的自动汇总生效。
3、配置RIPv2手动汇总 [r3]rip1 [r3-rip-1]undosummary //取消自动汇总 [r3-rip-1]quit [r3]interfaceGigabitEthernet 0/0/0 [r3-GigabitEthernet0/0/0]ripsummary-address 8.8.0.0 255.255.252.0 //配置手动汇总 [r3-GigabitEthernet0/0/0]quit R1的路由表: <r1>displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 10 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 8.8.0.0/22 RIP 100 2 D 192.168.12.2 GigabitEthernet 0/0/0 8.8.4.0/24 RIP 100 2 D 192.168.12.2 GigabitEthernet 0/0/0 …… |