單臂路由

第三次更新,內容爲單臂路由,即在一個物理接口上虛擬出多個虛擬子接口,實現原來相互隔離的不同VLAN之間的互通。

網絡拓撲圖如下:

pc0和pc1分別屬於量個不同的vlan,通過在R1上配置單臂路由,實現pc0和pc1互通。

代碼:

##基礎配置

#r0

en
conf t
int f0/0
ip add 192.168.10.1 255.255.255.0
no shut
int s0/0/0
ip add 192.168.20.1 255.255.255.0
no shut
exit
route ospf 1
network 192.168.10.0 0.0.0.255 area 1
network 192.168.20.0 0.0.0.255 area 0

#r1

en
conf t
int s0/0/1
ip add 192.168.30.1 255.255.255.0
no shut
int s0/0/0
ip add 192.168.20.2 255.255.255.0
no shut
exit
route ospf 1
network 192.168.30.0 0.0.0.255 area 0
network 192.168.20.0 0.0.0.255 area 0

#r2

en
conf t
int s0/0/1
ip add 192.168.40.1 255.255.255.0
no shut
int s0/0/0
ip add 192.168.30.2 255.255.255.0
no shut
exit
int tunnel 1
tunnel source s0/0/1
tunnel destination 192.168.40.2
ip add 10.1.1.1 255.255.255.0
exit
router ospf 1
network 10.1.1.0 0.0.0.255 area 0
network 192.168.30.0 0.0.0.255 area 0
network 192.168.40.0 0.0.0.255 area 2

#r3

en
conf t
int s0/0/1
ip add 192.168.50.1 255.255.255.0
no shut

結果檢測:

使用pc0 ping通 pc1。

發佈了36 篇原創文章 · 獲贊 73 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章