Skip to main content

Connect a network volume to a dedicated server with VMware ESXi hypervisor

Learn more about network drives in the Network Drives Product Overview instructions.

  1. Create a SAN.
  2. Connect the network drive to the server.
  3. Connect the network drive to the server in the server OS.
  4. Mount the VMFS file system.

1. Create a SAN network

  1. In the control panel, in the top menu, click Products and select Dedicated Servers.

  2. Go to the Network section → SAN network tab.

  3. Click Add SAN network.

  4. Select an availability zone.

  5. Enter a subnet address from the private IP range (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) or leave the default generated subnet. The subnet size must be /20.
    Make sure that the subnet is not used in your infrastructure.

  6. Click Create SAN network.

2. Connect the network volume to the server

  1. In the control panel, in the top menu, click Products and select Dedicated servers.

  2. Go to Network drives and storage systems → the Network drives tab.

  3. Open the drive page → the Connect to server tab.

  4. In the Server field, click Select.

  5. Select the server to which the network volume will be connected.

  6. Click Confirm.

  7. If you are connecting a network volume to a server with a private network, configure the network:

    7.1. Select a VLAN.

    7.2. Enter the subnet CIDR from the private address range 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16.
    Make sure that the subnet does not overlap with the SAN network that you created in step 1 and that it is not used in your infrastructure.

    7.3. Enter the Next hop 1 and Next hop 2 addresses from the selected private subnet.

    7.4. Click Configure.

3. Connect the network volume to the server in the server OS

