Skip to content

Commit 2ce4b08

Browse files
authored
Small edits / optimizations of the DMVPN example (#18)
1 parent 5c3c8c5 commit 2ce4b08

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

DMVPN/Readme.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ In this lab topology a situation is simulated where an IPsec interconnect to a 4
33

44
![DMVPN topology](dmvpn.png)
55

6+
### Overlay network
7+
8+
The diagram below display the resulting overlay network. Each hub is connected to each spoke with its own NHRP instance and subnet.
9+
10+
![overlay topology](dmvpn_overlay.png)
11+
612
Some notes:
713
- The IoT provider / underlay network is configured with static routes.
814
- The uplink to the IoT provider is an IPsec tunnel.

DMVPN/dmvpn_overlay.png

14.6 KB
Loading

DMVPN/hub.j2

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
!
12
router ospf 1
23
router-id 10.0.0.{{ id }}
34
!
@@ -8,8 +9,7 @@ interface GigabitEthernet0/1
89
ip ospf network point-to-point
910
ip ospf 1 area 0.0.0.0
1011
!
11-
{% for intf in hostvars[inventory_hostname].interfaces %}
12-
{% if intf.type is defined and intf.type == "tunnel" %}
12+
{% for intf in interfaces if intf.type is defined and intf.type == "tunnel" %}
1313
interface {{ intf.ifname }}
1414
description DMVPN Tunnel
1515
ip address {{ intf.ipv4|ipaddr('address') }} {{ intf.ipv4|ipaddr('netmask') }}
@@ -26,16 +26,14 @@ interface {{ intf.ifname }}
2626
tunnel source GigabitEthernet0/1
2727
tunnel mode gre multipoint
2828
tunnel path-mtu-discovery
29-
{% endif %}
3029
{% endfor%}
3130
!
32-
{% for intf in hostvars[inventory_hostname].interfaces %}
33-
{% if intf.type is defined and intf.type == "lan" %}
34-
{% for n in intf.neighbors %}
35-
{% if n.node == "firewall" %}
31+
{% for intf in interfaces if intf.type is defined and intf.type == "lan" %}
32+
{% for n in intf.neighbors %}
33+
{% if n.node == "firewall" %}
3634
ip route 0.0.0.0 0.0.0.0 {{ n.ipv4|ipaddr('address') }} name default_to_firewall
37-
{% endif %}
38-
{% endfor%}
39-
{% endif %}
35+
{% endif %}
36+
{% endfor%}
4037
{% endfor%}
4138
!
39+
an

DMVPN/iot.j2

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crypto ipsec profile protect-IoT
1212
set security-association lifetime seconds 86400
1313
set transform-set TS
1414
!
15-
{%- for intf in hostvars[inventory_hostname].interfaces -%}
15+
{%- for intf in interfaces -%}
1616
{% if intf.type is defined and intf.type == "tunnel" %}
1717

1818
interface {{ intf.ifname }}
@@ -33,7 +33,7 @@ interface {{ intf.ifname }}
3333
tunnel path-mtu-discovery
3434
tunnel protection ipsec profile protect-IoT
3535
!
36-
{% for tunint in hostvars[inventory_hostname].interfaces if tunint.type is defined and tunint.type == "tunnel" %}
36+
{% for tunint in interfaces if tunint.type is defined and tunint.type == "tunnel" %}
3737
{% for n in tunint.neighbors %}
3838
{% for intf in hostvars['iotprovider'].interfaces %}
3939
{% if intf.type is defined and intf.type == "lan" %}

DMVPN/spoke.j2

+7-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ router ospf 1
55
interface loopback0
66
ip ospf 1 area 0.0.0.0
77
!
8-
{% for intf in hostvars[inventory_hostname].interfaces if intf.type is defined and intf.type == "tunnel" %}
8+
{% for intf in interfaces if intf.type is defined and intf.type == "tunnel" %}
99
interface {{ intf.ifname }}
1010
description DMVPN Tunnel
1111
ip address {{ intf.ipv4|ipaddr('address') }} {{ intf.ipv4|ipaddr('netmask') }}
@@ -48,19 +48,17 @@ interface {{ intf.ifname }}
4848
{% endfor %}
4949
!
5050
!
51-
{% for intf in hostvars['iotprovider'].interfaces %}
52-
{% if intf.type is defined and intf.type == "lan" %}
53-
{% set iotip = intf %}
54-
{% for intff in hostvars['firewall'].interfaces %}
55-
{% if intff.type is defined and intff.type == "lan" %}
51+
{% for intf in hostvars['iotprovider'].interfaces if intf.type is defined and intf.type == "lan" %}
52+
{% set iotip = intf %}
53+
{% for intff in hostvars['firewall'].interfaces %}
54+
{% if intff.type is defined and intff.type == "lan" %}
5655
ip route {{ intff.ipv4|ipaddr('network') }} {{ intff.ipv4|ipaddr('netmask') }} {{ iotip.ipv4|ipaddr('address') }} name Prevent_recursive_routing
5756
!
5857
ip access-list standard NO_INTER_SPOKE_TRAFFIC
5958
permit host {{ iotip.ipv4|ipaddr('address')}}
6059
deny {{ iotip.ipv4|ipaddr('network') }} {{ iotip.ipv4|ipaddr('wildcard') }}
61-
{% endif %}
62-
{% endfor %}
63-
{% endif %}
60+
{% endif %}
61+
{% endfor %}
6462
{% endfor%}
6563
permit any
6664
!

0 commit comments

Comments
 (0)