Skip to content

Commit

Permalink
Merge pull request #49 from damfle/ipv6
Browse files Browse the repository at this point in the history
Basic routes and IPv6 support
  • Loading branch information
markgoddard authored Oct 21, 2021
2 parents 9aa5874 + 25e580c commit e9e4131
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ should be a dict containing the following items:
name (optional).
- `dhcp_start` First IP of the DHCP range in `route` or `nat` mode (optional).
- `dhcp_end` Last IP of the DHCP range in `route` or `nat` mode (optional).
- `routes` Optional list of additionals routes defined as following:
- `address` Address of the route, required.
- `prefix` Prefix of the route, required.
- `gateway` Gateway of the route, required.
- `metric` Metric of the route (optional).
- `ipv6` IPv6 address of the virtual bridge (optional).
- `ipv6_prefix` IPv6 prefix of the virtual bridge (optional).
- `routesv6` Optional list of additionals IPv6 routes defined as following:
- `address` IPv6 address of the route, required.
- `prefix` IPv6 previx of the route, required.
- `gateway` gateway of the route, required.
- `metric` metric of the route (optional).

`libvirt_host_require_vt` is whether to require that Intel Virtualisation
Technology (VT) is enabled in order to run this role. While this provides
Expand Down
18 changes: 16 additions & 2 deletions templates/network.xml.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<network connections='1'>
<network {% if item.ipv6 is defined %}ipv6='yes'{% endif %} connections='1'>
<name>{{ item.name }}</name>
<forward mode='{{ item.mode }}'/>
<bridge name='{{ item.bridge }}'/>
{% if item.mode == 'route' or item.mode == 'nat' %}
{% if item.mode == 'route' or item.mode == 'nat' %}
<domain name='{{ item.domain|default(item.name) }}'/>
<ip address='{{ item.ip }}' netmask='{{ item.netmask }}'>
{% if item.dhcp_start is defined and item.dhcp_end is defined %}
Expand All @@ -11,5 +11,19 @@
</dhcp>
{% endif %}
</ip>
{% if item.routes is defined %}
{% for route in item.routes %}
<route address="{{ route.address }}" prefix="{{ route.prefix }}" gateway="{{ route.gateway }}" {% if route.metric is defined %} metric='{{ route.metric }}' {% endif %}/>
{% endfor %}
{% endif %}
{% if item.ipv6 is defined and item.ipv6_prefix is defined %}
<ip family='ipv6' address='{{ item.ipv6 }}' prefix='{{ item.ipv6_prefix }}'>
</ip>
{% endif %}
{% if item.routesv6 is defined %}
{% for route in item.routesv6 %}
<route family="ipv6" address="{{ route.address }}" prefix="{{ route.prefix }}" gateway="{{ route.gateway }}" {% if route.metric is defined %} metric='{{ route.metric }}' {% endif %}/>
{% endfor %}
{% endif %}
{% endif %}
</network>

0 comments on commit e9e4131

Please sign in to comment.