红色粗体代表关键字 蓝色代表用户自行输入的参数
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
交换机的概念可以到这了解http://baike.baidu.com/view/1077.htm
命令只要输入正确可以直接按TAB键补全,命令可以缩写。
基本命令解释:
Switch
# 特权模式
Switch(config)#
全局模式
Switch(config-if)#
接口设置模式
Switch>
enable
(en)
进入特权模式
Switch#
configure terminal
(conf t)
进入全局模式
Switch(config)#
interface fastethernet
0/1
(int f0/1)
进入端口设置模式
Switch(config)#
hostname
名字 设置交换机的名字
Switch#
vlan database
进入vlan配置模式
Switch(vlan)#
vlan
ID
name
名字 配置一个vlan
Switch(vlan)#
no vlan
ID
删除vlan
Switch(config-if)#
switchport mode access
把端口设置成access模式
Switch(config-if)#
switchport access vlan
ID
把当前端口加入vlan ID
Switch#
show
参数
通过此命令可以查看交换机的一些信息,show ?可以查看到后面有哪些命令,所有的命令都可以通过问号来获取
Switch#show running-config 查看当前交换机配置
Switch#show startup-config 查看交换机启动配置
Switch#
copy running-config startup-config 把当前的配置保存到启动中。不保存的话,当交换机重启后,所做的配置也就不存在了
Switch#
e
nable secret
密码
设置进入特权模式时需要的密码,secret属于设置加密密码,优先级高于明文密码。
Switch#
enable password
密码
设置进入特权模式时需要的密码,secret属于设置明文密码
Switch#
l
ine console 0
进入控制台
Switch#
line vty
0 4
进入虚拟终端,该模式是通过Telnet进入交换机时的一些设置
Switch(config-line)#
password
密码
设置通过Telnet登录时需要的密码,这个一定要设置
Switch(config-line)#
login
允许登录
Switch(config)#
exit
退回到上一个模式
Switch(config)
#
end
直接退回到特权模式Ctrl+C也一样
实际操作:
Switch>enable
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)
#hostname S
S(config)#enable secret 123
S(config)#enable password 123
S(config)#line console 0
S(config-line)#password 123
S(config-line)#login
S(config-line)#exit
S(config)#line vty ?
<0-15> First Line number
S(config)#line vty 0 15
S(config-line)#password 567
S(config-line)#login
S(config-line)#exit
Sh#vlan database
S(vlan)#vlan 2 name vlan2
VLAN 2 added:
Name: vlan2
S(vlan)#exit
S(config)#int f0/1
S(config-if)#switchport mode access
S(config-if)#switchport access vlan 2
S(config-if)#no shutdown
(启动端口,交换机默认情况下已经启动)
S(config-if)#end
哪里写的不好的大家可以说出来
转载于:https://blog.51cto.com/wutinghu/212906