新添二层交换机2918到三层交换机3560

题目:新添二层交换机2918到三层交换机3560

作者:许明会
日期:14:09 2009/4/20

步骤:

0、将2918交换机连接到pc的com口,配置口令和ip地址。
1
、配置3560的5口和2918的1口味trunk口。
2
、同步2918和3560的vlan信息。
3
、在3560上添加新的vlan,在2918上分配端口所属vlan。
4
、补充知识

 原始配置文件的txt档可以从这里下载。

0、准备工作

要通过计算机的com口连接交换机的console口。cisco随设备提供一条com-console线。
如果你用无com口的笔记本,那么需要购买usb-com连接器,并安装相应的驱动程序。
首先,需要通过console口登录交换机,给2918交换机设置口令,并分配ip地址以便网络上的pc机等设备发现他。

         --- System Configuration Dialog ---

 
Would you like to enter the initial configuration dialog? [yes/no]: n
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname backBuilding
backBuilding(config)#enable password YOUR_PASSWORD
backBuilding(config)#line vty 0 15
backBuilding(config-line)#password YOUR_PASSWORD
backBuilding(config-line)#exit
backBuilding(config)#line con 0
backBuilding(config-line)#password YOUR_PASSWORD
backBuilding(config-line)#exit
backBuilding(config)#int vlan 1
backBuilding(config-if)#ip address 192.168.0.5 255.255.255.0
backBuilding(config-if)#end
backBuilding#write
Building configuration...

[OK]

backBuilding#

1、配置3560的5口和2918的1口味trunk口。

backBuilding>en
Password:
backBuilding#conf t
Enter configuration commands, one per line. End with CNTL/Z.

backBuilding(config)#int f0/1
backBuilding(config-if)#descr To 3560 Port 5
backBuilding(config-if)#switchport mode trunk
backBuilding(config-if)#end
backBuilding#wr

*Mar 1 03:13:14.775: %SYS-5-CONFIG_I: Configured from console by console

Building configuration...
[OK]

backBuilding#

--===---- [配置三层交换机的5口味trunk口]----===---

cisco3560>en
Password:

cisco3560#conf t
Enter configuration commands, one per line. End with CNTL/Z.

cisco3560(config)#int f0/5
cisco3560(config-if)#switchport trunk encapsulation dot1q
cisco3560(config-if)#descr Connect to BackBuilding Port 1
cisco3560(config-if)#switchport mode trunk
cisco3560(config-if)#end

cisco3560#wr
Building configuration...

[OK]
cisco3560#

2、同步2918和3560的vlan信息。

User Access Verification

Password:

cisco3560>en
Password:

cisco3560#192.168.0.6
Trying 192.168.0.6 ... Open

User Access Verification

Password:
backBuilding>en
Password:

backBuilding#conf t
Enter configuration commands, one per line. End with CNTL/Z.

backBuilding(config)#vtp domain lypower
Changing VTP domain name from NULL to lypower
backBuilding(config)#vtp password YOUR_PASSWORD
Setting device VLAN database password to YOUR_PASSWORD
backBuilding(config)#vtp mode client
Setting device to VTP CLIENT mode.
backBuilding(config)#end
backBuilding#wr

backBuilding#show vlan

3、在3560上添加新的vlan,在2918上分配端口所属vlan。

在3560上添加vlan,vlan属于配置信息,以文件的形式存放于交换机的flash存储器里面,可以用show flash命令查看到flash里面有vlan.dat文件。

vlan将所有的交换机端口划分到不同的网段实现安全的隔离。划分完vlan以后,可以将交换机的任意端口加入到任意的vlan。

--===-----[在3560上添加新的vlan]------===---

contigurue terminal

cisco3560#conf t
Enter configuration commands, one per line. End with CNTL/Z.

cisco3560(config)#vlan 19
cisco3560(config-vlan)#name jihuabu_2
cisco3560(config-vlan)#exit
cisco3560(config)#int vlan 19
cisco3560(config-if)#ip address 192.168.19.1 255.255.255.0
cisco3560(config-if)#end

cisco3560#192.168.0.6
Trying 192.168.0.6 ... Open

User Access Verification

Password:
backBuilding>en
Password:
backBuilding#show vlan brief

--===-----[划分二层交换机2918端口]------===---

backBuilding#conf t
Enter configuration commands, one per line. End with CNTL/Z.

backBuilding(config)#int range f0/2 - 12
backBuilding(config-if-range)#switchport access vlan 19
backBuilding(config-if-range)#end
backBuilding#

--==-------------------------END END--------------------------------==--

4、补充知识:

//将端口添加到vlan

interface f0/N     or interface range f0/M - N
switchport access vlan 19
end
show interface f0/N

//若要清除端口设置

conf t
defualt interface f0/N
end

//若要删除vlan
conf t
vlan 19
no vlan 19
end
show vlan brief

在交换机上执行show ip arp 显示客户端的mac地址和客户端IP地址;show mac-addr显示连接交换机的客户端设备的mac地址和接入交换机的端口号;
因此结合两个命令,可以查到任意IP接入的交换机端口。

思考:三层交换机3560上端口2直接接pc,端口1配置为trunk口接2918交换机,2918交换机的端口1接无线AP,然后又3台笔记本无线AP上网。分析通讯线路并检验是否正确。

原文地址:https://www.cnblogs.com/flaaash/p/1439691.html