IP第一次实验(IA综合实验复习)

该实验旨在实现全网可达,使用192.168.0.0/24地址块进行子网划分,配置二层交换机的VLAN及DHCP服务,三层路由器的静态路由,最后确保内部网络互通并连接到外网。配置包括R2、R1、R3、R4和R5的接口IP地址,以及各路由器之间的静态路由。
摘要由CSDN通过智能技术生成

目录

实验需求:

实验步骤:

IP地址的划分:

配置二层设备

 配置三层设备

连接外网


实验需求:

1.全网可达
2.所有地址基于192.168.0.0 24 划分
3.使用静态路由
4.R1环回汇总

 

实验步骤:

IP地址的划分:

观察拓扑结构,可以发现有六个广播域需要用于数据链路,R2的环回需要一个广播域并进行子网划分分成四个环回地址。R4上有两个VLAN需要两个网段。所以我们先对网段一分为八,再分别对R2,R4上的网段进行子网划分。

R2-R1:192.168.0.32 27

R1-R3:192.168.0.64 27

R3-R5(100M):192.168.0.96 27

R3-R5(1000M):192.168.0.128 27

R3-R4:192.168.0.160 27

R4-R2:192.168.0.192 27

R2:0.224 27
0.224 29
0.232 29
0.240 29
0.248 29

R4:0.0 27
0.0 28
0.16 28

配置二层设备

思路是先进行终端VLAN的划分,把交换机的配置都配完,并且让终端启用DHCP服务。

LSW1:

首先创建VLAN2 和VLAN 3

[LSW1]vlan 2
[LSW1-vlan2]q
[LSW1]v	
[LSW1]vlan 3
[LSW1-vlan3]q
[LSW1]int g 0/0/2
[LSW1-GigabitEthernet0/0/2]p	
[LSW1-GigabitEthernet0/0/2]port l	
[LSW1-GigabitEthernet0/0/2]port link-t	
[LSW1-GigabitEthernet0/0/2]port link-type a	
[LSW1-GigabitEthernet0/0/2]port link-type access 
[LSW1-GigabitEthernet0/0/2]p	
[LSW1-GigabitEthernet0/0/2]port d	
[LSW1-GigabitEthernet0/0/2]port discard	
[LSW1-GigabitEthernet0/0/2]port default v	
[LSW1-GigabitEthernet0/0/2]port default vlan 2
[LSW1-GigabitEthernet0/0/2]int g 0/0/3
[LSW1-GigabitEthernet0/0/3]p	
[LSW1-GigabitEthernet0/0/3]port l	
[LSW1-GigabitEthernet0/0/3]port link-t	
[LSW1-GigabitEthernet0/0/3]port link-type a	
[LSW1-GigabitEthernet0/0/3]port link-type access 
[LSW1-GigabitEthernet0/0/3]p	
[LSW1-GigabitEthernet0/0/3]port d	
[LSW1-GigabitEthernet0/0/3]port discard	
[LSW1-GigabitEthernet0/0/3]port default v	
[LSW1-GigabitEthernet0/0/3]port default vlan 3
[LSW1-GigabitEthernet0/0/3]int g 0/0/4
[LSW1-GigabitEthernet0/0/4]p	
[LSW1-GigabitEthernet0/0/4]port t	
[LSW1-GigabitEthernet0/0/4]port type l	
[LSW1-GigabitEthernet0/0/4]port t	
[LSW1-GigabitEthernet0/0/4]port type 	
[LSW1-GigabitEthernet0/0/4]port type 	
[LSW1-GigabitEthernet0/0/4]port l	
[LSW1-GigabitEthernet0/0/4]port link-t	
[LSW1-GigabitEthernet0/0/4]port link-type t	
[LSW1-GigabitEthernet0/0/4]port link-type trunk 
[LSW1-GigabitEthernet0/0/4]p	
[LSW1-GigabitEthernet0/0/4]port t	
[LSW1-GigabitEthernet0/0/4]port trunk a	
[LSW1-GigabitEthernet0/0/4]port trunk allow-pass
[LSW1-GigabitEthernet0/0/4]int g 0/0/1
[LSW1-GigabitEthernet0/0/1]dis	
[LSW1-GigabitEthernet0/0/1]display th	
[LSW1-GigabitEthernet0/0/1]display this 
#
interface GigabitEthernet0/0/1
#
return
[LSW1-GigabitEthernet0/0/1]po	
[LSW1-GigabitEthernet0/0/1]port l	
[LSW1-GigabitEthernet0/0/1]port link-t	
[LSW1-GigabitEthernet0/0/1]port link-type t	
[LSW1-GigabitEthernet0/0/1]port link-type trunk 
[LSW1-GigabitEthernet0/0/1]p	
[LSW1-GigabitEthernet0/0/1]port t	
[LSW1-GigabitEthernet0/0/1]port trunk a	
[LSW1-GigabitEthernet0/0/1]port trunk allow-pass 

