部分重要代码
三层交换机:
Switch>enable
Switch#configure terminal //进入特权模式
Switch(config)#hostname switchD //改名字
switchD(config)#interface vlan 10 // 添加vlan
switchD(config-if)#ip address 192.168.10.254 255.255.255.0//添加ip
//switchD(config-if)#no ipaddress //删除ip
switchD(config-if)#no shutdown
switchD(config-if)#exit //退出
trunk的配置:
switchD#configure terminal
switchD(config)#interface fastEthernet 0/1
switchD(config-if)#switchport mode trunk【access】 //trunk设置(交换机与交换机)【access 电脑与交换机间的链接】
switchA:
创建VLAN:
switchA>enable
switchA#configure terminal
switchA(config)#vlan 10
switchA(config-vlan)#exit
switchA(config)#interface fastEthernet 0/1
switchA(config-if)#switchport mode access
switchA(config-if)#switchport access vlan 10
switchA(config-if)#exit
(从模拟器上复制下来的)
Switch>enable
Switch#con
Switch#conf
Switch#configure ter
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#inte
Switch(config)#interface fas
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#swi
Switch(config-if)#switchport mo
Switch(config-if)#switchport mode ac
Switch(config-if)#switchport mode access
Switch(config-if)#switc
Switch(config-if)#switchport acc
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#inter
Switch(config)#interface fa
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#swit
Switch(config-if)#switchport mod
Switch(config-if)#switchport mode ac
Switch(config-if)#switchport mode access
Switch(config-if)#switch
Switch(config-if)#switchport acces
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#host
Switch(config)#hostname switch
Switch(config)#hostname switch A
^
% Invalid input detected at '^' marker.
Switch(config)#hostname switchA
switchA(config)#int fa0/24
switchA(config-if)#swit
switchA(config-if)#switchport mode
switchA(config-if)#switchport mode t
switchA(config-if)#switchport mode trunk
Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode.
switchA(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
总拓扑图:
switch A
switch C
switch D