You can connect a network drive to a server manually or using a ready-made script generated in the control panel. The script can only be used on Ubuntu OS — learn more in the Connect a network drive to a dedicated server running Linux OS instructions.

  1. Connect to the server via SSH or via the KVM console.

  2. Display the list of network interfaces:

    esxcli network nic list

    The response will contain a list of network interfaces. For example:

    Name PCI Device Driver Admin Status Link Status Speed Duplex MAC Address MTU Description
    -------- ------------ -------- ------------ ----------- ----- ------ ----------------- ---- -----------
    vmnic0 0000:01:00.0 nmlx4_en Up Up 10000 Full 1x:11:xx:0x:00:x0 1500 Mellanox Technologies ConnectX-3 Pro EN NIC; 10GigE; dual-port SFP+ (MCX312B-XCC)
    vmnic1 0000:02:00.0 igbn Up Up 1000 Full aa:1a:0a:11:1a:a0 1500 Intel Corporation I350 Gigabit Network Connection
    vmnic128 0000:01:00.0 nmlx4_en Up Up 10000 Full 1c:00:cc:0c:00:c0 1500 Mellanox Technologies ConnectX-3 Pro EN NIC; 10GigE; dual-port SFP+ (MCX312B-XCC)
    vmnic2 0000:02:00.1 igbn Up Up 1000 Full cc:1c:6c:01:6c:c1 1500 Intel Corporation I350 Gigabit Network Connection

    Here, the Name field contains the names of network interfaces.

  3. Display information about the network interface configuration:

    esxcli network vswitch standard list

    The response will contain the current configuration of network interfaces. For example:

    vSwitch0
    Name: vSwitch0
    Class: cswitch
    Num Ports: 2560
    Used Ports: 4
    Configured Ports: 128
    MTU: 1500
    CDP Status: listen
    Beacon Enabled: false
    Beacon Interval: 1
    Beacon Threshold: 3
    Beacon Required By:
    Uplinks: vmnic1
    Portgroups: VM Network, Management Network
  4. Create two virtual switches for the SAN network:

    esxcli network vswitch standard add --vswitch-name=<switch_name_1>
    esxcli network vswitch standard add --vswitch-name=<switch_name_2>

    Specify:

    • <switch_name_1> — name of the first virtual switch;
    • <switch_name_2> — name of the second virtual switch.
  5. Assign network interfaces to the virtual switches:

    esxcli network vswitch standard uplink add --vswitch-name=<switch_name_1> --uplink-name=<eth_name_1>
    esxcli network vswitch standard uplink add --vswitch-name=<switch_name_2> --uplink-name=<eth_name_2>

    Specify:

    • <switch_name_1> — name of the first virtual switch that you created in step 4;
    • <eth_name_1> — name of the first network interface on the first NIC port that you obtained in step 2;
    • <switch_name_2> — name of the second virtual switch that you created in step 4;
    • <eth_name_2> — name of the second network interface on the second NIC port that you obtained in step 2.
  6. Ensure that the network interfaces are configured correctly:

    esxcli network vswitch standard list

    The response will show the configuration of the network interfaces that you configured in steps 4 and 5.

  7. Create port groups on the virtual switches:

    esxcli network vswitch standard portgroup add --portgroup-name=<portgroup_name_1> --vswitch-name=<switch_name_1>
    esxcli network vswitch standard portgroup add --portgroup-name=<portgroup_name_2> --vswitch-name=<switch_name_2>

    Specify:

    • <portgroup_name_1> — name of the first port group;
    • <switch_name_1> — name of the first virtual switch that you created in step 4;
    • <portgroup_name_2> — name of the second port group;
    • <switch_name_2> — name of the second virtual switch that you created in step 4.
  8. Ensure that the port groups are correctly created on the virtual switches:

    esxcli network vswitch standard portgroup list

    The response will contain a list of the port groups that you created in step 7.

  9. Create virtual interfaces:

    esxcli network ip interface add --interface-name=<vmkernel_name_1> --portgroup-name=<portgroup_name_1>
    esxcli network ip interface add --interface-name=<vmkernel_name_2> --portgroup-name=<portgroup_name_2>

    Specify:

    • <vmkernel_name_1> — name of the first virtual interface;
    • <portgroup_name_1> — name of the first port group that you created in step 7;
    • <vmkernel_name_2> — name of the second virtual interface;
    • <portgroup_name_2> — name of the second port group that you created in step 7.
  10. Add IP addresses to the virtual interfaces:

    esxcli network ip interface ipv4 set --interface-name=<vmkernel_name_1> --ipv4 <ip_address_1> --netmask <mask_1> --type static
    esxcli network ip interface ipv4 set --interface-name=<vmkernel_name_2> --ipv4 <ip_address_2> --netmask <mask_2> --type static

    Specify:

    • <vmkernel_name_1> — name of the first virtual network interface that you created in step 9;
    • <ip_address_1> — IP address of the first NIC port. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Network interface configuration block → Port IP address column;
    • <mask_1> – destination subnet interface mask for the first NIC port in IPv4 mask format. For example: 255.255.252.0 for /22, 255.255.255.0 for /24, 255.255.255.252 for /30. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Static routes for connecting to iSCSI targets block → Destination subnet column;
    • <vmkernel_name_2> — name of the second virtual network interface that you created in step 9;
    • <ip_address_2> — IP address of the second NIC port. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Network interface configuration block → Port IP address column;
    • <mask_2> – destination subnet interface mask for the second NIC port in IPv4 mask format. For example: 255.255.252.0 for /22, 255.255.255.0 for /24, 255.255.255.252 for /30. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Static routes for connecting to iSCSI targets block → Destination subnet.
  11. Ensure that the virtual network interfaces are created and configured correctly:

    esxcfg-vmknic -l

    The response will show the configuration of the virtual network interfaces that you configured in steps 9 and 10.

  12. Ensure that the destination network gateway is reachable:

    vmkping -I <vmkernel_name_1> <next_hop_1>
    vmkping -I <vmkernel_name_2> <next_hop_2>

    Specify:

    • <vmkernel_name_1> — name of the first virtual network interface that you created in step 9;
    • <next_hop_1> — gateway for the first NIC port. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Network interface configuration block → Next hop (gateway) column;
    • <vmkernel_name_2> — name of the second virtual network interface that you created in step 9;
    • <next_hop_2> — gateway for the second NIC port. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Network interface configuration block → Next hop (gateway) column.
  13. Add static routes to access the iSCSI targets:

    esxcli network ip route ipv4 add --network <destination_subnet_1> --gateway <next_hop_1>
    esxcli network ip route ipv4 add --network <destination_subnet_2> --gateway <next_hop_2>

    Specify:

    • <destination_subnet_1> — destination subnet for the first NIC port. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Static routes for connecting to iSCSI targets block → Destination subnet column;
    • <next_hop_1> — gateway for the first NIC port. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Network interface configuration block → Next hop (gateway) column;
    • <destination_subnet_2> — destination subnet for the second NIC port. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Static routes for connecting to iSCSI targets block → Destination subnet column;
    • <next_hop_2> — gateway for the second NIC port. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Network interface configuration block → Next hop (gateway) column.
  14. Ensure that the routes added in step 13 have been applied:

    esxcli network ip route ipv4 list
  15. Ensure that the iSCSI target is reachable:

    vmkping -I <vmkernel_name_1> <iscsi_target_ip_address_1>
    vmkping -I <vmkernel_name_2> <iscsi_target_ip_address_2>

    Specify:

    • <vmkernel_name_1> — name of the first virtual network interface that you created in step 9;
    • <iscsi_target_ip_address_1> — IP address of the first iSCSI target. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → iSCSI target 1 IP address field;
    • <vmkernel_name_2> — name of the second virtual network interface that you created in step 9;
    • <iscsi_target_ip_address_2> — IP address of the second iSCSI target. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → iSCSI target 2 IP address field.
  16. Check the status of the iSCSI initiator:

    esxcli iscsi software get
  17. If the iSCSI initiator status is false, enable it:

    esxcli iscsi software set --enabled true
  18. Display the list of iSCSI adapters:

    esxcli iscsi adapter list

    The response will contain a list of iSCSI adapters. For example:

    Adapter Driver State UID Description
    ------- --------- ------ ------------- -----------
    vmhba64 iscsi_vmk online iscsi.vmhba64 iSCSI Software Adapter

    Here, the Adapter field contains the names of iSCSI adapters.

  19. Set the iSCSI initiator name:

    esxcli iscsi adapter set --adapter=<iscsi_adapter_name> --name=<initiator_name>

    Specify:

    • <iscsi_adapter_name> — name of the iSCSI adapter that you obtained in step 18;
    • <initiator_name> — iSCSI initiator name. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → Initiator name field.
  20. Bind the virtual interfaces to the iSCSI adapter:

    esxcli iscsi networkportal add --nic <vmkernel_name_1> --adapter <iscsi_adapter_name>
    esxcli iscsi networkportal add --nic <vmkernel_name_2> --adapter <iscsi_adapter_name>

    Specify:

    • <vmkernel_name_1> — name of the first virtual network interface that you created in step 9;
    • <vmkernel_name_2> — name of the second virtual network interface that you created in step 9;
    • <iscsi_adapter_name> — name of the iSCSI adapter that you obtained in step 18.
  21. Ensure that the virtual interfaces are bound to the iSCSI adapter:

    esxcli iscsi networkportal list
  22. Configure CHAP authentication for the iSCSI initiator:

    esxcli iscsi adapter auth chap set -A <iscsi_adapter_name> --authname=<username> --secret=<password> --level required

    Specify:

    • <iscsi_adapter_name> — name of the iSCSI adapter that you obtained in step 18;
    • <username> — username for iSCSI initiator authentication. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → Username field;
    • <password> — password for iSCSI initiator authentication. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → Password field.
  23. Ensure that CHAP authentication is configured correctly:

    esxcli iscsi adapter auth chap get -A <iscsi_adapter_name>

    Specify <iscsi_adapter_name> — the name of the iSCSI adapter that you obtained in step 18.

  24. Configure static iSCSI targets for the iSCSI adapter:

    esxcli iscsi adapter discovery statictarget add -A <iscsi_adapter_name> -a <iscsi_target_ip_address_1>:3260 -n <iqn>
    esxcli iscsi adapter discovery statictarget add -A <iscsi_adapter_name> -a <iscsi_target_ip_address_2>:3260 -n <iqn>

    Specify:

    • <iscsi_adapter_name> — name of the iSCSI adapter that you obtained in step 18;
    • <iscsi_target_ip_address_1> — IP address of the first iSCSI target. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → IP-адрес iSCSI-таргета 1 field;
    • <iscsi_target_ip_address_2> — IP address of the second iSCSI target. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → IP-адрес iSCSI-таргета 2 field;
    • <iqn> — IQN of the first and second iSCSI targets. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → Target name field.
  25. Ensure that static iSCSI targets for the iSCSI adapter are configured correctly:

    esxcli iscsi adapter target list
  26. Initiate a rescan for iSCSI targets for the iSCSI adapter:

    esxcli iscsi adapter discovery rediscover -A <iscsi_adapter_name>

    Specify <iscsi_adapter_name> — the name of the iSCSI adapter that you obtained in step 18.

  27. Check the status of the last iSCSI target discovery:

    esxcli iscsi adapter discovery status get -A <iscsi_adapter_name>

    Specify <iscsi_adapter_name> — the name of the iSCSI adapter that you obtained in step 18.

  28. Ensure that all static iSCSI targets are configured correctly:

    esxcli iscsi adapter discovery statictarget list -A <iscsi_adapter_name>

    Specify <iscsi_adapter_name> — the name of the iSCSI adapter that you obtained in step 18.

  29. Initiate an iSCSI session:

    esxcli iscsi session add -A <iscsi_adapter_name> -n <iqn>

    Specify:

    • <iscsi_adapter_name> — name of the iSCSI adapter that you obtained in step 18;
    • <iqn> — IQN of the first and second iSCSI targets. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → Target name field.
  30. Ensure that the iSCSI session is running:

    esxcli iscsi session list
  31. Check connectivity to the iSCSI targets:

    nc -s <ip_address_1> -z <iscsi_target_ip_address_1> 3260
    nc -s <ip_address_2> -z <iscsi_target_ip_address_2> 3260

    Specify:

    • <ip_address_1> — IP address of the first NIC port. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Network interface configuration block → Port IP address column;
    • <iscsi_target_ip_address_1> — IP address of the first iSCSI target. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → IP-адрес iSCSI-таргета 1 field;
    • <ip_address_2> — IP address of the second NIC port. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Network interface configuration block → Port IP address column;
    • <iscsi_target_ip_address_2> — IP address of the second iSCSI target. You can view it in the control panel: in the top menu, click Products → Dedicated Servers → the Network drives and storage section → the Network drives tab → drive page → Configure iSCSI connection block → IP-адрес iSCSI-таргета 2 field.
  32. Update the list of all adapters:

    esxcli storage core adapter rescan --all
  33. Get the network volume identifier:

    esxcli storage core device list

    The response will contain a list of connected storage devices. For example:

    Device: naa.600140558e7a2bfee234358ad22f7c79
    Display Name: naa.600140558e7a2bfee234358ad22f7c79
    Has Settable Display Name: true
    Size: 100.00 GB
    Device Type: Direct-Access
    Multipath Plugin: NMP
    Devfs Path: /vmfs/devices/disks/naa.600140558e7a2bfee234358ad22f7c79
    Vendor: LIO-ORG
    Model: iscsi-disk

    Where:

    • Device — network drive identifier;
    • Model — model or software description of the storage device specified by the target, such as an iSCSI server.
  34. Display the network volume information:

    esxcli storage core device list -d <device_id>

    Specify <device_id> — the network drive identifier that you obtained in step 33.

  35. Configure the network volume access policy:

    esxcli storage nmp device set -d <device_id> -P <path_selection_policy>

    Specify:

    • <device_id> — network drive identifier that you obtained in step 33.

    • <path_selection_policy> — path selection policy, which determines how I/O requests are routed to the storage when multiple paths are available:

      • Round Robin (VMW_PSP_RR) — distributes I/O requests evenly across all available paths;

      • Most Recently Used (VMW_PSP_MRU) — uses the last active path. Upon failure, it switches to another path, and after the initial path is restored, it does not switch back to it. Suitable for active-passive storage configurations;

      • Fixed (VMW_PSP_FIXED) — uses only one specified path, by default the first working one. Upon failure, it switches to an available path, but when the original path is restored, it switches back to it;

      • Fixed with Automatic Path Failover (VMW_PSP_FIXED_AP) — policy similar to Fixed, but switching between paths occurs automatically.

  36. Display the network volume information:

    esxcli storage nmp device list -d <device_id>

    Specify <device_id> — the network drive identifier that you obtained in step 33.

  37. Make sure that Round Robin is configured correctly:

    esxcli storage nmp psp roundrobin deviceconfig get -d <device_id>

    Specify <device_id> — the network drive identifier that you obtained in step 33.

  38. Ensure that the paths the server uses to connect to the network volume are configured correctly:

    esxcli storage core path list -d <device_id>

    Specify <device_id> — the network drive identifier that you obtained in step 33.

