题目:
要求:
1, R6为ISP,接口IP地址均为公有地址,该设备只能配置IP地址,之后不能再对其进行其他任何配置;
2 ,R1-R5为局域网,私有IP地址192.168.1.0/24,请合理分配
3, R1,R2,R4,各有两个环地址,R5,R6各有一个环回地址,所有路由器上环回均代表连接用户的接口;
4,R3下的两台PC通过DHCP自动获取IP地址;
5,选路最佳,路由表尽量小,避免环路;
6,R1-R5均可以访问R6的环回:
7,R6 telnet R5的公有IP地址时,实际登陆到R1上;
8, R4与R5正常通过1000M链路,故障时通过100M链路;
分析:
1,把192.168.1.0/24网段进行划分,划分如下:
192.168.1.0/27
192.168.1.0/30
192.168.1.4/30
192.168.1.8/30
192.168.1.12/30
192.168.1.16/30
192.168.1.20/30
192.168.1.24/30
192.168.1.28/30
192.168.1.32/27
192.168.1.32/28
192.168.1.48/28
192.168.1.64/27
192.168.1.64/28
192.168.1.80/28
192.168.1.96/27
192.168.1.96/28
192.168.1.112/28
192.169.1.128/27
192.168.1.160/27
192.168.1.192/27
192.168.1.224/27
2,给外网的路由器配置IP和环回
3,给局域网的路由器配置接口IP和环回
4,在R3上启动DHCP协议使PC自动获取IP
5,使用静态路由的方法使局域网的网络全通
6,在R5的0/0/2的接口配置NAT
7,在R1启动telnet服务
8,在R5的0/0/2端口做端口映射
9,测试
第一步:
配IP以及环回
R1:
r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
Nov 12 2023 11:57:04-08:00 r1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]int g 0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.1.9 30
Nov 12 2023 11:57:20-08:00 r1 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r1-GigabitEthernet0/0/1]q
[r1]int l 0
[r1-LoopBack0]ip add 192.168.1.33 28
[r1-LoopBack0]int l 1
[r1-LoopBack1]ip add 192.168.1.49 28
R2:
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 30
[r2-GigabitEthernet0/0/0]
Nov 12 2023 11:58:12-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.1.5 30
Nov 12 2023 11:58:43-08:00 r2 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]int l 0
[r2-LoopBack0]ip add 192.168.1.65 28
[r2-LoopBack0]int l 1
[r2-LoopBack1]ip add 192.168.1.81 28
R3:
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.10 30
[r3-GigabitEthernet0/0/0]
Nov 12 2023 11:59:24-08:00 r3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.13 30
Nov 12 2023 11:59:43-08:00 r3 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]int l 0
[r3-LoopBack0]q
[r3]int g 0/0/2
[r3-GigabitEthernet0/0/2]ip add 192.168.1.161 27
R4:
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.6 30
Nov 12 2023 12:00:26-08:00 r4 %%01IFNET/4/LINK_STATE(l)[6]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.14 30
[r4-GigabitEthernet0/0/1]
Nov 12 2023 12:00:40-08:00 r4 %%01IFNET/4/LINK_STATE(l)[7]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]int g 0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.1.17 30
[r4-GigabitEthernet0/0/2]
Nov 12 2023 12:00:55-08:00 r4 %%01IFNET/4/LINK_STATE(l)[8]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4-GigabitEthernet0/0/2]int g 4/0/0
[r4-GigabitEthernet4/0/0]ip add 192.168.1.21 30
[r4-GigabitEthernet4/0/0]
Nov 12 2023 12:01:10-08:00 r4 %%01IFNET/4/LINK_STATE(l)[9]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[r4-GigabitEthernet4/0/0]int l 0
[r4-LoopBack0]ip add 192.168.1.97 28
[r4-LoopBack0]int l 1
[r4-LoopBack1]ip add 192.168.1.113 28
R5:
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.18 30
[r5-GigabitEthernet0/0/0]
Nov 12 2023 12:02:17-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5-GigabitEthernet0/0/0]int g 0/0/1
[r5-GigabitEthernet0/0/1]ip add 192.168.1.22 30
Nov 12 2023 12:02:39-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r5-GigabitEthernet0/0/1]int g 0/0/2
[r5-GigabitEthernet0/0/2]ip add 12.0.0.1 24
[r5-GigabitEthernet0/0/2]int l 0
[r5-LoopBack0]ip add 192.168.1.129 27
R6:
[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip add 12.0.0.2 24
Nov 12 2023 12:03:26-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r6-GigabitEthernet0/0/0]int l 0
[r6-LoopBack0]ip add 1.1.1.1 24
第二步:在R3配置dhcp服务获取两个pc ip 也可以自己配在pc上手工配IP
[r3]dhcp e
[r3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r3]ip pool aaa
Info: It's successful to create an IP address pool.
[r3-ip-pool-aaa]net
[r3-ip-pool-aaa]netw
[r3-ip-pool-aaa]network 192.168.1.160 m 27
[r3-ip-pool-aaa]gateway-
[r3-ip-pool-aaa]gateway-list 192.168.1.161
[r3-ip-pool-aaa]q
[r3]int g 0/0/2
[r3-GigabitEthernet0/0/2]dhcp se
[r3-GigabitEthernet0/0/2]dhcp select g
[r3-GigabitEthernet0/0/2]dhcp select global
查看IP配置
第三步:配置静态路由使全网可达
R1上:
[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
[r1]ip route-static 192.168.1.64 27 192.168.1.2
[r1]ip route-static 192.168.1.160 27 192.168.1.10
[r1]ip route-static 192.168.1.4 30 192.168.1.2
[r1]ip route-static 192.168.1.12 30 192.168.1.10
[r1]ip route-static 192.168.1.32 27 NULL 0(防环目的)
R2上:
[r2]ip route-static 0.0.0.0 0 192.168.1.6
[r2]ip route-static 192.168.1.160 27 192.168.1.1
[r2]ip route-static 192.168.1.160 27 192.168.1.6
[r2]ip route-static 192.168.1.8 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.12 30 192.168.1.6
[r2]ip route-static 192.168.1.64 27 NULL 0
R3上:
[r3]ip route-static 0.0.0.0 0 192.168.1.14
[r3]ip route-static 192.168.1.0 30 192.168.1.9
[r3]ip route-static 192.168.1.32 27 192.168.1.9
[r3]ip route-static 192.168.1.64 27 192.168.1.9
[r3]ip route-static 192.168.1.64 27 192.168.1.14
[r3]ip route-static 192.168.1.160 27 NULL 0
R4上:
[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 (配置缺省路由)
[r4]ip route-static 192.168.1.0 30 192.168.1.5
[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.64 27 192.168.1.5
[r4]ip route-static 192.168.1.160 27 192.168.1.13
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 70(配置浮动静态路由)
R5上:
[r5]ip route-static 0.0.0.0 0 12.0.0.2
[r5]ip route-static 192.168.1.0 24 192.168.1.17
[r5]ip route-static 192.168.1.0 24 192.168.1.21 preference 70
[r5]ip route-static 192.168.1.128 27 NULL 0
[r5]ip route-static 192.168.1.0 24 NULL 0
这样全网可通了
第四步:在R5的0/0/2口配置NAT 能访问外网
测试R1-R5的环回:
在R1上启动telnet服务
[r1]user-interface vty 0 4
[r1-ui-vty0-4]authentication-mode aa
[r1-ui-vty0-4]q
[r1]aa
[r1-aaa]local-user huawei password cipher 123
Info: Add a new user.
[r1-aaa]local-user huawei privilege level 15
[r1-aaa]local-user huawei service-type telnet
在R5中0/0/2启用端口映射
[r5-GigabitEthernet0/0/2]nat server protocol tcp global current-interface telnet
inside 192.168.1.1 telnet
Warning:The port 23 is well-known port. If you continue it may cause function fa
ilure.
Are you sure to continue?[Y/N]:y
在R6测试telnet服务