1ï¼åèè·¯ç±(å¾)
ç¯å¢ï¼ä¸å°è·¯ç±å¨ï¼ä¸å°äºå±äº¤æ¢æºï¼ä¸¤å°pcæº
äºå±äº¤æ¢æºçé
ç½®
ä¸è¬æ¨¡å¼ï¼
Switch>
è¾å
¥enableè¿å
¥ç¹æ模å¼ï¼
Switch>enable
è¾å
¥configure terminalè¿å
¥å
¨å±é
置模å¼ï¼
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
å建vlan 10 å vlan 20ï¼
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)# exit
è¿å
¥æ¥å£é
置模å¼ï¼
Switch(config)#interface fastEthernet 0/1
æ0/1åætrunkå£ï¼é»è®¤æ¯accesså£ï¼
Switch(config-if)#switchport mode trunk
%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
Switch(config-if)#exit
è¿å
¥æ¥å£é
置模å¼åå«æ对åºçæ¥å£ï¼å å
¥å¯¹åºçvlanï¼
Switch(config)#interface fastEthernet 1/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#interface fastEthernet 2/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
å°æ¤èå±äº¤æ¢æºé
ç½®å®æ¯ï¼
è·¯ç±å¨çé
ç½®ï¼
Router>
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#inter fas 0/0
Router(config-if)#no ip address
Router(config-if)#no shutdown
注æï¼åèè·¯ç±çé
ç½®ç¶æ¥å£ä¸å®è¦no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#int fas 0/0.10
%LINK-5-CHANGED: Interface FastEthernet0/0.10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.10, changed state to up
Router(config-subif)#encapsulation dot1Q 10
注æï¼å¨é
ç½®ipæ¶ä¸å®è¦å
å°è£
802.1qåè®®
Router(config-subif)#ip address 192.168.10.1 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#int fas 0/0.20
%LINK-5-CHANGED: Interface FastEthernet0/0.20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.20, changed state to up
Router(config-subif)#ip address 192.168.20.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 192.168.20.1 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#
æ¥çè·¯ç±è¡¨ï¼
Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.10.0/24 is directly connected, FastEthernet0/0.10
C 192.168.20.0/24 is directly connected, FastEthernet0/0.20
Router#
PC0çé
ç½®ï¼
ip 192.168.10.10
netmask 255.255.255.0
gateway 192.168.10.1
PC1çé
ç½®ï¼
ip 192.168.20.20
netmask 255.255.255.0
gateway 192.168.20.1
2.使ç¨SVIå®ç°VLANé´çéä¿¡ï¼å¾ï¼
ç¯å¢ï¼ä¸å°ä¸å±äº¤æ¢æºï¼ä¸¤å°pcæº
ä¸å±äº¤æ¢æºçé
ç½®ï¼
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
å建vlan 10 20
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#exit
é
ç½®SVIæ¥å£ip
Switch(config)#interface vlan 10
%LINK-5-CHANGED: Interface Vlan10, changed state to up
Switch(config-if)#ip address 192.168.10.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#interface vlan 20
%LINK-5-CHANGED: Interface Vlan20, changed state to up
Switch(config-if)#ip address 192.168.20.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
æ¹åæ¥å£æ¨¡å¼å¹¶å å
¥vlan
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#interface fastEthernet 0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#
çä¸å±äº¤æ¢æºçè·¯ç±è¡¨ï¼
Switch#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.10.0/24 is directly connected, Vlan10
C 192.168.20.0/24 is directly connected, Vlan20
Switch#
两主æºçé
ç½®ä¸åèè·¯ç±ä¸ä¸¤ä¸»æºçé
ç½®ä¸æ ·
3.跨交æ¢æºå®ç°VLANé´çéä¿¡ï¼å¾ï¼
ç¯å¢ï¼ä¸å°ä¸å±äº¤æ¢æºï¼ä¸¤å°äºå±äº¤æ¢æºï¼ä¸¤å°pcæº
ä¸å±äº¤æ¢æºçé
ç½®(SW3)
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
å建vlan 10 ã 20 并设置ip
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#exit
Switch(config)#interface vlan 10
%LINK-5-CHANGED: Interface Vlan10, changed state to up
Switch(config-if)#ip address 192.168.10.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#interface vlan 20
%LINK-5-CHANGED: Interface Vlan20, changed state to up
Switch(config-if)#ip address 192.168.20.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
设置æ¥å£æ¨¡å¼å¹¶å å
¥ç¸åºçvlanï¼æ³¨ætrunkå£ç设置ï¼
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#interface fastEthernet 0/1
Switch(config-if)#switchport access vlan 10
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switchport mode trunk
Switch(config-if)#interface fastEthernet 0/2
Switch(config-if)#switchport access vlan 20
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch#
çè·¯ç±è¡¨
Switch#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.10.0/24 is directly connected, Vlan10
C 192.168.20.0/24 is directly connected, Vlan20
SW21çé
ç½®
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode trunk
%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
Switch(config-if)#interface fastEthernet 1/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#
SW22çé
ç½®
Switch>
Switch>en
Switch#
Switch#configure ter
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#inter fas 1/1
Switch(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up
Switch(config-if)#switchport mode access
Switch(config-if)#inter fas 2/1
Switch(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet2/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet2/1, changed state to up
Switch(config-if)#exit
Switch(config)#vlan 20
Switch(config-vlan)#inter fas 1/1
Switch(config-if)#switchport access vlan 20
Switch(config-if)#
注æï¼ä¸¤äº¤æ¢æºä¹é´çé¾æ¥æ¯trunké¾è·¯
4.以ä¸é
ç½®å¨æ¨¡æå¨ä¸é½å¯å®ç°
å¨æ¨¡æå¨ä¸é
ç½®å
¶ä¸pcå¾ç
ä¸è¿°ä¸ç§æ¹å¼pcæºçé
ç½®é½ä¸æ ·
温馨提示:内容为网友见解,仅供参考