仅作为计算机网络期末课设的记录,有不对的地方欢迎指正!也希望我的记录对于查看博客的你有些许帮助。
软件版本:
Cisco Packet Tracer 7.2.1(比它高的版本皆可)
个人拓扑文件(仅供参考):
https://download.csdn.net/download/qq_45948932/71998266
DNS Server为 100.100.100.4
部门名称 | VLAN划分 | IP划分 | 默认网关 | 子网掩码 |
---|---|---|---|---|
部门1 | VLAN10 | 192.168.1.0/27 | 192.168.1.30 | 255.255.255.224 |
部门2 | VLAN11 | 192.168.1.32/27 | 192.168.1.62 | 255.255.255.224 |
部门3 | VLAN12 | 192.168.1.64/27 | 192.168.1.94 | 255.255.255.224 |
部门4 | VLAN13 | 192.168.1.96/27 | 192.168.1.126 | 255.255.255.224 |
部门5 | VLAN14 | 192.168.1.128/27 | 192.168.1.158 | 255.255.255.224 |
团队名称 | VLAN划分 | IP划分 | Gateway | 子网掩码 |
---|---|---|---|---|
团队1 | VLAN20 | 192.168.2.0/27 | 192.168.2.30 | 255.255.255.224 |
团队2 | VLAN21 | 192.168.2.32/27 | 192.168.2.62 | 255.255.255.224 |
团队3 | VLAN22 | 192.168.2.64/27 | 192.168.2.94 | 255.255.255.224 |
团队4 | VLAN23 | 192.168.2.96/27 | 192.168.2.126 | 255.255.255.224 |
团队5 | VLAN24 | 192.168.2.128/27 | 192.168.2.158 | 255.255.255.224 |
车间名称 | VLAN划分 | IP划分 | Gateway | 子网掩码 |
---|---|---|---|---|
车间1 | VLAN30 | 192.168.3.0/26 | 192.168.3.62 | 255.255.255.192 |
车间2 | VLAN31 | 192.168.3.64/26 | 192.168.3.126 | 255.255.255.192 |
车间3 | VLAN32 | 192.168.3.128/26 | 192.168.3.190 | 255.255.255.192 |
服务器名称 | VLAN划分 | IP划分 | Gateway | 子网掩码 |
---|---|---|---|---|
MAIL服务器 | VLAN100 | 100.100.100.1 | 100.100.100.254 | 255.255.255.0 |
WEB服务器 | VLAN100 | 100.100.100.2 | 100.100.100.254 | 255.255.255.0 |
FTP服务器 | VLAN100 | 100.100.100.3 | 100.100.100.254 | 255.255.255.0 |
DNS服务器 | VLAN100 | 100.100.100.4 | 100.100.100.254 | 255.255.255.0 |
接口名称 | 临近设备 | IP划分 | 子网掩码 |
---|---|---|---|
G0/0 | 防火墙 | 200.1.1.1 | 255.255.255.0 |
G0/1 | 三层交换机 | 12.1.1.2 | 255.255.255.252 |
G0/2 | 三层交换机 | 13.1.1.2 | 255.255.255.252 |
接口名称 | 临近设备 | IP划分 | 子网掩码 |
---|---|---|---|
G0/1 | 路由器 | 12.1.1.1 | 255.255.255.252 |
为各个一层交换机配置端口通信模式与vlan的关系
// 进入特权模式
en
// 进入全局配置模式
conf t
// 切换指令操作的硬件
host SWName
// 显示当前交换机中vlan与端口对应详细信息
show vlan brief
// 添加vlan
vlan vlan_Number
// 管理端口x
int f0/x
// 管理范围端口x-y
int range f0/x - f0/y
// 切换端口通信模式
sw mode trunk(acc)
// 端口通信为access时,加入x vlan
sw acc vlan x
// 端口通信为turnk时,加入到全部vlan中
sw tr al vl al
Switch>enable
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#host SWAdmin
SWAdmin(config)#vlan 10
SWAdmin(config-vlan)#exit
SWAdmin(config)#vlan 11
SWAdmin(config-vlan)#exit
SWAdmin(config)#vlan 12
SWAdmin(config-vlan)#exit
SWAdmin(config)#vlan 13
SWAdmin(config-vlan)#exit
SWAdmin(config)#vlan 14
SWAdmin(config-vlan)#exit
SWAdmin(config)#int f0/1
SWAdmin(config-if)#sw mode acc
SWAdmin(config-if)#sw acc vlan 10
SWAdmin(config-if)#exit
SWAdmin(config)#int f0/2
SWAdmin(config-if)#sw mode acc
SWAdmin(config-if)#sw acc vlan 11
SWAdmin(config-if)#exit
SWAdmin(config)#int f0/3
SWAdmin(config-if)#sw mode acc
SWAdmin(config-if)#sw acc vlan 12
SWAdmin(config-if)#exit
SWAdmin(config)#int f0/4
SWAdmin(config-if)#sw mode acc
SWAdmin(config-if)#sw acc vlan 13
SWAdmin(config-if)#exit
SWAdmin(config)#int f0/5
SWAdmin(config-if)#sw mode acc
SWAdmin(config-if)#sw acc vlan 14
SWAdmin(config-if)#exit
SWAdmin(config)#int f0/24
SWAdmin(config-if)#sw mo tr
SWAdmin(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
SWAdmin(config-if)#sw tr al vl al
SWAdmin(config-if)#exit
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#host SWSale
SWSale(config)#vlan 20
SWSale(config-vlan)#vlan 21
SWSale(config-vlan)#vlan 22
SWSale(config-vlan)#vlan 23
SWSale(config-vlan)#vlan 24
SWSale(config-vlan)#exit
SWSale(config)#int f0/1
SWSale(config-if)#sw mode acc
SWSale(config-if)#sw acc vlan 20
SWSale(config-if)#int f0/2
SWSale(config-if)#sw mode acc
SWSale(config-if)#sw acc vlan 21
SWSale(config-if)#int f0/3
SWSale(config-if)#sw mode acc
SWSale(config-if)#sw acc vlan 22
SWSale(config-if)#int f0/4
SWSale(config-if)#sw acc vlan 23
SWSale(config-if)#sw mode acc
SWSale(config-if)#int f0/5
SWSale(config-if)#sw mode acc
SWSale(config-if)#sw acc vlan 24
SWSale(config-if)#int f0/24
SWSale(config-if)#sw mode trunk
SWSale(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
SWSale(config-if)#sw tr al vl al
SWSale(config-if)#exit
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#host SWFactory
SWFactory(config)#vlan 30
SWFactory(config-vlan)#vlan 31
SWFactory(config-vlan)#vlan 32
SWFactory(config-vlan)#exit
SWFactory(config)#int f0/1
SWFactory(config-if)#sw mode acc
SWFactory(config-if)#sw acc vlan 30
SWFactory(config-if)#int f0/2
SWFactory(config-if)#sw mode acc
SWFactory(config-if)#sw acc vlan 31
SWFactory(config-if)#int f0/3
SWFactory(config-if)#sw mode acc
SWFactory(config-if)#sw acc vlan 32
SWFactory(config-if)#int f0/24
SWFactory(config-if)#sw mode tr
SWFactory(config-if)#sw tr al vl al
SWFactory(config-if)#exit
由于f0/23 - 24 端口采用链路聚合,需要进行进一步操作
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#host SWServer
SWServer(config)#vlan 100
SWServer(config-vlan)#exit
SWServer(config)#int f0/1
SWServer(config-if)#sw mo acc
SWServer(config-if)#sw acc vlan 100
SWServer(config-if)#int f0/2
SWServer(config-if)#sw mo acc
SWServer(config-if)#sw acc vlan 100
SWServer(config-if)#int f0/3
SWServer(config-if)#sw mo acc
SWServer(config-if)#sw acc vlan 100
SWServer(config-if)#int f0/4
SWServer(config-if)#sw mo acc
SWServer(config-if)#sw acc vlan 10
// 以下为链路聚合附加操作--建议之后设置
SWServer(config-if)#int range f0/23 - 24
SWServer(config-if)#sw mo tr
SWServer(config-if)#sw tr al vl al
SWServer(config-if)#exit
SWServer(config-if-range)#channel-group 1 mode on
SWServer(config-if-range)#
Creating a port-channel interface Port-channel 1
%LINK-5-CHANGED: Interface Port-channel1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
基于上述CLI指令进行补充
// 封装trunk端口IEEE802.1Q协议
switchport trunk encapsulution dot1q
sw tr en do
Switch>enable
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
// 添加vlan
Switch(config)#vlan 10
Switch(config-vlan)#vlan 11
Switch(config-vlan)#vlan 12
Switch(config-vlan)#vlan 13
Switch(config-vlan)#vlan 14
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 21
Switch(config-vlan)#vlan 22
Switch(config-vlan)#vlan 23
Switch(config-vlan)#vlan 24
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 31
Switch(config-vlan)#vlan 32
Switch(config-vlan)#vlan 100
Switch(config-vlan)#exit
// 端口设置
SWLeaf(config)#int range f0/1 - 3
SWLeaf(config-if-range)#sw tr en do
SWLeaf(config-if-range)#sw mo tr
SWLeaf(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
SWLeaf(config-if-range)#sw tr al vl al
SWLeaf(config-if-range)#exit
SWLeaf(config)#int f0/24
SWLeaf(config-if)#sw tr en do
SWLeaf(config-if)#sw mo tr
SWLeaf(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
SWLeaf(config-if)#sw tr al vl al
SWLeaf(config-if)#exit
// 这一块仅当SWLeafRight存在时使用
SWLeaf(config)#int range f0/22 - 23
SWLeaf(config-if-range)#sw tr en do
SWLeaf(config-if-range)#sw mo tr
SWLeaf(config-if-range)#sw tr al vl al
注意:这一块只有存在两台二层交换机才进行配置,同时也可能产生环路,需要使用快速生成树协议
注意:SWLeaf与SWLeafRight中的两根线不是为了链路聚合,而是为了提供冗余备份链路
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
// 添加vlan
Switch(config)#vlan 30
Switch(config-vlan)#vlan 31
Switch(config-vlan)#vlan 32
// 端口设置
Switch(config-vlan)#int f0/24
Switch(config-if)#sw tr en do
Switch(config-if)#sw mo tr
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
Switch(config-if)#sw tr al vl al
Switch(config-if)#no shut
Switch(config-if)#exit
Switch(config)#int f0/1
Switch(config-if)#sw tr en do
Switch(config-if)#sw mo tr
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#exit
Switch(config)#int range f0/22 - 23
Switch(config-if-range)#sw tr en do
Switch(config-if-range)#sw mo tr
Switch(config-if-range)#sw tr al vl al