1. 程式人生 > 實用技巧 >單臂路由實現VLAN間路由

單臂路由實現VLAN間路由



Switch>
Switch>en
Switch>enable
Switch#conf
Switch#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#h
Switch(config)#hostname SW1
SW1(config)#vl
SW1(config)#vlan 2
SW1(config-vlan)#exit
SW1(config)#in f0/1

SW1(config-if)#sw
SW1(config-if)#switchport m
SW1(config-if)#switchport mode a
SW1(config-if)#switchport mode access
SW1(config-if)#sw
SW1(config-if)#switchport a
SW1(config-if)#switchport access v
SW1(config-if)#switchport access vlan 1
SW1(config-if)#in f0/2
SW1(config-if)#sw
SW1(config-if)#switchport m
SW1(config-if)#switchport mode a
SW1(config-if)#switchport mode access
SW1(config-if)#sw
SW1(config-if)#switchport a
SW1(config-if)#switchport access v
SW1(config-if)#switchport access vlan 2
SW1(config-if)#in f0/3
SW1(config-if)#sw
SW1(config-if)#switchport m
SW1(config-if)#switchport mode t
SW1(config-if)#switchport mode trunk
SW1(config-if)#exit
SW1(config)#
%LINK-5-CHANGED: Interface FastEthernet0/3, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up



Router>en
Router>enable
Router#conf
Router#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h
Router(config)#hostname R1
R1(config)#in f0/0
R1(config-if)#no shu
R1(config-if)#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

R1(config-if)#in f0/0.1

%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up
R1(config-subif)#en
R1(config-subif)#encapsulation d
R1(config-subif)#encapsulation dot1Q 1 n
R1(config-subif)#encapsulation dot1Q 1 native
R1(config-subif)#ip add 172.16.1.1 255.255.255.0
R1(config-subif)#in f0/0.2

%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up
R1(config-subif)#en
R1(config-subif)#encapsulation d
R1(config-subif)#encapsulation dot1Q 2
R1(config-subif)#ip add 172.16.2.1 255.255.255.0
R1(config-subif)#exit
R1(config)#

轉載於:https://blog.51cto.com/yangfusheng/1083562