hcip静态路由复习
以上是题目要求
内网非骨干网段一共分为R1的两个环回 R2的两个环回 R3的下面 R4的两个环回 R5的环回 将骨干网段看做一个网段:于是分为六部分 掩码右移动三位
192.168.1.160/27 192.168.1.192/27 192.168.1.224/27
分配给用户网段
192.168.1.0/27 192.168.1.32/27 192.168.1.64/27 192.168.1.96/27 192.168.1.128/27
骨干网段全部采用30位掩码配置
192.168.1.160 /30 192.168.1.164/30 192.168.1.168/30 192.168.1.172/30
192.168.1.176/30 192.168.1.180/30 192.168.1.184/30 192.168.1.188/30
首先配置ip
#先配置环回口
[Huawei]int LoopBack 0
[Huawei-LoopBack0]ip add 192.168.1.1 28
[Huawei]int LoopBack 1
[Huawei-LoopBack1]ip address 192.168.1.17 28
#再配置g001和g000
[R1-GigabitEthernet0/0/1]ip address 192.168.1.161 30
[R1-GigabitEthernet0/0/1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.169 30
#查看配置结果:
[R1-GigabitEthernet0/0/0]dis ip int br
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.169/30 up up
GigabitEthernet0/0/1 192.168.1.161/30 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.1.1/28 up up(s)
LoopBack1 192.168.1.17/28 up up(s)
NULL0 unassigned up up(s)
其余ip地址配置类似 不做过多展示只展现其接口ip
[R2]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.162/30 up up
GigabitEthernet0/0/1 192.168.1.165/30 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.1.33/28 up up(s)
LoopBack1 192.168.1.49/28 up up(s)
NULL0 unassigned up up(s)
[R3]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.170/30 up up
GigabitEthernet0/0/1 192.168.1.173/30 up up
GigabitEthernet0/0/2 192.168.1.65/27 up up
NULL0 unassigned up up(s)
[R4]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.166/30 up up
GigabitEthernet0/0/1 192.168.1.174/30 up up
GigabitEthernet0/0/2 192.168.1.181/30 up up
GigabitEthernet4/0/0 192.168.1.177/30 up up
LoopBack0 192.168.1.113/28 up up(s)
LoopBack1 192.168.1.97/28 up up(s)
NULL0 unassigned up up(s)
[R5]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.182/30 up up
GigabitEthernet0/0/1 56.0.0.1/24 up up
GigabitEthernet0/0/2 192.168.1.178/30 up up
LoopBack0 192.168.1.129/27 up up(s)
NULL0 unassigned up up(s)
[R6]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 56.0.0.2/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 6.6.6.6/24 up up(s)
NULL0 unassigned up up(s)
其中R3需要配置dhcp服务来让pc获得ip地址:
创建dhcp池子:
[R3-GigabitEthernet0/0/2]ip pool 1
Info: It's successful to create an IP address pool.
[R3-ip-pool-1]gateway-list 192.168.1.65
[R3-ip-pool-1]network 192.168.1.64 mask 27
[R3-ip-pool-1]network 192.168.1.64 mask 27
[R3-ip-pool-1]dis th
[V200R003C00]
#
ip pool 1
gateway-list 192.168.1.65
network 192.168.1.64 mask 255.255.255.224
#
return
开启dhcp服务:
[R3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]dhcp select global
在r1上开启Telnet服务:
[R1-aaa]local-user xiaoli privilege level 15 password cipher 123456
Info: Add a new user.
[R1-aaa]local-user xiaoli service-type telnet
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
开始配置路由
去上下两侧需要指定下一跳以保证路径足够短
[R1]ip route-static 192.168.1.32 27 192.168.1.162
[R1]ip route-static 192.168.1.64 27 192.168.1.170
[R1]ip route-static 192.168.1.172 30 192.168.1.170
[R1]ip route-static 192.168.1.164 30 192.168.1.162
去右侧直接指定缺省 实现负载均衡
[R1]ip route-static 0.0.0.0 0 192.168.1.162
[R1]ip route-static 0.0.0.0 0 192.168.1.170
空接口防环
[R1]ip route-static 192.168.1.0 27 null 0
[R1]dis ip routing-table protocol static
这一命令可以只看static的路由
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
Destinations : 6 Routes : 7 Configured Routes : 7
Static routing table status : <Active>
Destinations : 6 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 192.168.1.162 GigabitEthernet0/0/1
Static 60 0 RD 192.168.1.170 GigabitEthernet0/0/0
192.168.1.0/27 Static 60 0 D 0.0.0.0 NULL0
192.168.1.32/27 Static 60 0 RD 192.168.1.162 GigabitEthernet0/0/1
192.168.1.64/27 Static 60 0 RD 192.168.1.170 GigabitEthernet0/0/0
192.168.1.164/30 Static 60 0 RD 192.168.1.162 GigabitEthernet0/0/1
192.168.1.172/30 Static 60 0 RD 192.168.1.170 GigabitEthernet0/0/0
Static routing table status : <Inactive>
Destinations : 0 Routes : 0
R4R2R3路由配置较为简单 这里展现其路由表
【R2】
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 192.168.1.166 GigabitEthernet0/0/1
192.168.1.0/27 Static 60 0 RD 192.168.1.161 GigabitEthernet0/0/0
192.168.1.32/27 Static 60 0 D 0.0.0.0 NULL0166和161不能省去 如果省去就不会负载均衡了
192.168.1.64/27 Static 60 0 RD 192.168.1.161 GigabitEthernet0/0/0
Static 60 0 RD 192.168.1.166 GigabitEthernet0/0/1
192.168.1.168/30 Static 60 0 RD 192.168.1.161 GigabitEthernet0/0/0
【R3】Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.1.0/27 Static 60 0 RD 192.168.1.169 GigabitEthernet0/0/0
0.0.0.0/0 Static 60 0 RD 192.168.1.174 GigabitEthernet0/0/1
192.168.1.32/27 Static 60 0 RD 192.168.1.169 GigabitEthernet0/0/0
Static 60 0 RD 192.168.1.174 GigabitEthernet0/0/1
192.168.1.160/30 Static 60 0 RD 192.168.1.169 GigabitEthernet0/0/0
R4[R4]ip route-static 192.168.1.0 27 192.168.1.173
[R4]ip route-static 192.168.1.64 27 192.168.1.173
[R4]ip route-static 192.168.1.168 30 192.168.1.173
[R4]ip route-static 192.168.1.160 30 192.168.1.165
[R4]ip route-static 192.168.1.32 27 192.168.1.165[R4]ip route-static 192.168.1.0 27 192.168.1.165
浮动静态:
[R4]ip route-static 0.0.0.0 0 192.168.1.178 preference 61
[R4]ip route-static 0.0.0.0 0 192.168.1.182空接口防环
[R4]ip route-static 192.168.1.96 27 NULL 0
R5[R5]ip route-static 192.168.1.0 27 192.168.1.181
[R5]ip route-static 192.168.1.64 27 192.168.1.181
[R5]ip route-static 192.168.1.32 27 192.168.1.181
[R5]ip route-static 192.168.1.96 27 192.168.1.181
[R5]ip route-static 192.168.1.168 30 192.168.1.181
[R5]ip route-static 192.168.1.160 30 192.168.1.181
[R5]ip route-static 192.168.1.172 30 192.168.1.181
[R5]ip route-static 192.168.1.164 30 192.168.1.181[R5]ip route-static 192.168.1.0 27 192.168.1.177 preference 61
[R5]ip route-static 192.168.1.64 27 192.168.1.177 preference 61
[R5]ip route-static 192.168.1.32 27 192.168.1.177 preference 61
[R5]ip route-static 192.168.1.96 27 192.168.1.177 preference 61
[R5]ip route-static 192.168.1.168 30 192.168.1.177 preference 61
[R5]ip route-static 192.168.1.160 30 192.168.1.177 preference 61
[R5]ip route-static 192.168.1.172 30 192.168.1.177 preference 61
[R5]ip route-static 192.168.1.164 30 192.168.1.177 preference 61[R5]ip route-static 0.0.0.0 0 56.0.0.2
在r5上配置nat 使得能访问外网
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R5-acl-basic-2000]int g0/0/1
[R5-GigabitEthernet0/0/1]nat outbound 2000
为了让外界访问r1的Telnet需要端口映射
[AR5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 in
side 192.168.1.33 23
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[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.
成功 满足题目要求