Разлика между версии на „Конфигуриране на GRE тунел с устройства на Cisco“
от БАРЗИКТ Wiki
(Нова страница: Category:Cisco ==Примерна топология== Файл:GRE_Topology.png ==Първоначална конфигурация== ===R1=== <pre style="wh...) |
(→R3) |
||
(4 intermediate revisions by the same user not shown) | |||
Ред 44: | Ред 44: | ||
hostname R3 | hostname R3 | ||
interface Gi0/0 | interface Gi0/0 | ||
− | ip address 12.0.0. | + | ip address 12.0.0.1 255.0.0.0 |
no shutdown | no shutdown | ||
interface Gi0/1 | interface Gi0/1 | ||
Ред 54: | Ред 54: | ||
end | end | ||
</pre> | </pre> | ||
+ | |||
+ | ==GRE тунел== | ||
+ | ===R1=== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | 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 | ||
+ | </pre> | ||
+ | |||
+ | Забележка: при задаване на '''tunnel source''' може да се използва и комбинацията '''tunnel source ''' ''интерфейс'', например '''tunnel source gi 0/0'''. | ||
+ | ===R3=== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | 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 | ||
+ | </pre> | ||
+ | ==Пример за маршрутизиране на трафика през тунела== | ||
+ | ===Статични пътища=== | ||
+ | ====R1==== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | enable | ||
+ | configure terminal | ||
+ | |||
+ | ip route 10.2.0.0 255.255.0.0 192.168.0.2 | ||
+ | end | ||
+ | </pre> | ||
+ | ====R3==== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | enable | ||
+ | configure terminal | ||
+ | |||
+ | ip route 10.1.0.0 255.255.0.0 192.168.0.1 | ||
+ | |||
+ | end | ||
+ | </pre> | ||
+ | ===Динамично маршрутизиране с OSPF=== | ||
+ | =====R1===== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | 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 | ||
+ | </pre> | ||
+ | =====R3===== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | 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 | ||
+ | </pre> | ||
+ | ==Допълнителни източници и примери== | ||
+ | [http://www.cisco.com/c/en/us/tech/ip/ip-tunneling/tech-configuration-examples-list.html Configuration Examples and TechNotes] |
Текуща версия към 11:50, 28 март 2015
Съдържание
Примерна топология
Първоначална конфигурация
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