Конфигуриране на GRE тунел с устройства на Cisco

от БАРЗИКТ Wiki
Направо към: навигация, търсене


Примерна топология

GRE Topology.png

Първоначална конфигурация

R1

enable
configure terminal
hostname R1
interface Gi0/0
ip address 11.0.0.1 255.0.0.0
no shutdown
interface Gi0/1
ip address 10.1.0.1 255.255.0.0
no shutdown
exit
router eigrp 101
network 11.0.0.0
end

R2

enable
configure terminal
hostname R2
interface Gi0/0
ip address 11.0.0.2 255.0.0.0
no shutdown
interface Gi0/1
ip address 12.0.0.2 255.0.0.0
no shutdown
exit
router eigrp 101
network 11.0.0.0
network 12.0.0.0
end

R3

enable
configure terminal
hostname R3
interface Gi0/0
ip address 12.0.0.1 255.0.0.0
no shutdown
interface Gi0/1
ip address 10.2.0.1 255.255.0.0
no shutdown
exit
router eigrp 101
network 12.0.0.0
end

GRE тунел

R1

enable
configure terminal

interface tunnel 0
tunnel mode gre ip
ip address 192.168.0.1 255.255.255.0
tunnel source 11.0.0.1
tunnel destination 12.0.0.1

end

Забележка: при задаване на tunnel source може да се използва и комбинацията tunnel source интерфейс, например tunnel source gi 0/0.

R3

enable
configure terminal

interface tunnel 0
tunnel mode gre ip
ip address 192.168.0.2 255.255.255.0
tunnel source 12.0.0.1
tunnel destination 11.0.0.1

end

Пример за маршрутизиране на трафика през тунела

Статични пътища

R1

enable
configure terminal

ip route 10.2.0.0 255.255.0.0 192.168.0.2
end

R3

enable
configure terminal

ip route 10.1.0.0 255.255.0.0 192.168.0.1

end

Динамично маршрутизиране с OSPF

R1
enable
configure terminal

router ospf 1
network 10.1.0.0 0.0.255.255 area 0
network 192.168.0.0 0.0.0.255 area 0

end
R3
enable
configure terminal

router ospf 1
network 10.2.0.0 0.0.255.255 area 0
network 192.168.0.0 0.0.0.255 area 0

end

Допълнителни източници и примери

Configuration Examples and TechNotes