GRE 6to4實驗

 

IPv6 6to4 基本實驗
 Ipv6ip 6to4 GRE他實現了動態的隧道綁定,不用像點到點那樣,每條路徑都需要去手工綁定,它只要做好tunnel source的端口就好,目的端口不需要指定,他根據ipv6地址中第2、3段組成(每段16位 2段32位正好能表示IPv4地址),而第一段要以2002開始,所以6to4的隧道地址的格式必需是2002:xxxx:xxxx::0/48,雖然有一定的限制,但是它能夠滿足的地址數量還是非常龐大的。各個小的IPv6域通過tunnel接口虛擬的鏈接,就像是拉了專線一樣,具體的我做了個小實驗,下面我把這次的小實驗分享一下。
 

 
1)R1、R2、R3相當於3臺與外網連接的路由器,他們內部都是IPv6域,所以要實現內部地址之間的通信就要用一些技術,我選擇了6to4的隧道技術
2)Ipv4域中,通過ospf保證之間的連通性,由於我是通過lookback口建立的隧道,因爲該接口不會down掉,能夠保持tunnel的穩定性,(大家也可以參考下BGP中IBGP鄰居建立的原理)
3)路由器要保證開啓了ipv6的轉發功能。
4)一定要跟ipv6地址做好映射,形成該ipv6網絡的/48的前綴,這是6to4能否成功的關鍵!
 
配置過程:
先說下配置順序思路:
1)配置好地址,測試其連通性(各個接口包括lookback的ip 地址)
2)配置好tunnel口。
3)在R1、R2、R3上配置IPv6的默認路由,好給自己旗下的那幾個孩子通告前進的方向(R4、R5、R6)
4)先配置v4的ospf,在配置v6的ospf 在v6中重分佈下靜態,以告知默認路由。
配置命令:
R1
interface Loopback0
 ip address 14.1.1.1 255.255.255.255
!
interface Tunnel0
 no ip address
 no ip redirects(關閉ICMP重定向)
 ipv6 unnumbered FastEthernet0/0 (借f0/0口地址)
 tunnel source Loopback0
 tunnel mode ipv6ip 6to4
!
interface FastEthernet0/0
 no ip address
 ipv6 address 2002:E01:101:1::2/64 (隱含ipv4地址 14.1.1.1)
 ipv6 ospf 10 area 0
!
interface FastEthernet0/1
 ip address 12.12.12.1 255.255.255.0
!
interface FastEthernet1/0
 ip address 13.13.13.1 255.255.255.0
 !
router ospf 10
 router-id 1.1.1.1
 network 12.12.12.1 0.0.0.0 area 0
 network 13.13.13.1 0.0.0.0 area 0
 network 14.1.1.1 0.0.0.0 area 0
!
ipv6 route 2002::/16 Tunnel0
ipv6 router ospf 10
 router-id 1.1.1.1
 log-adjacency-changes (ospf系統日誌反饋)
 redistribute static
R2
interface Loopback0
 ip address 25.1.1.1 255.255.255.255
!
interface Tunnel0
 no ip address
 no ip redirects
 ipv6 unnumbered FastEthernet0/0
 no ipv6 redirects
 tunnel source Loopback0
 tunnel mode ipv6ip 6to4
!        
interface FastEthernet0/0
 no ip address
 ipv6 address 2002:1901:101:1::2/64
 ipv6 ospf 10 area 0
!
interface FastEthernet0/1
 ip address 12.12.12.2 255.255.255.0
!
interface FastEthernet1/0
 ip address 23.23.23.2 255.255.255.0
!
router ospf 10
 router-id 2.2.2.2
 log-adjacency-changes
 network 12.12.12.2 0.0.0.0 area 0
 network 23.23.23.2 0.0.0.0 area 0
 network 25.1.1.1 0.0.0.0 area 0
!         
ipv6 route 2002::/16 Tunnel0
ipv6 router ospf 10
 router-id 2.2.2.2
 log-adjacency-changes
 redistribute static
R3
interface Loopback0
 ip address 36.1.1.1 255.255.255.255
!
interface Tunnel0
 no ip address
 no ip redirects
 ipv6 unnumbered FastEthernet0/0
 tunnel source Loopback0
 tunnel mode ipv6ip 6to4
!
interface FastEthernet0/0
 no ip address
 ipv6 address 2002:2401:101:1::2/64
 ipv6 ospf 10 area 0
!
interface FastEthernet0/1
 ip address 13.13.13.3 255.255.255.0
!
interface FastEthernet1/0
 ip address 23.23.23.3 255.255.255.0
 !
router ospf 10
 router-id 3.3.3.3
 log-adjacency-changes
 network 13.13.13.3 0.0.0.0 area 0
 network 23.23.23.3 0.0.0.0 area 0
 network 36.1.1.1 0.0.0.0 area 0
!
ipv6 route 2002::/16 Tunnel0
ipv6 router ospf 10
 router-id 3.3.3.3
 log-adjacency-changes
 redistribute static
R4
interface FastEthernet0/0
 no ip address
 ipv6 address 2002:E01:101:1::1/64
 ipv6 ospf 10 area 0
!
ipv6 router ospf 10
 router-id 4.4.4.4
 log-adjacency-changes
R5
interface FastEthernet0/0
 no ip address
 ipv6 address 2002:1901:101:1::1/64
 ipv6 ospf 10 area 0
!
ipv6 router ospf 10
 router-id 5.5.5.5
 log-adjacency-changes
 
R6
interface FastEthernet0/0
 no ip address
 ipv6 address 2002:2401:101:1::1/64
 ipv6 ospf 10 area 0
!
ipv6 router ospf 10
 router-id 6.6.6.6
 log-adjacency-changes
 
測試結果
 

 
抓包截圖:
 

 

 希望這個實驗能夠給同學一些的幫助,那我就滿足了!這是我第一次這這種東西,可能寫的不是很好!希望大家多多見諒!
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章