实验拓扑如下:
实验要求如下:
【1】R6为isp,接口IP地址均为公有地址;该设备只能配置IP地址,之后不能再对其进行任何配置
【2】R1~R5为局域网,私有IP地址192.168.1.0/24,请合理分配
【3】所有路由器上环回,均代表连接用户的接口
【4】R3下的两台PC通过DHCP自动获取IP地址
【5】选路最佳,路由表尽量小,避免环路
【6】R1~R5均可访问R6的环回
【7】R6 telnet R5的公有IP地址时,实际登陆到R1上
【8】R4与R5正常通过1000链路,故障时通过100兆链路
实验思路分析:
(1)合理的IP配置
(2)DHCP的配置
(3)静态路由和缺省路由的配置
(4)设置nat
实验步骤:
1、IP配置
指令如下:
R1:
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
[R1-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 192.168.1.33 28
[R1-LoopBack0]int l1
[R1-LoopBack1]ip address 192.168.1.49 28
R2:
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.1.2 30
[R2-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.1.9 30
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 192.168.1.65 28
[R2-LoopBack0]interface LoopBack 1
[R2-LoopBack1]ip address 192.168.1.81 28
R3:
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.1.6 30
[R3-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.1.13 30
[R3-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[R3-GigabitEthernet0/0/2]ip address 192.168.1.97 27
R4:
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.1.10 30
[R4-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.1.14 30
[R4-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[R4-GigabitEthernet0/0/2]ip address 192.168.1.17 30
[R4-GigabitEthernet0/0/2]interface GigabitEthernet 1/0/0
[R4-GigabitEthernet1/0/0]ip address 192.168.1.21 30
[R4]interface LoopBack 0
[R4-LoopBack0]ip address 192.168.1.129 28
[R4-LoopBack0]interface LoopBack 1
[R4-LoopBack1]ip address 192.168.1.145 28
R5:
[R5]interface GigabitEthernet 0/0/0
[R5-GigabitEthernet0/0/0]ip address 192.168.1.18 30
[R5-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/2
[R5-GigabitEthernet0/0/2]ip address 192.168.1.22 30
[R5-GigabitEthernet0/0/2]interface GigabitEthernet 0/0/1
[R5-GigabitEthernet0/0/1]ip address 12.1.1.1 24
[R5]interface LoopBack 0
[R5-LoopBack0]ip address 192.168.1.161 28
ISP:
[isp]interface GigabitEthernet 0/0/0
[isp-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[isp]interface LoopBack 0
[isp-LoopBack0]ip address 1.1.1.1 24
2、DHCP的配置
题目要求:PC3下(PC1和PC2)进行DHCP自动获取IP地址
指令如下:
dhcp enable
[R3]dhcp enable
[R3]ip pool 1
[R3-ip-pool-1]network 192.168.1.96 mask 27
[R3-ip-pool-1]gateway-list 192.168.1.97
[R3-ip-pool-1]int g0/0/2
[R3-GigabitEthernet0/0/2]dhcp select global
3、静态路由和缺省路由的配置
指令如下:
R1:
[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.12 30 192.168.1.6
[R1]ip route-static 192.168.1.20 30 192.168.1.6
[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.64 27 192.168.1.2
[R1]ip route-static 192.168.1.128 27 192.168.1.2
[R1]ip route-static 192.168.1.160 27 192.168.1.2
[R1]ip route-static 192.168.1.96 27 192.168.1.6
[R1]ip route-static 192.168.1.128 27 192.168.1.6
[R1]ip route-static 192.168.1.160 27 192.168.1.6
[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
[R5]ip route-static 192.168.1.32 27 NULL 0
R2:
[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.4 30 192.168.1.1
[R2]ip route-static 192.168.1.96 27 192.168.1.1
[R2]ip route-static 192.168.1.32 27 192.168.1.1
[R2]ip route-static 192.168.1.128 27 192.168.1.10
[R2]ip route-static 192.168.1.160 27 192.168.1.10
[R2]ip route-static 0.0.0.0 0 192.168.1.10
[R5]ip route-static 192.168.1.64 27 NULL 0
R3:
[R3]ip route-static 192.168.1.0 30 192.168.1.5
[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.14
[R3]ip route-static 192.168.1.20 30 192.168.1.14
[R3]ip route-static 192.168.1.32 27 192.168.1.5
[R3]ip route-static 192.168.1.64 27 192.168.1.5
[R3]ip route-static 192.168.1.128 27 192.168.1.14
[R3]ip route-static 192.168.1.64 27 192.168.1.14
[R3]ip route-static 192.168.1.160 27 192.168.1.14
[R3]ip route-static 0.0.0.0 0 192.168.1.14
[R5]ip route-static 192.168.1.96 27 NULL 0
R4:
[R4]ip route-static 192.168.1.0 30 192.168.1.9
[R4]ip route-static 192.168.1.4 30 192.168.1.13
[R4]ip route-static 192.168.1.96 27 192.168.1.13
[R4]ip route-static 192.168.1.32 27 192.168.1.13
[R4]ip route-static 192.168.1.64 27 192.168.1.9
[R4]ip route-static 192.168.1.32 27 192.168.1.9
[R4]ip route-static 192.168.1.160 27 192.168.1.18
[R4]ip route-static 192.168.1.160 27 192.168.1.22
[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 preference 61
[R5]ip route-static 192.168.1.128 27 NULL 0
R5:
[R5]ip route-static 192.168.1.8 30 192.168.1.17
[R5]ip route-static 192.168.1.8 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.0 30 192.168.1.17
[R5]ip route-static 192.168.1.0 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.4 30 192.168.1.17
[R5]ip route-static 192.168.1.4 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.12 30 192.168.1.17
[R5]ip route-static 192.168.1.12 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.32 27 192.168.1.17
[R5]ip route-static 192.168.1.32 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.64 27 192.168.1.17
[R5]ip route-static 192.168.1.64 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.96 27 192.168.1.17
[R5]ip route-static 192.168.1.96 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.128 27 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.160 27 NULL 0
4、设置nat
注意:
要使内网访问ISP的环回,需要将内网转化为一个公网
指令如下:
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R5-acl-basic-2000]q
[R5]interface GigabitEthernet 0/0/1
[R5-GigabitEthernet0/0/1]nat outbound 2000
[R5]ip route-static 0.0.0.0 0 12.1.1.2
[R5]ip route-static 12.1.1.0 24 NULL 0
设置R1的telnet
指令如下:
[R1]aaa
[R1-aaa]local-user zuo privilege level 15 password cipher 123456
[R1-aaa]local-user zuo service-type telnet
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
在R5设置nat端口映射进行转换
指令如下:
[R5]interface GigabitEthernet 0/0/1
[R5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 ins
ide 192.168.1.1 23