一台交换机和两台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#