1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 06:46:26 +01:00
Files
openshift-docs/modules/virt-configuring-masquerade-mode-cli.adoc

50 lines
1.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * virt/virtual_machines/vm_networking/virt-using-the-default-pod-network-with-virt.adoc
[id="virt-configuring-masquerade-mode-cli_{context}"]
= Configuring masquerade mode from the command line
You can use masquerade mode to hide a virtual machine's outgoing traffic behind
the Pod IP address. Masquerade mode uses Network Address Translation (NAT) to
connect virtual machines to the Pod network backend through a Linux bridge.
Enable masquerade mode and allow traffic to enter the virtual machine by
editing your virtual machine configuration file.
.Prerequisites
* The virtual machine must be configured to use DHCP to acquire IPv4 addresses.
The examples below are configured to use DHCP.
.Procedure
. Edit the `interfaces` spec of your virtual machine configuration file:
+
[source,yaml]
----
kind: VirtualMachine
spec:
domain:
devices:
interfaces:
- name: red
masquerade: {} <1>
ports:
- port: 80 <2>
networks:
- name: red
pod: {}
----
<1> Connect using masquerade mode
<2> Allow incoming traffic on port 80
. Create the virtual machine:
+
[source,terminal]
----
$ oc create -f <vm-name>.yaml
----