HCNA-VLAN間三層通信

我們知道默認不同VLAN間數據時不能通信的,想要實現不同VLAN間通信常用的有兩種方式


1、通過三層交換路由功能實現不同VLAN之間的通信

2、通過單臂路由實現不同VLAN之間的通信

通過三層SVI虛接口配置路由實現通信:

HCNA-VLAN間三層通信

vlan batch 20 30

#

interface Vlanif1

ip address 192.168.1.1 255.255.255.0

#

interface Vlanif20

ip address 192.168.20.1 255.255.255.0

#

interface Vlanif30

ip address 192.168.30.1 255.255.255.0

interface Ethernet0/0/1

port link-type access

port default vlan 20

#

interface Ethernet0/0/2

port link-type access

port default vlan 30

ip route-static 192.168.20.0 255.255.255.0 192.168.1.2

ip route-static 192.168.30.0 255.255.255.0 192.168.1.2

交換機的B配置

vlan batch 40

interface Vlanif1

ip address 192.168.1.2 255.255.255.0

#

interface Vlanif40

ip address 192.168.40.1 255.255.255.0

ip route-static 192.168.40.0 255.255.255.0 192.168.1.1

在兩個交換配之間端口做trunk配置,並允許所有的vlan通過

單臂路由:

HCNA-VLAN間三層通信

說明:AR1屬於vlan4 ,AR3屬於vlan8. 通過單臂路由的方式實現AR1和AR3之間的通信

SW1的配置:

1.創建vlan4 和8.

vlan batch 4 8

2.E0/0/1接口配置:

#

interface Ethernet0/0/1

port link-type access

port default vlan 4

#

3.E0/0/3接口配置:

#

interface Ethernet0/0/3

port link-type access

port default vlan 8

#

4.G0/0/2接口配置:

#

interface GigabitEthernet0/0/2

port link-type trunk

undo port trunk allow-pass vlan 1

port trunk allow-pass vlan 4 8

#

重點:

AR2的配置:

1.創建子接口:G0/0/1.1和G0/0/1.3

2.#

interface GigabitEthernet0/0/1.1

dot1q termination vid 4

ip address 10.0.4.254 255.255.255.0

arp broadcast enable

#

3.#

interface GigabitEthernet0/0/1.3

dot1q termination vid 8

ip address 10.0.8.254 255.255.255.0

arp broadcast enable

#

說明:1.配置子接口是為了節省接口。從而節省費用

2.子接口配置dot1q的目的是為了帶vlan的數據幀進入的時候比較pvid,如果相同則收,不同則丟棄。

帶vlan的數據幀出去的時候比較pvid相同剝掉tag,不同丟棄。(其實和Access端口的功能相同)

(dot1q就是802.1q,是vlan的一種封裝方式。dot就是點的意思,就簡寫為dot1q了.)

3.配置ARP 廣播是因為路由器的接口隔離廣播域,每一個接口就是一個廣播域,而ARP報文只能在同一個 廣播域泛洪,所以要開啟ARP廣播。


分享到:


相關文章: