第五部分,雲中繼。通過雲中繼路由器,實現不同網絡之間相互通信。
網絡拓撲圖如下:
我們需要在每個路由器與雲路由器相連的端口配置虛擬接口,以實現與其他網絡的通信,配置完成後,拓撲圖中的每臺pc機之間能夠相互通信。
代碼:
##基礎配置
#r0
en conf t int f0/0 ip add 172.168.10.1 255.255.255.0 no shut int s0/0/0 encapsulation frame-relay no shut int s0/0/0.1 point-to-point ip add 192.168.1.1 255.255.255.0 frame-relay interface-dlci 20 int s0/0/0.2 point-to-point ip add 192.168.2.1 255.255.255.0 frame-relay interface-dlci 21 exit router ospf 1 network 192.168.1.0 0.0.0.255 area 1 network 192.168.2.0 0.0.0.255 area 1 network 172.168.10.0 0.0.0.255 area 1
#r1
en conf t int f0/0 ip add 172.168.20.1 255.255.255.0 no shut int s0/0/0 encapsulation frame-relay no shut int s0/0/0.1 point-to-point ip add 192.168.1.2 255.255.255.0 frame-relay interface-dlci 30 int s0/0/0.2 point-to-point ip add 192.168.3.1 255.255.255.0 frame-relay interface-dlci 31 exit router ospf 1 network 192.168.1.0 0.0.0.255 area 1 network 192.168.3.0 0.0.0.255 area 1 network 172.168.20.0 0.0.0.255 area 1
#r2
en conf t int f0/0 ip add 172.168.30.1 255.255.255.0 no shut int s0/0/0 encapsulation frame-relay no shut int s0/0/0.1 point-to-point ip add 192.168.3.2 255.255.255.0 frame-relay interface-dlci 40 int s0/0/0.2 point-to-point ip add 192.168.1.2 255.255.255.0 frame-relay interface-dlci 41 exit router ospf 1 network 192.168.3.0 0.0.0.255 area 1 network 192.168.1.0 0.0.0.255 area 1 network 172.168.30.0 0.0.0.255 area 1
爲每個雲中繼路由器上每個serial接口的DLCI取別名,方便後面面配置,比如,serial0上的DLCI20,我將它分配給與R1通信,我就取名爲toR1:
配置雲中繼,R0要和R1通信,如果從R0到R1這邊看,從R0到R1使用Serial0上的toR1,要從R1回到R0,則使用Serial1上的toR0:
結果檢測:
pc0 ping pc2:
pc0 ping pc4: