文章目录
- 一、实验拓扑
- 二、实验要求
- 三、实验配置
- S1配置命令
- S2配置命令
- S3配置命令
- R1配置命令
- R2配置命令
一、实验拓扑
二、实验要求
1.设置S1、S2、S3、R1、R2的主机名称。配置路由器R1 R2端口的IP地址。 2.R1路由器配置访问外网的默认路由,设置访问PC1和PC2所在的网段的静态路由。 3.R1上使用NAT Outbound动态地址池使得PC2所在的网段能够访问外网,ACL编号为2001,动态地址池编号为1,地址池范围为12.1.1.50-12.1.1.70 4.S3三层交换机上使用vlan batch命令创建vlan10、20、101,配置相应的access接口和trunk接口,trunk接口允许vlan10 、20 通过。S3上创建vlanif 10 ,vlanif 20,vlanif 30.S3上配置访问外网的默认路由.S3上创建DHCP全局地址池vlan20pool,地址池网段地址为192.168.20.0,网关为192.168.20.254 5.S1 S2交换机上使用vlan batch命令创建vlan10 vlan20,配置相应的access trunk接口,并且trunk接口允许vlan10 vlan20通过.
三、实验配置
S1配置命令
代码语言:javascript复制#S1配置命令
The device is running!
<Huawei>sys
<Huawei>system-view
Enter system view, return user view with Ctrl Z.
[Huawei]sys
[Huawei]sysname S1
[S1]
[S1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1]display vlan
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:Eth0/0/1(U) Eth0/0/2(D) Eth0/0/3(D) Eth0/0/4(D)
Eth0/0/5(U) Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D)
Eth0/0/9(D) Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D)
Eth0/0/13(D) Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D)
Eth0/0/17(D) Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D)
Eth0/0/21(D) Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D)
10 common
20 common
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
[S1]
#配置access口(S1与PC1端相连接的端口Ethernet0/0/1)
[S1]interface Ethernet0/0/1
[S1-Ethernet0/0/1]port link-type access
[S1-Ethernet0/0/1]port default vlan 10
[S1-Ethernet0/0/1]display this
#
interface Ethernet0/0/1
port link-type access
port default vlan 10
#
return
[S1-Ethernet0/0/1]quit
#配置trunk口(S1与三层交换机S3相连接的端口Ethernet0/0/5)
[S1]interface Ethernet0/0/5
[S1-Ethernet0/0/5]port link-type trunk
[S1-Ethernet0/0/5]port trunk allow-pass vlan 10 20
[S1-Ethernet0/0/5]display this
#
interface Ethernet0/0/5
port link-type trunk
port trunk allow-pass vlan 10 20
#
return
[S1-Ethernet0/0/5]quit
S2配置命令
代码语言:javascript复制# S2配置命令
The device is running!
<Huawei>system-view
Enter system view, return user view with Ctrl Z.
[Huawei]sysname S2
[S2]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[S2]display vlan
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:Eth0/0/1(U) Eth0/0/2(D) Eth0/0/3(U) Eth0/0/4(D)
Eth0/0/5(D) Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D)
Eth0/0/9(D) Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D)
Eth0/0/13(D) Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D)
Eth0/0/17(D) Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D)
Eth0/0/21(D) Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D)
10 common
20 common
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
[S2]
#配置access口(S2与PC2端相连接的端口Ethernet0/0/1)
[S2]interface Ethernet0/0/1
[S2-Ethernet0/0/1]port link-type access
[S2-Ethernet0/0/1]port default vlan 20
[S2-Ethernet0/0/1]display this
#
interface Ethernet0/0/1
port link-type access
port default vlan 20
#
return
[S2-Ethernet0/0/1]quit
#配置trunk口(S2与三层交换机S3相连接的端口Ethernet0/0/3)
[S2]interface Ethernet0/0/3
[S2-Ethernet0/0/3]port link-type trunk
[S2-Ethernet0/0/3]port trunk allow-pass vlan 10 20
[S2-Ethernet0/0/3]display this
#
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
#
return
[S2-Ethernet0/0/3]quit
S3配置命令
代码语言:javascript复制#S3配置命令
The device is running!
<Huawei>
<Huawei>system-view
Enter system view, return user view with Ctrl Z.
#配置S3主机名称
[Huawei]sysname S3
[S3]
#创建并查看vlan 10 20 101是否创建成功
[S3]vlan batch 10 20 101
Info: This operation may take a few seconds. Please wait for a moment...done.
[S3]display vlan
The total number of vlans is : 4
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:GE0/0/1(U) GE0/0/2(U) GE0/0/3(U) GE0/0/4(D)
GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D)
GE0/0/9(D) GE0/0/10(D) GE0/0/11(D) GE0/0/12(D)
GE0/0/13(D) GE0/0/14(D) GE0/0/15(D) GE0/0/16(D)
GE0/0/17(D) GE0/0/18(D) GE0/0/19(D) GE0/0/20(D)
GE0/0/21(D) GE0/0/22(D) GE0/0/23(D) GE0/0/24(D)
10 common
20 common
101 common
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
101 enable default enable disable VLAN 0101
[S3]
#配置trunk口(与二层交换机S1、S2相连接的端口GE0/0/2、GE0/0/3)
[S3]interface GigabitEthernet 0/0/2
[S3-GigabitEthernet0/0/2]port link-type trunk
[S3-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20
[S3-GigabitEthernet0/0/2]display this
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
#
return
[S3-GigabitEthernet0/0/2]quit
#配置trunk口(与二层交换机S1、S2相连接的端口GE0/0/2、GE0/0/3)
[S3]interface GigabitEthernet 0/0/3
[S3-GigabitEthernet0/0/3]port link-type trunk
[S3-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20
[S3-GigabitEthernet0/0/3]display this
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
#
return
[S3-GigabitEthernet0/0/3]quit
# 配置VLANIF 10接口IP地址(此地址为PC端默认的网关地址)
[S3]interface Vlanif 10
[S3-Vlanif10]ip address 192.168.10.254 24
[S3-Vlanif10]display this
#
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
#
return
[S3-Vlanif10]quit
# 配置VLANIF 20接口IP地址(此地址为PC端默认的网关地址)
[S3]interface Vlanif 20
[S3-Vlanif20]ip address 192.168.20.254 24
[S3-Vlanif20]display this
#
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
#
return
[S3-Vlanif20]quit
# 配置VLANIF 101接口IP地址并将GE0/0/1端口划分到VLAN 101中
[S3]interface Vlanif 101
[S3-Vlanif101]ip add
[S3-Vlanif101]ip address 10.0.1.2 24
[S3-Vlanif101]display this
#
interface Vlanif101
ip address 10.0.1.2 255.255.255.0
#
return
[S3-Vlanif101]quit
[S3]interface GigabitEthernet 0/0/1
[S3-GigabitEthernet0/0/1]port link-type access
[S3-GigabitEthernet0/0/1]port default vlan 101
[S3-GigabitEthernet0/0/1]display this
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 101
#
return
[S3-GigabitEthernet0/0/1]quit
[S3]
#S3三层交换机配置访问外网的默认路由