Cisco交換機的基本配置
一臺交換機和兩臺PC機互通允許登陸交換機終端
命令配置:
SW1#vlan database //進入vlan數據庫
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.
SW1(vlan)#vlan 10 //創建個VLAN10
VLAN 10 added:
Name: VLAN0010
SW1(vlan)#vlan 20 //創建個vlan20 然後保存退出
VLAN 20 added:
Name: VLAN0020
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#
SW1#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#enable password 123456 //設置明文密碼
SW1(config)#line vty 0 4 //開啟5個端口
SW1(config-line)#password 123456 //設置密碼
SW1(config-line)#login //允許登錄
SW1(config-line)#exit
SW1(config)#int f1/1 進入端口
SW1(config-if)#switchport mode access //訪問模式
SW1(config-if)#switchport access vlan 10 //vlan10加入訪問模式
SW1(config-if)#int f1/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20 //vlan20加入訪問模式
SW1(config-if)#exit
SW1(config)#int vlan 10 //給vlan10設置IP地址
SW1(config-if)#ip address 192.168.10.1 255.255.255.0
SW1(config-if)#no sh
SW1(config-if)#int vlan 20
SW1(config-if)#ip address 192.168.20.1 255.255.255.0
SW1(config-if)#no sh
SW1(config-if)#
SW1#sh ip int br //查看端口的狀態
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset up down
FastEthernet1/1 unassigned YES unset up up
FastEthernet1/2 unassigned YES unset up up
FastEthernet1/3 unassigned YES unset up down
FastEthernet1/4 unassigned YES unset up down
FastEthernet1/5 unassigned YES unset up down
FastEthernet1/6 unassigned YES unset up down
FastEthernet1/7 unassigned YES unset up down
FastEthernet1/8 unassigned YES unset up down
FastEthernet1/9 unassigned YES unset up down
FastEthernet1/10 unassigned YES unset up down
FastEthernet1/11 unassigned YES unset up down
FastEthernet1/12 unassigned YES unset up down
FastEthernet1/13 unassigned YES unset up down
FastEthernet1/14 unassigned YES unset up down
FastEthernet1/15 unassigned YES unset up down
Vlan1 unassigned YES unset up down
Vlan10 192.168.10.1 YES manual up up
Vlan20 192.168.20.1 YES manual up up
SW1#
本文出自 “DY” 博客,請務必保留此出處http://guochenyong.blog.51cto.com/11367898/1972538
Cisco交換機的基本配置