配置命令都是一样的,交换机连交换机用trunk,交换机连终端用

方便记忆我就直接用display的形式给大家呈现其余的配置(配置都是大同小异)

[LSW2]int g 0/0/1
[LSW2-GigabitEthernet0/0/1]dis	
[LSW2-GigabitEthernet0/0/1]display th	
[LSW2-GigabitEthernet0/0/1]display this 
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 3
#
return
[LSW2-GigabitEthernet0/0/1]int g 0/0/2
[LSW2-GigabitEthernet0/0/2]dis	
[LSW2-GigabitEthernet0/0/2]display th	
[LSW2-GigabitEthernet0/0/2]display this 
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 2
#
return
[LSW2-GigabitEthernet0/0/2]int g 0/0/3
[LSW2-GigabitEthernet0/0/3]dis	
[LSW2-GigabitEthernet0/0/3]display  th	
[LSW2-GigabitEthernet0/0/3]display  this 
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 3
#
return

R4中关于DHCP的配置以及VLAN的设置:

DHCP的配置就是开启DHCP服务,创建IP池塘,接口连接DHCP

[R4-GigabitEthernet0/0/2.1]display this 
[V200R003C00]
#
interface GigabitEthernet0/0/2.1
 dot1q termination vid 2
 ip address 192.168.0.1 255.255.255.240 
 arp broadcast enable
 dhcp select global
#
return
[R4-GigabitEthernet0/0/2.1]int g 0/0/2.2
[R4-GigabitEthernet0/0/2.2]dh	
[R4-GigabitEthernet0/0/2.2]dhcp  se	
[R4-GigabitEthernet0/0/2.2]dhcp  select go	
[R4-GigabitEthernet0/0/2.2]dhcp  select g	
[R4-GigabitEthernet0/0/2.2]dhcp  select global 
[R4-GigabitEthernet0/0/2.2]dis	
[R4-GigabitEthernet0/0/2.2]discard
[R4-GigabitEthernet0/0/2.2]display th	
[R4-GigabitEthernet0/0/2.2]display this 
[V200R003C00]
#
interface GigabitEthernet0/0/2.2
 dot1q termination vid 3
 ip address 192.168.0.17 255.255.255.240 
 arp broadcast enable
 dhcp select global
#
return

选择一个终端利用ipconfig和pingPC1的地址就证明我们的DHCP服务和VLAN划分没有问题

 配置三层设备

先配路由器的接口地址

以R2的为例子,因为配置命令都是一样的

[Huawei]sys R2
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip ad	
[R2-GigabitEthernet0/0/1]ip address 192.168.0.193 27
Jul 17 2023 13:15:12-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R2-GigabitEthernet0/0/1]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip ad	
[R2-GigabitEthernet0/0/0]ip address 192.168.0.32 27
Error: The specified IP address is invalid.
[R2-GigabitEthernet0/0/0]ip address 192.168.0.33 27
Jul 17 2023 13:15:32-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]q
[R2]int l	
[R2]int LoopBack  0
[R2-LoopBack0]ip ad	
[R2-LoopBack0]ip address 192.168.0.225 29
[R2-LoopBack0]q
[R2]int l 1
[R2-LoopBack1]ip ad	
[R2-LoopBack1]ip address 192.168.0.233 29
[R2-LoopBack1]q
[R2]int l 2
[R2-LoopBack2]ip ad	
[R2-LoopBack2]ip address 192.168.0.241 29
[R2-LoopBack2]q
[R2]int l 3
[R2-LoopBack3]ip ad	
[R2-LoopBack3]ip address 192.168.0.249 29
[R2-LoopBack3]q

展示结果

R2:

[R2]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 7
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 7
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.0.33/27      up         up        
GigabitEthernet0/0/1              192.168.0.193/27     up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         192.168.0.225/29     up         up(s)     
LoopBack1                         192.168.0.233/29     up         up(s)     
LoopBack2                         192.168.0.241/29     up         up(s)     
LoopBack3                         192.168.0.249/29     up         up(s)     
NULL0                             unassigned           up         up(s)     
[R2]

