Skip to main content


CISCO VLAN间路由的两种方式

2013-11-05 00:10 浏览:

1 单臂路由配置

161528386.png

 

Switch>

Switch>enable

Switch#config

Configuring from terminal, memory, or network [terminal]?

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#interface f0/1

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 10

% Access VLAN does not exist. Creating vlan 10

Switch(config-if)#interface f0/2

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 20

% Access VLAN does not exist. Creating vlan 20

Switch(config-if)#interface f0/3

Switch(config-if)#switchport trunk en?

% Unrecognized command

Switch(config-if)#switchport port

Switch(config-if)#switchport mode trunk

Switch(config-if)#switchport trunk ?

allowed Set allowed VLAN characteristics when interface is in trunking mode

native Set trunking native characteristics when interface is in trunking

mode

Switch(config-if)#switch trunk allow vlan all

 

Router>enable

Router#config

Router(config)#interface f0/0

Router(config-if)#no shutdown

Router(config-if)#interface f0/0.10

Router(config-subif)#encapsulation dot1Q ?

<1-1005> IEEE 802.1Q VLAN ID

Router(config-subif)#encapsulation dot1Q 10

Router(config-subif)#ip address 172.16.10.254 255.255.255.0

Router(config-subif)#interface f0/0.20

Router(config-subif)#encapsulation dot1Q 20

Router(config-subif)#ip address 172.168.20.254 255.255.255.0

Router(config-subif)#end

Router#copy runn start

会用到的一些命令:

show ip route

show running-config

ping ip

tracert ip

 

2 VLAN三层交换配置

161817301.png

PC1161817397.png PC2161817797.png

Switch>enable

Switch#config terminal

Switch(config)#interface f0/1

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 10

% Access VLAN does not exist. Creating vlan 10

Switch(config-if)#interface f0/2

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 20

% Access VLAN does not exist. Creating vlan 20

Switch(config-if)#interface vlan 10

Switch(config-if)#ip address 192.168.10.1 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#interface vlan 20

Switch(config-if)#ip address 192.168.20.1 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

Switch(config)#ip routing

Switch(config)#exit

Switch#copy running start

在 pc2 ping测试

 161817231.png

查看路由,命令show ip route

162211527.png

排查VLAN间路由故障

3.1 交换机配置问题

VLAN分配不正确及接入模式不正确

校验

S#show interfaces FastEthernet0/0switchport

S#show runn

3.2 路由器配置问题

3.3 IP 编址问题

163825721.png

163826173.png

163826631.png