最近在上计算机网络的实验课,有些命令怕忘了,做个笔记。

交换机命令

查看虚拟局域网

1
Switch#show vlan

创建虚拟局域网

1
2
3
4
5
6
7
8
9
10
11
12
Switch#vlan database
% 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.

Switch(vlan)#vlan 2 #创建vlan2
VLAN 2 added:
Name: VLAN0002

# 或者直接进入退出
Switch(config)#vlan 10
Switch(config-vlan)#ex

设置ip地址

1
2
3
4
5
6
Switch(config)#int vlan 2
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up
Switch(config-if)#ip address 192.168.1.2 255.255.255.0 #设置ip为192.168.1.2(可用作PC的网关)

接口配置truck模式

1
2
Switch(config)#int f0/1
Switch(config-if)#switchport mode trunk