hostname>;用戶模式hostname#;特權模式hostname(config)#;全局配置模式ho">
1.交換機支持的命令:
交換機基本狀態:
switch:;ROM狀態,路由器是rommon>
hostname>;用戶模式
hostname#;特權模式
hostname(config)#;全局配置模式
hostname(config-if)#;接口狀態
交換機口令設置:
switch>enable;進入特權模式
switch#configterminal;進入全局配置模式
switch(config)#hostname;設置交換機的主機名
switch(config)#enablesecretxxx;設置特權加密口令
switch(config)#enablepasswordxxa;設置特權非密口令
switch(config)#lineconsole0;進入控制臺口
switch(config-line)#linevty04;進入虛擬終端
switch(config-line)#login;允許登錄
switch(config-line)#passwordxx;設置登錄口令xx
switch#exit;返回命令
交換機VLAN設置:
switch#vlandatabase;進入VLAN設置
switch(vlan)#vlan2;建VLAN*switch(vlan)#novlan2;刪vlan*switch(config)#intf0/1;進入端口*switch(config-if)#switchportaccessvlan2;當前端口加入vlan*switch(config-if)#switchportmodetrunk;設置為干線
switch(config-if)#switchporttrunkallowedvlan1,2;設置允許的vlan
switch(config-if)#switchporttrunkencapdot1q;設置vlan中繼
switch(config)#vtpdomain;設置發vtp域名
switch(config)#vtppassword;設置發vtp密碼
switch(config)#vtpmodeserver;設置發vtp模式
switch(config)#vtpmodeclient;設置發vtp模式
交換機設置IP地址:
switch(config)#interfacevlan1;進入vlan*switch(config-if)#ipaddress;設置IP地址
switch(config)#ipdefault-gateway;設置默認網關
switch#dirflash:;查看閃存
交換機顯示命令:
switch#write;保存配置信息
switch#showvtp;查看vtp配置信息
switch#showrun;查看當前配置信息
switch#showvlan;查看vlan配置信息
switch#showinterface;查看端口信息
switch#showintf0/0;查看指定端口信息
補充:
3層交換機多出的就是路由能力,體現在vlan的互相通信功能和端口的路由能力,下面介紹:
開啟路由功能:iprouting
進入vlan配置網段網關與路由配置接口相同
interfacevlan*ip192.168.1.1255.255.255.*路由配置與路由器配置相同只是把接口換為VLAN+VLAN號,開啟接口路由功能,進入接口配置:noswichport