Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pd 1037 virtual machine instructions for networking incomplete #2515

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 62 additions & 55 deletions content/SCALE/SCALETutorials/Virtualization/AccessingNASFromVM.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,87 +7,94 @@ tags:
- vm
---

If you want to access your TrueNAS SCALE directories from a VM, you have multiple options. If your system has more than one physical interface, you can assign your VMs to a NIC other than the primary one your TrueNAS server uses. This method makes communication more flexible, but does not offer the potential speed of a bridge.
If you want to access your TrueNAS SCALE directories from a VM, you have multiple options:

If you have only one physical interface, you must create a bridge interface for the VM to use.
* If you have only one physical interface, you must create a bridge interface for the VM to use.
* If your system has more than one physical interface, you can assign your VMs to a NIC other than the primary one your TrueNAS server uses.
This method makes communication more flexible, but does not offer the potential speed of a bridge.

## Creating a Bridge: Single Physical Interface
Prepare your system for interface changes by stopping and/or removing apps, VM NIC devices, and services that can cause conflicts:

{{< hint type=important >}}
If the only interface you have is a single physical interface, complete the following steps in order to create a network bridge:
* If you have apps running, disable them before proceeding.
* Clear the DHCP checkbox on the single physical interface you have, but don't apply the changes.
* Create a bridge interface and add your physical interface as a member. Configure relevant networking options such as DHCP.
* Then apply the changes and connect to the UI with the new networking settings.
* These steps are outlined below.
{{< /hint >}}
* Power off any running VMs before making interface IP changes. Remove active NIC devices.
* If you encounter issues with testing network changes, you might need to stop any services using the current IP address, including Kubernetes and sharing services, such as SMB.
<!-- Fuller procedure to be added below in a separate PR (PD-1018): click **Devices** and remove the attached NIC before proceeding. After creating the bridge, [recreate NIC device(s)]({{< relref "AddManageVMDevicesSCALE.md" >}}) to attach the bridge. -->

## Creating a Bridge: One Active Interface
## Creating a Bridge: Single Physical Interface

Go to **Virtualization**, find the VM you want to use to access TrueNAS storage, and toggle it off.
If your system only has a single physical interface, complete these steps in order to create a network bridge.

![VirtualMachinesScreenwithVM](/images/SCALE/Virtualization/VirtualMachinesScreenwithVM.png "Virtual Machine Screen")
1. Go to **Virtualization**, find the VM you want to use to access TrueNAS storage, and toggle it off.

### Edit Interface
{{< trueimage src="/images/SCALE/Virtualization/VirtualMachinesScreenwithVM.png" alt="Virtual Machine Screen" id="Virtual Machine Screen" >}}

{{< expand "Using the TrueNAS CLI to obtain IP address" "v" >}}
2. Go to **Network > Interfaces** and find the active interface you used as the VM parent interface.
Note the interface IP Address and subnet mask.
Click the interface to open the **Edit Interface** screen.

You can also get the IP address and subnet mask in the TrueNAS SCALE CLI by entering `network interface query` (More details available from the [SCALE CLI network article]{{< relref "/SCALE/SCALECLIReference/Network/_index.md" >}}).
{{< trueimage src="/images/SCALE/Network/NetworkInterfacesSCALE.png" alt="Network Interfaces" id="Network Interfaces" >}}

```
network interface query
+--------+----------+------------------+------------------+-----------+-----------+-------------+--------+
| name | type | state.aliases | aliases | ipv4_dhcp | ipv6_auto | description | mtu |
+--------+----------+------------------+------------------+-----------+-----------+-------------+--------+
| eno1 | PHYSICAL | 10.220.20.160/20 | 10.220.20.160/20 | false | false | | <null> |
| eno2 | PHYSICAL | <empty list> | <empty list> | false | false | | <null> |
| ens9f0 | PHYSICAL | <empty list> | <empty list> | false | false | | <null> |
| ens9f1 | PHYSICAL | <empty list> | <empty list> | false | false | | <null> |
| ens9f2 | PHYSICAL | <empty list> | <empty list> | false | false | | <null> |
| ens9f3 | PHYSICAL | <empty list> | <empty list> | false | false | | <null> |
+--------+----------+------------------+------------------+-----------+-----------+-------------+--------+
```
{{< /expand >}}
3. If enabled, clear the **DHCP** checkbox.
Note the IP address and mask under **Aliases**.
Click the **X** next to the listed alias to remove the IP address and mask.
The **Aliases** field now reads **No items have been added yet**.
Click **Save**.