4. Mount the VMFS file system

VMFS (VMware File System) is a clustered file system used by VMware ESXi to store virtual machine files. VMFS supports shared storage access by multiple ESXi hosts. This is the only type of file system for network storage.

  1. Create a GPT partition table on the disk:

    partedUtil mklabel /dev/disks/<device_id> gpt

    Specify <device_id> — the network drive identifier that you obtained when connecting the network drive to the server in the server OS in step 33.

  2. Obtain the range of valid sectors for partitioning:

    partedUtil getUsableSectors /dev/disks/<device_id>

    Specify <device_id> — the network drive identifier that you obtained when connecting the network drive to the server in the server OS in step 33.

    The response will contain the start and end sector values available for use. For example:

    2048 314572766

    Where:

    • 2048 — starting sector;
    • 314572766 — ending sector.
  3. Create a partition on the disk:

    partedUtil setptbl /dev/disks/<device_id> gpt "<partition_number> <start_sector> <end_sector> AA31E02A400F11DB9590000C2911D1B8 0"

    Specify:

  4. Format the partition with the VMFS file system:

    vmkfstools -C vmfs6 -S <datastore_name> /dev/disks/<device_id>:<partition_number>

    Specify:

  5. Ensure that the file system is available for mounting:

    esxcli storage filesystem list
  6. Ensure that the datastore you created in step 4 is available for use:

    6.1. Open the vSphere Web Client web interface.

    6.2. Go to Storage → Datastore.

    6.3. Check that a datastore with type VMFS6 and status Accessible appears in the list.