一、实验拓扑
二、实验需求
1、R6为ISP,接口IP地址均为公有地址,该设备只能配置ip地址,之后不能再对其进行任何配置;
2、R1-R5为局域网,私有Ip地址192.168.1.0/24,请合理分配;
3、R1、R2、R4,各有两个环回Ip地址;R5,R6各有一个环回地址;所有路由器上环回均代表连接用户的接口;
4、R3下面的两台pc通过DHCP自动获取ip地址;
5、选路最佳,路由表尽量小,避免环路;
6、R1-R5均可以访问R6的环回;
7、在R1上配置telnet服务,使R6能通过R5的公有地址telnet到R1上;
8、R4与R5正常通过1000M链路,故障时通过100m链路;
三、实验思路
1、合理划分ip地址。
2、配置DHCP,使R3下面的两台PC通过DHCP自动获取IP地址。
3、编写除了到达1.0.0.0/24之外,到达其他网段的静态路由。
4、配置缺省路由,实现到1.0.0.0/24互通。实现内网通;在R5路由器上配置nat,可用此时实现全网通
5、做汇总,做防环,做黑洞路由配置
6、做备份,通过改变路由条目优先级实现
7、测试,观察 1000Mb/s 链路故障时,数据能否走100Mb/s链路。
8、R6 telnet R5的公有地址时,实际登录到R1上,在R1上配置 telnet服务,通过nat server发布到R5的公网接口。
四、实验步骤
1、配置IP地址
R1
R2
R3
R4
R5
R6
R3启用DHCP服务
[R3]dhcp enable
[R3]ip pool a
[R3-ip-pool-a]network 192.168.1.96 mask 27
[R3-ip-pool-a]gateway-list 192.168.1.97
[R3-ip-pool-a]dns-list 8.8.8.8
[R3-ip-pool-a]q
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 192.168.1.97 27
[R3-GigabitEthernet0/0/2]dhcp select global
PC1
PC2
R4
R5
ISP
2、静态路由
R1
[R1]ip route-static 192.168.1.64 27 192.168.1.2
[R1]ip route-static 192.168.1.8 30 192.168.1.2
[R1]ip route-static 192.168.1.16 30 192.168.1.2
[R1]ip route-static 192.168.1.16 30 192.168.1.6
[R1]ip route-static 192.168.1.20 30 192.168.1.2
[R1]ip route-static 192.168.1.20 30 192.168.1.6
[R1]ip route-static 192.168.1.128 27 192.168.1.2
[R1]ip route-static 192.168.1.128 27 192.168.1.6
[R1]ip route-static 192.168.1.12 30 192.168.1.6
[R1]ip route-static 192.168.1.96 27 192.168.1.6
[R1]ip route-static 192.168.1.160 27 192.168.1.2
[R1]ip route-static 192.168.1.160 27 192.168.1.6
R2
[R2]ip route-static 192.168.1.128 27 192.168.1.10
[R2]ip route-static 192.168.1.16 30 192.168.1.10
[R2]ip route-static 192.168.1.20 30 192.168.1.10
[R2]ip route-static 192.168.1.12 30 192.168.1.10
[R2]ip route-static 192.168.1.96 27 192.168.1.10
[R2]ip route-static 192.168.1.96 27 192.168.1.1
[R2]ip route-static 192.168.1.4 30 192.168.1.1
[R2]ip route-static 192.168.1.32 27 192.168.1.1
[R2]ip route-static 192.168.1.160 27 192.168.1.10
R3
[R3]ip route-static 192.168.1.32 27 192.168.1.5
[R3]ip route-static 192.168.1.0 30 192.168.1.5
[R3]ip route-static 192.168.1.64 27 192.168.1.5
[R3]ip route-static 192.168.1.64 27 192.168.1.14
[R3]ip route-static 192.168.1.8 30 192.168.1.14
[R3]ip route-static 192.168.1.16 30 192.168.1.1
[R3]ip route-static 192.168.1.20 30 192.168.1.14
[R3]ip route-static 192.168.1.128 27 192.168.1.14
[R3]ip route-static 192.168.1.160 27 192.168.1.14
R4
ip route-static 0.0.0.0 0.0.0.0 192.168.1.18
ip route-static 0.0.0.0 0.0.0.0 192.168.1.22 preference 61
ip route-static 192.168.1.0 255.255.255.252 192.168.1.9
ip route-static 192.168.1.4 255.255.255.252 192.168.1.13
ip route-static 192.168.1.32 255.255.255.224 192.168.1.13
ip route-static 192.168.1.32 255.255.255.224 192.168.1.9
ip route-static 192.168.1.64 255.255.255.224 192.168.1.9
ip route-static 192.168.1.96 255.255.255.224 192.168.1.13
ip route-static 192.168.1.128 255.255.255.224 NULL0
ip route-static 192.168.1.160 255.255.255.224 192.168.1.18
ip route-static 192.168.1.160 255.255.255.224 192.168.1.22 preference 61
R5
[R5]ip route-static 192.168.1.128 27 192.168.1.17
[R5]ip route-static 192.168.1.12 30 192.168.1.17
[R5]ip route-static 192.168.1.96 27 192.168.1.17
[R5]ip route-static 192.168.1.4 30 192.168.1.17
[R5]ip route-static 192.168.1.32 27 192.168.1.17
[R5]ip route-static 192.168.1.0 27 192.168.1.17
[R5]ip route-static 192.168.1.0 30 192.168.1.17
[R5]ip route-static 192.168.1.64 27 192.168.1.17
[R5]ip route-static 192.168.1.8 30 192.168.1.17
[R5]ip route-static 192.168.1.128 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.12 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.96 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.4 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.32 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.0 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.0 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.64 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.8 30 192.168.1.21 preference 61
测试
测试浮动静态:当关闭1000M的接口模拟1000M的损坏启用100M备用路由
发现路由表已经改变,启用备用路由
依然可以使用R1ping通外网,实验成功
3、配置指向R5的缺省
[R1]ip route-static 0.0.0.0 0 192.168.1.2
[R1]ip route-static 0.0.0.0 0 192.168.1.6
[R2]ip route-static 0.0.0.0 0 192.168.1.10
[R3]ip route-static 0.0.0.0 0 192.168.1.14
[R4]ip route-static 0.0.0.0 0 192.168.1.18
[R4]ip route-static 0.0.0.0 0 192.168.1.22
[R5]ip route-static 0.0.0.0 0 12.0.0.2
避免环路
[R1]ip route-static 192.168.1.32 27 null 0
[R2]ip route-static 192.168.1.64 27 null 0
[R3]ip route-static 192.168.1.96 27 null 0
[R4]ip route-static 192.168.1.128 27 null 0
[R5]ip route-static 192.168.1.160 27 null 0
4、使用nat网址转换,使得内网可以访问R6的环回
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R5-acl-basic-2000]q
[R5]int g0/0/2
[R5-GigabitEthernet0/0/2]nat outbound 2000
测试
5、R5可以登录R1的telnet
创建telnet
[R1]aaa
[R1-aaa]local-user lzq privilege level 15 password cipher 123456
[R1-aaa]local-user lzq service-type telnet
[R1-aaa]q
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
使用端口映射
[R5-GigabitEthernet0/0/2]nat server protocol tcp global current-interface 23 inside 192.168.1.1 23
Warning:The port 23 is well-known port. If you continue it may cause function failure.
Are you sure to continue?[Y/N]:y
测试
五、实验总结
1.静态路由可以成功地将数据包从源设备发送到目标设备。通过手动配置路由表项,网络设备能够确定下一跳地址,并将数据包正确地传递到目标设备。
2.静态路由需要手动配置,并且需要手动更新路由表项以适应网络拓扑的变化。如果网络拓扑发生了变化,例如路由器之间的链路中断或新增了新的网络设备,就需要手动更新路由表项来适应变化。
3.静态路由可以用于简单网络环境中,其中网络拓扑相对稳定,路由变化不频繁的情况下。
4.静态路由的配置相对简单,但在大规模网络中,手动配置和管理路由表项会变得繁琐和复杂。对于复杂的网络环境,可能需要使用动态路由协议来实现自动化的路由更新和管理。
5.静态路由的优先级高于动态路由协议。当静态路由和动态路由协议同时存在时,静态路由将会优先生效。
6.静态路由可以用于实现特定的路由策略,例如实现负载均衡、流量控制或安全性要求等。