R1:

[R1]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.0.34/27      up         up        
GigabitEthernet0/0/1              192.168.0.65/27      up         up        
GigabitEthe

R3:

[R3]display ip interface brief 
*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 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.0.66/27      up         up        
GigabitEthernet0/0/1              192.168.0.162/27     up         up        
GigabitEthernet0/0/2              192.168.0.129/27     up         up        
GigabitEthernet4/0/0              192.168.0.97/27      up         up        
NULL0  

R5:

[R5]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.0.130/27     up         up        
GigabitEthernet0/0/1              192.168.0.98/27      up         up        
GigabitEthernet0/0/2              100.1.1.1/24         up         up        
NULL0  

R6

[Huawei]sys R6
[R6]int g 0/0/0
[R6-GigabitEthernet0/0/0]ip ad	
[R6-GigabitEthernet0/0/0]ip address 100.1.1.2 24
Jul 17 2023 13:24:23-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 

IP 地址配置完成之后开始配置静态IP地址

R2:

[R2]ip route-static 192.168.0.64 27 192.168.0.34
[R2]
[R2]ip route-static 192.168.0.96 27 192.168.0.34
[R2]
[R2]ip route-static 192.168.0.128 27 192.168.0.34
[R2]
[R2]ip route-static 192.168.0.0 28 192.168.0.194
[R2]
[R2]ip route-static 192.168.0.16 28 192.168.0.194
[R2]
[R2]ip route-static 192.168.0.160 27 192.168.0.194
[R2]
[R2]ip route-static 192.168.0.96 27 192.168.0.194
[R2]
[R2]ip route-static 192.168.0.128 27 192.168.0.194

R1:

[R1]ip route-static 192.168.0.224 27 192.168.0.33
[R1]
[R1]ip route-static 192.168.0.192 27 192.168.0.33
[R1]
[R1]ip route-static 192.168.0.0 28 192.168.0.33
[R1]
[R1]ip route-static 192.168.0.16 28 192.168.0.33
[R1]
[R1]ip route-static 192.168.0.160 27 192.168.0.66
[R1]
[R1]ip route-static 192.168.0.0 28 192.168.0.66
[R1]
[R1]ip route-static 192.168.0.16 28 192.168.0.66

R3:

[R3]ip route-static 192.168.0.16 28 192.168.0.161
[R3]
[R3]ip route-static 192.168.0.0 28 192.168.0.161
[R3]
[R3]ip route-static 192.168.0.192 27 192.168.0.161
[R3]
[R3]ip route-static 192.168.0.224 27 192.168.0.161
[R3]
[R3]ip route-static 192.168.0.32 27 192.168.0.65
[R3]
[R3]ip route-static 192.168.0.224 27 192.168.0.65

R4:

[R4]ip route-static 192.168.0.224 27 192.168.0.193
[R4]
[R4]ip route-static 192.168.0.32 27 192.168.0.193
[R4]
[R4]ip route-static 192.168.0.64 27 192.168.0.162
[R4]
[R4]ip route-static 192.168.0.96 27 192.168.0.162
[R4]
[R4]ip route-static 192.168.0.128 27 192.168.0.162

R5:

[R5]ip route-static 192.168.0.64 27 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.64 27 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.32 27 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.32 27 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.224 27 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.224 27 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.160 27 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.160 27 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.192 27 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.192 27 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.0 28 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.0 28 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.16 28 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.16 28 192.168.0.129

测试是否全网通:

 

 测试完成,实现内网全网通

连接外网

先配置缺省路由:

[R4]ip route-static 0.0.0.0 0 192.168.0.162
[R4]ip route-static 192.168.0.224 27 NULL 0
[R2]ip route-static 0.0.0.0 0 192.168.0.194
[R1]ip route-static 0.0.0.0 0 192.168.0.66
[R1]ip route-static 192.168.0.224 27 NULL 0
[R3]ip route-static 0.0.0.0 0 192.168.0.98
[R3]ip route-static 0.0.0.0 0 192.168.0.130
[R5]ip route-static 0.0.0.0 0 100.1.1.2

配置NAPT

[R5]acl 2000 
[R5-acl-basic-2000]rule permit source 192.168.0.0 0.0.0.255
[R5]int g 0/0/2
[R5-GigabitEthernet0/0/2]nat outbound 2000

 全网通

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值