VLAN间路由

1.单臂路由实现VLAN间路由

华为配置案例3:Vlan间路由_vlan间路由


sw1:

vlan batch 2 to 3


interface GigabitEthernet0/0/1

port link-type access

port default vlan 2


interface GigabitEthernet0/0/2

port link-type access

port default vlan 3


interface GigabitEthernet0/0/3

port link-type trunk

port trunk allow-pass vlan 2 to 3


AR1:

interface GigabitEthernet0/0/0.2

dot1q termination vid 2

ip address 192.168.2.1 255.255.255.0

arp broadcast enable


interface GigabitEthernet0/0/0.3

dot1q termination vid 3

ip address 192.168.3.1 255.255.255.0

arp broadcast enable


注释:arp broadcast enable命令用来使能子接口的ARP广播功能。缺省情况下,子接口没有使能ARP广播功能。子接口不能转发广播报文,在收到广播报文后它们直接把该报文丢弃。为了允许子接口能转发广播报文,可以通过在子接口上执行此命令。


[AR1]display ip interface brief

*down: administratively down

^down: standby

(l): loopback

(s): spoofing

The number of interface that is UP in Physical is 4

The number of interface that is DOWN in Physical is 2

The number of interface that is UP in Protocol is 3

The number of interface that is DOWN in Protocol is 3


Interface IP Address/Mask Physical Protocol

GigabitEthernet0/0/0 unassigned up down

GigabitEthernet0/0/0.2 192.168.2.1/24 up up

GigabitEthernet0/0/0.3 192.168.3.1/24 up up

GigabitEthernet0/0/1 unassigned down down

GigabitEthernet0/0/2 unassigned down down

NULL0 unassigned up up(s)


PC1可以ping通PC2

PC>ping 192.168.3.2


Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break

Request timeout!

From 192.168.3.2: bytes=32 seq=2 ttl=127 time=78 ms

From 192.168.3.2: bytes=32 seq=3 ttl=127 time=94 ms

From 192.168.3.2: bytes=32 seq=4 ttl=127 time=93 ms

From 192.168.3.2: bytes=32 seq=5 ttl=127 time=125 ms


--- 192.168.3.2 ping statistics ---

5 packet(s) transmitted

4 packet(s) received

20.00% packet loss

round-trip min/avg/max = 0/97/125 ms

此方法生产环境已经用得不多了

2.三层交换机实现VLAN间路由

华为配置案例3:Vlan间路由_vlan间路由_02


sw1:

vlan batch 2 to 3


interface GigabitEthernet0/0/1

port link-type access

port default vlan 2


interface GigabitEthernet0/0/2

port link-type access

port default vlan 3


interface Vlanif2

ip address 192.168.2.1 255.255.255.0

#

interface Vlanif3

ip address 192.168.3.1 255.255.255.0


PC1可以ping通PC2

PC>ping 192.168.3.2


Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break

From 192.168.3.2: bytes=32 seq=1 ttl=127 time=94 ms

From 192.168.3.2: bytes=32 seq=2 ttl=127 time=47 ms

From 192.168.3.2: bytes=32 seq=3 ttl=127 time=31 ms

From 192.168.3.2: bytes=32 seq=4 ttl=127 time=47 ms

From 192.168.3.2: bytes=32 seq=5 ttl=127 time=31 ms


--- 192.168.3.2 ping statistics ---

5 packet(s) transmitted

5 packet(s) received

0.00% packet loss

round-trip min/avg/max = 31/50/94 ms

该案例经常在生产环境中使用


查看命令:

dis ip int b

dis ip route