【CISCO技術】基於GRE協議實現虛擬專用網絡遠程訪問

112828602.jpg


一、GRE協議概念:

通用路由封裝(GenericRoutingEncapsulation,GRE)是網絡中通過隧道將通信從一個專用網絡傳輸到另一個專用網絡常用到的一個協議。

GRE可以作爲***的第三層隧道協議,在協議層之間採用隧道(Tunnel)技術。Tunnel是一個虛擬的點對點的連接,可以看成僅支持點對點連接的虛擬接口,這個接口提供了一條通路,使封裝的數據報能夠在這個通路上傳輸,並在一個Tunnel的兩端分別對數據報進行封裝及解封裝。


二、實驗要求:通過使用GRE協議使得192.168.1.0/24內網用戶可以遠程訪問172.16.1.0/24網段。


三、配置思路:R1、R2、R3配置相關接口IP,使用EIGRP協議宣告各自公網地址(內網私有地址不能宣告到EIGRP中),R1、R3分別配置NAT使內網網段192.168.1.0/24、172.16.1.0/24可以訪問2.2.2.2/24(模擬公網服務器地址),利用Tunnel虛擬隧道技術實現192.168.1.0/24遠程訪問172.16.1.0/24。


四、實驗配置:

R1#


interface Loopback 0
ip address 1.1.1.1 255.255.255.0


interface Tunnel 0
ip address 10.1.1.1 255.255.255.0
tunnel source FastEthernet 0/0指定Tunnel0隧道源
tunnel destination 23.1.1.3指定Tunnel0隧道目的
no shutdown


interface FastEthernet 0/0
ipaddress 12.1.1.1 255.255.255.0
ip nat outside
no shutdown


interface FastEthernet 0/1
ip address 192.168.1.1 255.255.255.0
ip nat inside
no shutdown


router eigrp 100
network 12.1.1.0 0.0.0.255
network 1.1.1.0 0.0.0.255
no auto-summary


router rip使用RIP通告隧道地址及內網私有地址
network 10.0.0.0
network 192.168.1.0    no auto-summary


ip nat inside source list 1 interface FastEthernet 0/0 overload


ip route 0.0.0.0 0.0.0.0 12.1.1.2


access-list 1 permit 192.168.1.0 0.0.0.255


------------------------------------------------------------


R2#


interface Loopback 0
ip address 2.2.2.2 255.255.255.0
no shutdown


interface FastEthernet 0/0
ip address 23.1.1.2 255.255.255.0
no shutdown


interface FastEthernet 0/1
ip address 12.1.1.2 255.255.255.0
no shutdown


router eigrp 100
network 12.1.1.0 0.0.0.255
network 2.2.2.0 0.0.0.255
network 23.1.1.0 0.0.0.255
no auto-summary


----------------------------------------------------


R3#


interface Loopback 0
ip address 3.3.3.3255.255.255.0
no shutdown


interface Tunnel 0
ip address 10.1.1.2 255.255.255.0
tunnel source FastEthernet 0/1
tunnel destination 12.1.1.1
no shutdown


interface FastEthernet 0/0
ip address 172.16.1.1 255.255.255.0
ip nat inside
no shutdown


interface FastEthernet 0/1
ip address 23.1.1.3 255.255.255.0
ip nat outside
no shutdown


router eigrp 100
network 23.1.1.00.0.0.255
network 3.3.3.00.0.0.255
no auto-summary


router rip
version 2
network 10.0.0.0
network 172.16.1.0

no auto-summary


ip nat inside source list 1 interface FastEthernet 0/1 overload


ip route 0.0.0.0 0.0.0.0 23.1.1.2


access-list 1 permit 172.16.1.0 0.0.0.255


---------------------------------------------------------

實驗結果:

125210925.jpg

------------------------------------------------

125242316.jpg

-------------------------------------------------

125318533.jpg

------------------------------------------------

125511206.jpg

--------------------------------------------

125552241.jpg


----------------------------------------

從實驗結果可以看出:R1的路由表通過RIP學習到了一條172.16.1.0/24的路由,下一跳爲10.1.1.2,即從本地Tunnel0接口發出,R3與R1同理,達到了實驗要求的兩端私有IP通過GRE Tunnel隧道封裝訪問的效果。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章