{{< trueimage src="/images/SCALE/Network/EditInterfaceNicDeviceSCALE.png" alt="Edit Network Interface" id="Edit Network Interface" >}}

4. The **Interfaces** widget displays the edited interface with no IP information.

{{< trueimage src="/images/SCALE/Network/NetworkInterfacesNoIPSCALE.png" alt="Network Interface Widget" id="Network Interface Widget" >}}

5. Add Bridge Interface.

{{< include file="/_includes/NetworkBridgeSCALE.md" >}}

6. Test and confirm changes.
To determine if network changes are suitable, click **Test Changes**.

Go to **Network > Interfaces** and find the active interface you used as the VM parent interface. Note the interface IP Address and subnet mask.
Click the interface.
{{< trueimage src="/images/SCALE/Virtualization/VMTestNetworkChanges.png" alt="Test Network Changes" id="Test Network Changes" >}}

![NetworkInterfacesSCALE](/images/SCALE/Network/NetworkInterfacesSCALE.png "Network Interfaces SCALE")
Once TrueNAS finishes testing the interface, click **Save Changes** if you want to keep the changes.
Click **Revert Changes** to discard the changes and return to the previous configuration.

The **Edit Interface** screen appears. If selected, clear the **DHCP** checkbox. Note the IP address and mask under **Aliases**. Click the **X** next to the listed alias to remove the IP address and mask. The **Aliases** field now reads **No items have been added yet**. Click **Save**.
<!-- Troubleshooting network testing here -->

![EditInterfaceNicDeviceSCALE](/images/SCALE/Network/EditInterfaceNicDeviceSCALE.png "Edit Network Interface SCALE")
{{< trueimage src="/images/SCALE/Virtualization/VMSaveNetworkChanges.png" alt="Save Network Changes" id="Save Network Changes" >}}

The **Interfaces** widget displays the edited interface with no IP information.
The new bridge interface displays with associated IP information.

![NetworkInterfacesNoIPSCALE](/images/SCALE/Network/NetworkInterfacesNoIPSCALE.png "Network Interface Widget")
{{< trueimage src="/images/SCALE/Network/NetworkInterfacesBridgeSCALE.png" alt="Network Interfaces with Bridge" id="Network Interfaces with Bridge" >}}

### Add Bridge Interface
7. Edit VM Device Configuration

{{< include file="/_includes/NetworkBridgeSCALE.md" >}}
Go to **Virtualization**, expand the VM you want to use to access TrueNAS storage, and click **Devices**.
Click <i class="material-icons" aria-hidden="true" title="System Update">more_vert</i> in the **NIC** row and select **Edit**.
Select the new bridge interface from the **NIC to Attach** dropdown list, then click **Save**.

To determine if network changes are suitable, click **Test Changes**.
{{< trueimage src="/images/SCALE/Virtualization/VMEditDeviceNIC.png" alt="Edit NIC Device" id="Edit NIC Device" >}}

![VMTestNetworkChanges](/images/SCALE/Virtualization/VMTestNetworkChanges.png "Test Network Changes")
You can now access your TrueNAS storage from the VM.
You might have to set up [shares]({{< relref "/SCALE/SCALEUIReference/Shares/_index.md" >}}) or [users]({{< relref "ManageLocalUsersSCALE.md" >}}) with home directories to access certain files.

