思维导图
实验步骤
要求:
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、R6 telnet R5的公有地址时,实际登录到R1上;
8、R4与R5正常通过1000M链路,故障时通过100m链路;
1.地址划分如图所示
命令:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]id add 192.168.1.1 30
[R1-GigabitEthernet0/0/1]quit
[R1]
[R1]int g0/0/1
[R1-GigabitEthernet0/0/0]id add 192.168.1.5 30
[R1-GigabitEthernet0/0/1]quit
[R1]
[R1]int l0
[R1-LoopBack0]ip add 192.168.1.33 28
[R1-LoopBack0]quit
[R1]int l1
[R1-LoopBack1]ip add 192.168.1.49 28
[R1-LoopBack1]quit
[R1]
R2—R6以类似方法进行配置
2.R3下面的两个pc使用dhcp自动获取IP地址
(1)开启DHCP服务
[R3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R3]
(2)创建地址池
[R3]ip pool aa
Info: It's successful to create an IP address pool.
[R3-ip-pool-aa]
(3)配置地址池
[R3-ip-pool-aa]network 192.168.1.96 mask 27
[R3-ip-pool-aa]gateway-list 192.168.1.97
[R3-ip-pool-aa]dns-list 114.114.114.114 8.8.8.8
(4)在接口选择全局配置
[R3-GigabitEthernet0/0/0]dhcp select global
3.选路最佳,路由表尽量小(顺时针方向)
[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.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.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.160 27 192.168.1.2
[R1]ip route-static 192.168.1.160 27 192.168.1.6
[R1]ip route-static 192.168.1.20 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.12 30 192.168.1.6
[R1]ip route-static 192.168.1.96 27 192.168.1.6
[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.160 27 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
[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.128 27 192.168.1.14
[R3]ip route-static 192.168.1.16 30 192.168.1.14
[R3]ip route-static 192.168.1.160 27 192.168.1.14
[R3]ip route-static 192.168.1.20 30 192.168.1.14
[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 192.168.1.96 27 192.168.1.13
[R4]ip route-static 192.168.1.8 30 192.168.1.13
[R4]ip route-static 192.168.1.32 27 192.168.1.13
[R4]ip route-static 192.168.1.32 27 192.168.1.5
[R4]ip route-static 192.168.1.0 30 192.168.1.5
[R4]ip route-static 192.168.1.64 27 192.168.1.5
[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
[R5]ip route-static 192.168.1.12 30 192.168.1.21
[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.96 27 192.168.1.21
[R5]ip route-static 192.168.1.8 30 192.168.1.21
[R5]ip route-static 192.168.1.8 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.32 27 192.168.1.21
[R5]ip route-static 192.168.1.0 30 192.168.1.21
[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.64 27 192.168.1.21
[R5]ip route-static 192.168.1.4 30 192.168.1.21
[R5]ip route-static 192.168.1.4 30 192.168.1.17
4.避免环路
(1)null0口,路由器的一个虚拟接口,如果一条路由的出接口为空接口,都会被直接丢弃。空接口路由是解决环路的方式
(2)缺省
[R5]ip route-static 0.0.0.0 0 12.0.0.6
[R1]ip route-static 192.168.1.32 27 NULL 0
[R2]ip route-static 192.168.1.64 27 NULL 0
[R4]ip route-static 192.168.1.128 27 NULL 0
现在内网已经通了,测试如下:
5.R1-R5均可以访问R6的环回
(1)Net技术:
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R5-acl-basic-2000]quit
[R5]
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]nat outbound 2000
[R5-GigabitEthernet0/0/1]q
[R5]
(2)到公网的缺省:
[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.10
[R2]ip route-static 0.0.0.0 0 192.168.1.6
[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
6.R6 telnet R5的公有地址时,实际登录到R1上
[R1]aaa
[R1-aaa]local-user hhp password cipher 12345 privilege level 15
(用户名,密码,权限)
Info: Add a new user.
[R1-aaa]local-user hhp service-type telnet
[R1-aaa]q
[R1]
[R1]user-interface vty 0 4 (允许同时登陆数量)
[R1-ui-vty0-4]authentication-mode aaa (登陆方式)
[R1-ui-vty0-4]q
[R1]
端口映射:
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]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
[R5-GigabitEthernet0/0/1]q
[R5]
<R6>telnet 12.0.0.1
Press CTRL_] to quit telnet mode
Trying 12.0.0.1 ...
7.R4与R5正常通过1000M链路,故障时通过100m链路
浮动静态:
[R4]ip route-static 0.0.0.0 0 192.168.1.22 preference 61
Info: Succeeded in modifying route.
Mar 24 2024 17:29:22-08:00 R4 %%01RM/4/IPV4_DEFT_RT_CHG(l)[0]:IPV4 default Route
is changed. (ChangeType=Delete, InstanceId=0, Protocol=Static, ExitIf=GigabitEthernet4/0/0,Nexthop=192.168.1.22,Neighbour=0.0.0.0,Preference=1023410176, Label=NULL, Metric=0)
[R4]
[R5]ip route-static 192.168.1.0 30 192.168.1.21 preference 61
Info: Succeeded in modifying route.
[R5]ip route-static 192.168.1.32 27 192.168.1.21 preference 61
Info: Succeeded in modifying route.
[R5]ip route-static 192.168.1.8 30 192.168.1.21 preference 61
Info: Succeeded in modifying route.
[R5]ip route-static 192.168.1.96 27 192.168.1.21 preference 61
Info: Succeeded in modifying route.
[R5]ip route-static 192.168.1.12 30 192.168.1.21 preference 61
Info: Succeeded in modifying route.
[R5]ip route-static 192.168.1.64 27 192.168.1.21 preference 61
Info: Succeeded in modifying route.
[R5]ip route-static 192.168.1.4 30 192.168.1.21 preference 61
Info: Succeeded in modifying route.
[R5]ip route-static 192.168.1.128 27 192.168.1.21 preference 61
Info: Succeeded in modifying route.