HCNA-26RIP与不连续子网 1、基本地址配置和组建RIPv1网络 <Huawei>system-view [Huawei]sysnamer1 [r1]interface GigabitEthernet 0/0/0 [r1-GigabitEthernet0/0/0]ip address 10.0.12.1 24 [r1-GigabitEthernet0/0/0]quit [r1]rip1 [r1-rip-1]network 10.0.0.0 [r1-rip-1]return <Huawei>system-view [Huawei]sysname r2 [r2]interface GigabitEthernet 0/0/0 [r2-GigabitEthernet0/0/0]ip address 10.0.12.2 24 [r2-GigabitEthernet0/0/0]quit [r2]interface GigabitEthernet 0/0/1 [r2-GigabitEthernet0/0/1]ip address 192.168.23.2 24 [r2-GigabitEthernet0/0/1]quit [r2]display ip interface brief [r2]rip 1 [r2-rip-1]network10.0.0.0 [r2-rip-1]network 192.168.23.0 [r2-rip-1]return <Huawei>system-view [Huawei]sysnamer3 [r3]interfaceGigabitEthernet 0/0/0 [r3-GigabitEthernet0/0/0]ip address 192.168.23.3 24 [r3-GigabitEthernet0/0/0]quit [r3]interfaceGigabitEthernet 0/0/1 [r3-GigabitEthernet0/0/1]ip address 192.168.34.3 24 [r3-GigabitEthernet0/0/1]quit [r3]rip1 [r3-rip-1]network192.168.23.0 [r3-rip-1]network192.168.34.0 [r3-rip-1]return <Huawei>system-view [Huawei]sysnamer4 [r4]interfaceGigabitEthernet 0/0/0 [r4-GigabitEthernet0/0/0]ip address 192.168.34.4 24 [r4-GigabitEthernet0/0/0]quit [r4]interfaceGigabitEthernet 0/0/1 [r4-GigabitEthernet0/0/1]ip address 10.0.45.4 24 [r4-GigabitEthernet0/0/1]quit [r4]rip1 [r4-rip-1]network192.168.34.0 [r4-rip-1]network10.0.0.0 [r4-rip-1]return <Huawei>system-view [Huawei]sysnamer5 [r5]interfaceGigabitEthernet 0/0/0 [r5-GigabitEthernet0/0/0]ipaddress 10.0.45.5 24 [r5-GigabitEthernet0/0/0]quit [r5]rip1 [r5-rip-1]network10.0.0.0 [r5-rip-1]return 查看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 …… 192.168.23.0/24 RIP 100 1 D 10.0.12.2 GigabitEthernet 0/0/0 192.168.34.0/24 RIP 100 2 D 10.0.12.2 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 查看结果,只学习到了192.168.23.0/24和192.168.34.0/24 两个网段;并没有学习到R4与R5之间的10.0.45.0/24路由条目。 再查看R2的路由表: <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 …… 192.168.34.0/24 RIP 100 1 D 192.168.23.3 GigabitEthernet 0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 查看结果,R2只学习到了一条192.168.34.0/24的RIP路由条目。R4与R5间的路由同样没有学习到。 再看R3的路由表: <r3>display ip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 11 Routes : 12 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.0.0/8 RIP 100 1 D 192.168.23.2 GigabitEthernet 0/0/0 RIP 100 1 D 192.168.34.4 GigabitEthernet 0/0/1 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.23.0/24 Direct 0 0 D 192.168.23.3 GigabitEthernet 0/0/0 192.168.23.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.23.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.34.0/24 Direct 0 0 D 192.168.34.3 GigabitEthernet 0/0/1 192.168.34.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.34.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 查看结果,除去直连路由之外,R3分另从R2与R4接收到了两条相同10.0.0.0/8的主网路由条目,而并非现网拓扑中的10.0.12.0/24和10.0.45.0/24 两条子网路由。 导致这种情况的原因是:由于采用了RIPv1,在R2和R4分别接收到10.0.12.0/24和10.0.45.0/24的两条路由条目时,默认打开了自动有类汇总功能,所以在主网边界向外发送路由信息的时候都汇总成了10.0.0.0/8,发送给R3,最终在R3上由于接收到了两条目的网段相同、代价值也相同的路由条目。 此时的通信会出现问题。 <r3>ping10.0.12.1 PING 10.0.12.1: 56 data bytes, press CTRL_C to break Request time out Request time out Request time out Request time out Request time out --- 10.0.12.1 ping statistics --- 5 packet(s) transmitted 0 packet(s) received 100.00% packet loss <r3>ping10.0.45.5 PING 10.0.45.5: 56 data bytes, press CTRL_C to break Request time out Reply from 10.0.45.5: bytes=56 Sequence=2ttl=254 time=120 ms Reply from 10.0.45.5: bytes=56 Sequence=3ttl=254 time=30 ms Reply from 10.0.45.5: bytes=56 Sequence=4ttl=254 time=40 ms Reply from 10.0.45.5: bytes=56 Sequence=5ttl=254 time=40 ms --- 10.0.45.5 ping statistics --- 5 packet(s) transmitted 4 packet(s) received 20.00% packet loss round-trip min/avg/max = 30/57/120 ms 使用RIPv1解决不连续子网问题: 需要明确的一点是,RIPv1默认自动汇总,且无法关闭!所以不连续子网问题不可能通过关闭自动汇总来实现! 解决办法:给接口配置第二个IP地址,IP取10.0.0.0/8主见多的子网。 [r2]interfaceGigabitEthernet 0/0/1 [r2-GigabitEthernet0/0/1]ipaddress 10.0.23.2 24 sub //接口配置下属地址 [r2-GigabitEthernet0/0/1]displaythis [V200R003C00] # interfaceGigabitEthernet0/0/1 ip address 192.168.23.2 255.255.255.0 ip address 10.0.23.2 255.255.255.0 sub [r3]interfaceGigabitEthernet 0/0/0 [r3-GigabitEthernet0/0/0]ipaddress 10.0.23.3 24 sub [r3-GigabitEthernet0/0/0]interfaceGigabitEthernet 0/0/1 [r3-GigabitEthernet0/0/1]ipaddress 10.0.34.3 24 sub [r3-GigabitEthernet0/0/1]quit [r3]rip1 [r3-rip-1]network10.0.0.0 [r3-rip-1]return [r4]interfaceGigabitEthernet 0/0/0 [r4-GigabitEthernet0/0/0]ipaddress 10.0.34.4 24 sub [r4-GigabitEthernet0/0/0]return 经过这样子的配置后,相当于原先在整个网络拓扑中被孤立的两个不连续子网10.0.12.0/24和10.0.45.0/24网段被新添加的10.0.23.0/24和10.0.34.0网段连接了起来,即现在已经构成了一个连续的子网。 查看R1路由表 <r1>displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 13 Routes : 13 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.0.0/8 RIP 100 1 D 10.0.12.2 GigabitEthernet 0/0/0 10.0.12.0/24 Direct 0 0 D 10.0.12.1 GigabitEthernet 0/0/0 10.0.12.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 10.0.12.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 10.0.23.0/24 RIP 100 1 D 10.0.12.2 GigabitEthernet 0/0/0 10.0.34.0/24 RIP 100 2 D 10.0.12.2 GigabitEthernet 0/0/0 10.0.45.0/24 RIP 100 3 D 10.0.12.2 GigabitEthernet 0/0/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.23.0/24 RIP 100 1 D 10.0.12.2 GigabitEthernet 0/0/0 192.168.34.0/24 RIP 100 2 D 10.0.12.2 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 此时所有的路由表将会出现子网信息。 <r1>ping10.0.45.5 PING 10.0.45.5: 56 data bytes, press CTRL_C to break Request time out Request time out Reply from 10.0.45.5: bytes=56 Sequence=3ttl=252 time=90 ms Reply from 10.0.45.5: bytes=56 Sequence=4ttl=252 time=40 ms Reply from 10.0.45.5: bytes=56 Sequence=5ttl=252 time=40 ms --- 10.0.45.5 ping statistics --- 5 packet(s) transmitted 3 packet(s) received 40.00% packet loss round-trip min/avg/max = 40/56/90 ms R1与R5之间通信正常!
2、使用RIPv2来解决不连续子网问题 [r1]rip1 [r1-rip-1]version2 //配置RIP版本V2 [r1-rip-1]undosummary //不执行自动汇总 [r2]rip1 [r2-rip-1]version2 [r2-rip-1]undosummary [r2-rip-1]quit [r2]interfaceGigabitEthernet 0/0/1 [r2-GigabitEthernet0/0/1]undoip address 10.0.23.2 24 sub //取消配置的连续子网地址 [r2-GigabitEthernet0/0/1]return [r3]rip1 [r3-rip-1]version2 [r3-rip-1]undosummary [r3-rip-1]undonetwork 10.0.0.0 [r3-rip-1]quit [r3]interfaceGigabitEthernet 0/0/0 [r3-GigabitEthernet0/0/0]undoip address 10.0.23.3 24 sub [r3-GigabitEthernet0/0/0]interfaceGigabitEthernet 0/0/1 [r3-GigabitEthernet0/0/1]undoip address 10.0.34.3 24 sub [r3-GigabitEthernet0/0/1]return [r4-rip-1]version2 [r4-rip-1]undosummary [r4-rip-1]quit [r4]interfaceGigabitEthernet 0/0/0 [r4-GigabitEthernet0/0/0]undoip address 10.0.34.4 24 sub [r4-GigabitEthernet0/0/0]return [r5]rip1 [r5-rip-1]version2 [r5-rip-1]undosummary [r5-rip-1]return 查看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 …… 10.0.45.0/24 RIP 100 3 D 10.0.12.2 GigabitEthernet 0/0/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.23.0/24 RIP 100 1 D 10.0.12.2 GigabitEthernet 0/0/0 192.168.34.0/24 RIP 100 2 D 10.0.12.2 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 其它路由省略,看到路由已经可以学习到全网的路由条目。 <r1>ping10.0.45.5 PING 10.0.45.5: 56 data bytes, press CTRL_C to break Request time out Reply from 10.0.45.5: bytes=56 Sequence=2ttl=252 time=100 ms Reply from 10.0.45.5: bytes=56 Sequence=3ttl=252 time=30 ms Reply from 10.0.45.5: bytes=56 Sequence=4ttl=252 time=40 ms Reply from 10.0.45.5: bytes=56 Sequence=5ttl=252 time=50 ms --- 10.0.45.5 ping statistics --- 5 packet(s) transmitted 4 packet(s) received 20.00% packet loss round-trip min/avg/max = 30/55/100 ms 测试网络OK! |