![VMTestNetworkChangesConfirm](/images/SCALE/Virtualization/VMTestNetworkChangesConfirm.png "Confirm Network Changes")
## Assigning a Secondary NIC: Multiple Physical Interfaces

Once TrueNAS finishes testing the interface, click **Save Changes** if you want to keep the changes. Click **Revert Changes** to discard the changes and return to the previous configuration.
If you have more than one NIC present on your system, you can assign VM traffic to a secondary NIC.
Configure the secondary interface as described in [Managing Interfaces]({{< relref "managinginterfaces.md" >}}) before attaching it to a VM.

![VMSaveNetworkChanges](/images/SCALE/Virtualization/VMSaveNetworkChanges.png "Save Network Changes")
If you are creating a new VM, use the **Attach NIC** dropdown menu under **Network Interface** to select the secondary NIC.

The new bridge interface displays with associated IP information.
To edit the NIC attached to an existing VM:

![NetworkInterfacesBridgeSCALE](/images/SCALE/Network/NetworkInterfacesBridgeSCALE.png "Network Interfaces with Bridge")
1. Go to **Virtualization**, expand the VM you want to use to access TrueNAS storage, and click **Devices**.

### Edit VM Device Configuration
{{< trueimage src="/images/SCALE/Virtualization/VMDevicesListed.png" alt="Virtual Machine Devices" id="Virtual Machine Devices" >}}

Go to **Virtualization**, expand the VM you want to use to access TrueNAS storage, and click **Devices**. Click <i class="material-icons" aria-hidden="true" title="System Update">more_vert</i> in the **NIC** row and select **Edit**.
Select the new bridge interface from the **Nic to Attach** dropdown list, then click **Save**.
2. Click <i class="material-icons" aria-hidden="true" title="System Update">more_vert</i> in the **NIC** row and select **Edit**.

![VMEditDeviceNIC](/images/SCALE/Virtualization/VMEditDeviceNIC.png "VM Edit NIC Device")
{{< trueimage src="/images/SCALE/Virtualization/VMEditDeviceSecondaryNIC.png" alt="Attach Secondary NIC Device" id="Attach Secondary NIC Device" >}}

You can now access your TrueNAS storage from the VM. You might have to set up [shares]({{< relref "/SCALE/SCALEUIReference/Shares/_index.md" >}}) or [users]({{< relref "ManageLocalUsersSCALE.md" >}}) with home directories to access certain files.
3. Select the secondary interface from the **NIC to Attach** dropdown list, then click **Save**.

## VM Access Examples

Expand All @@ -96,17 +103,17 @@ Linux VMs can access TrueNAS storage using FTP, SMB, and NFS.

In the example below, the Linux VM is using FTP to access a home directory for a user on TrueNAS.

![AccessNASfromVM6](/images/SCALE/AccessNASfromVM6.png "Connecting to FTP Path")
{{< trueimage src="/images/SCALE/AccessNASfromVM6.png" alt="Connecting to FTP Path" id="Connecting to FTP Path" >}}

![AccessNASfromVM7](/images/SCALE/AccessNASfromVM7.png "FTP Home Directory")
{{< trueimage src="/images/SCALE/AccessNASfromVM7.png" alt="FTP Home Directory" id="FTP Home Directory" >}}
{{< /expand >}}

{{< expand "Windows Example" "v" >}}
Windows VMs can access TrueNAS storage using FTP and SMB.

In the example below, the Windows VM accessing an SMB share on TrueNAS.

![AccessNASfromVM8](/images/SCALE/AccessNASfromVM8.png "Enter SMB Share Path")
{{< trueimage src="/images/SCALE/AccessNASfromVM8.png" alt="Enter SMB Share Path" id="Enter SMB Share Path" >}}

![AccessNASfromVM9](/images/SCALE/AccessNASfromVM9.png "SMB Share")
{{< trueimage src="/images/SCALE/AccessNASfromVM9.png" alt="SMB Share" id="SMB Share" >}}
{{< /expand >}}
Loading
Loading