Skip to content

Commit e6e5e58

Browse files
aburdenthehandaburden
authored andcommitted
Adding a new module that covers how to configure a VM to use masq mode with ipv6
1 parent e4291c5 commit e6e5e58

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/vm_networking/virt-using-the-default-pod-network-with-virt.adoc
4+
5+
[id="virt-configuring-masquerade-mode-dual-stack_{context}"]
6+
= Configuring masquerade mode with dual-stack (IPv4 and IPv6)
7+
8+
You can configure a new virtual machine to use both IPv6 and IPv4 on the default pod network by using cloud-init.
9+
10+
The IPv6 network address must be statically set to `fd10:0:2::2/120` with a default gateway of `fd10:0:2::1` in the virtual machine configuration. These are used by the virt-launcher pod to route IPv6 traffic to the virtual machine and are not used externally.
11+
12+
When the virtual machine is running, incoming and outgoing traffic for the virtual machine is routed to both the IPv4 address and the unique IPv6 address of the virt-launcher pod. The virt-launcher pod then routes the IPv4 traffic to the DHCP address of the virtual machine, and the IPv6 traffic to the statically set IPv6 address of the virtual machine.
13+
14+
.Prerequisites
15+
16+
* The {product-title} cluster must use the OVN-Kubernetes Container Network Interface (CNI) network provider configured for dual-stack.
17+
18+
.Procedure
19+
20+
. In a new virtual machine configuration, include an interface with `masquerade` and configure the IPv6 address and default gateway by using cloud-init.
21+
+
22+
[source,yaml]
23+
----
24+
apiVersion: kubevirt.io/v1alpha3
25+
kind: VirtualMachine
26+
metadata:
27+
name: example-vm-ipv6
28+
...
29+
interfaces:
30+
- name: red
31+
masquerade: {} <1>
32+
ports:
33+
- port: 80 <2>
34+
networks:
35+
- name: red
36+
pod: {}
37+
volumes:
38+
- cloudInitNoCloud:
39+
networkData: |
40+
version: 2
41+
ethernets:
42+
eth0:
43+
dhcp4: true
44+
addresses: [ fd10:0:2::2/120 ] <3>
45+
gateway6: fd10:0:2::1 <4>
46+
----
47+
<1> Connect using masquerade mode.
48+
<2> Allows incoming traffic on port 80 to the virtual machine.
49+
<3> You must use the IPv6 address `fd10:0:2::2/120`.
50+
<4> You must use the gateway `fd10:0:2::1`.
51+
52+
. Create the virtual machine in the namespace:
53+
+
54+
[source,terminal]
55+
----
56+
$ oc create -f example-vm-ipv6.yaml
57+
----
58+
59+
.Verification
60+
61+
* To verify that IPv6 has been configured, start the virtual machine and view the interface status of the virtual machine instance to ensure it has an IPv6 address:
62+
63+
[source,terminal]
64+
----
65+
$ oc get vmi <vmi-name> -o jsonpath="{.status.interfaces[*].ipAddresses}"
66+
----

virt/virtual_machines/vm_networking/virt-using-the-default-pod-network-with-virt.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ xref:../../../virt/virtual_machines/vm_networking/virt-attaching-vm-multiple-net
1313

1414
include::modules/virt-configuring-masquerade-mode-cli.adoc[leveloffset=+1]
1515

16+
include::modules/virt-configuring-masquerade-mode-dual-stack.adoc[leveloffset=+1]
17+
1618
[id="virt-selecting-binding-method"]
1719
== Selecting binding method
1820

0 commit comments

Comments
 (0)