二层交换机:
Switch>en
Switch#conf t
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)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
no shut
Switch(config-if)#exit
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
Switch(config-if)#no shut
Switch(config-if)#exit
Switch(config)#int f 0/1
Switch(config-if)#sw m a
Switch(config-if)#sw a vlan 10
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#exit
Switch(config)#int f 0/2
Switch(config-if)#sw m a
Switch(config-if)#sw a vlan 20
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#exit
Switch(config)#int r f 0/23-24
Switch(config-if-range)#sw m t
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up
Switch(config-if-range)#exit
Switch(config)#vlan 8
Switch(config-vlan)#name guanli
Switch(config-vlan)#exit
Switch(config)#int vlan 8
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan8, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan8, changed state to up
no shut
Switch(config-if)#ip add 192.168.8.2 255.255.255.0
Switch(config-if)#exit
Switch(config)#
三层交换机:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int r f 0/1-2
Switch(config-if-range)#sw m a
Switch(config-if-range)#sw m t
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
Switch(config-if-range)#exit
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#int vlan 10
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#no shut
Switch(config-if)#ip add 192.168.1.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#no shut
Switch(config-if)#ip add 192.168.2.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#vlan 8
Switch(config-vlan)#name guanli
Switch(config-vlan)#exit
Switch(config)#int vlan 8
%LINK-5-CHANGED: Interface Vlan8, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan8, changed state to up
Switch(config-if)#no shut
Switch(config-if)#ip add 192.168.8.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#ip routing
Switch(config)#enable password admin
Switch(config)#line vty 0
Switch(config-line)#password admin
Switch(config-line)#login
Switch(config-line)#exit
Switch(config)#
终端设备192.168.1.2:
PC>ping 192.168.8.1
Pinging 192.168.8.1 with 32 bytes of data:
Reply from 192.168.8.1: bytes=32 time=19ms TTL=255
Reply from 192.168.8.1: bytes=32 time=9ms TTL=255
Reply from 192.168.8.1: bytes=32 time=8ms TTL=255
Reply from 192.168.8.1: bytes=32 time=9ms TTL=255
Ping statistics for 192.168.8.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 8ms, Maximum = 19ms, Average = 11ms
PC>telnet 192.168.8.1
Trying 192.168.8.1 ...Open
User Access Verification
Password:
Switch>
网友评论