Skip to main content
Connect a network drive to a dedicated server with VMware ESXi hypervisor
Last update:

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

Network disks are available for connection to dedicated servers in the MSK-1 pool.You can connect a network disk to dedicated servers of a ready-made configuration with a tag You can also connect network disks to dedicated servers of an arbitrary configuration with an additional 2 × 10 GE NIC + 10 Gbps Network Disk SAN connection.

You can connect the network disk to one or more servers.

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

1. Create a SAN network

  1. In the Control Panel, on the top menu, click Products and select Dedicated Servers.
  2. Go to Network Disks and StorageNetwork Disks tab.
  3. Open the disk page → Server Connection tab.
  4. Click the Create SAN link.
  5. Click Add SAN.
  6. Select an availability zone.
  7. Enter a subnet or leave the subnet that is generated by default. The subnet must belong to the private address range 10.0.0.0.0/8, 172.16.0.0.0/12 or 192.168.0.0.0/16 and must not already be in use in your infrastructure.
  8. Click Create SAN.

2. Connect the network drive to the server

  1. In the Control Panel, on the top menu, click Products and select Dedicated Servers.
  2. Go to Network Disks and StorageNetwork Disks tab.
  3. Open the disk page → Server Connection tab.
  4. In the Server field, click Select.
  5. Select the server to which the network drive will be connected.

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

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

  2. Print the list of network interfaces:

    esxcli network nic list

    A list of network interfaces will appear in the response. 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 in the Name field are the names of the network interfaces.

  3. Output the configuration information of the network interfaces:

    esxcli network vswitch standard list

    The response will show the current configuration of the 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:

    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 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 you created in step 4;
    • <eth_name_1> — the name of the first network interface on the first port of the network card that you got in step 2;
    • <switch_name_2> — name of the second virtual switch that you created in step 4;
    • <eth_name_2> — the name of the second network interface on the second port of the network card that you obtained in step 2.
  6. Make sure that the network interfaces are configured correctly:

    esxcli network vswitch standard list

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

  7. Create portgroups 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 portgroup;
    • <switch_name_1> — name of the first virtual switch you created in step 4;
    • <portgroup_name_2> — name of the second portgroup;
    • <switch_name_2> — name of the second virtual switch that you created in step 4.
  8. Verify that portgroups are correctly created on the virtual switches:

    esxcli network vswitch standard portgroup list

    The response will list the portgroups 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> — the name of the first portgroup you created in step 7;
    • <vmkernel_name_2> — name of the second virtual interface;
    • <portgroup_name_2> — the name of the second portgroup you created in step 7.
  10. On the virtual interfaces, add IP addresses:

    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 you created in step 9;
    • <ip_address_1> — The IP address of the first port on the network card. You can view it in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring network interfaces → column Port IP address;
    • <mask_1> — The destination subnet mask for the first port on the network card. You can view it in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Static routes for connecting to iSCSI targets → column Destination Subnet;
    • <vmkernel_name_2> — name of the second virtual network interface you created in step 9;
    • <ip_address_2> — The IP address of the second port on the network card. You can view it in control panel: from the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring network interfaces → column Port IP address;
    • <mask_2> — The destination subnet mask for the second port on the network card. You can look it up in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Static routes for connecting to iSCSI targets → column Destination Subnet.
  11. Make sure 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. Verify that the destination network gateway is available:

    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 you created in step 9;
    • <next_hop_1> — gateway for the first port on the network card. You can see it in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring network interfaces → column Next hop (gateway);
    • <vmkernel_name_2> — name of the second virtual network interface you created in step 9;
    • <next_hop_2> — gateway for the second port on the network card. You can look it up in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring network interfaces → column Next hop (gateway).
  13. Write static routes to gain access to 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> — the destination subnet for the first port on the network card. You can view it in the control panel: from the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Static routes for connecting to iSCSI targets → column Destination Subnet;
    • <next_hop_1> — gateway for the first port on the network card. You can see it in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring network interfaces → column Next hop (gateway);
    • <destination_subnet_2> — the destination subnet for the second port on the network card. You can look in the control panel: from the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Static routes for connecting to iSCSI targets → column Destination Subnet;
    • <next_hop_2> — gateway for the second port on the network card. You can look it up in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring network interfaces → column Next hop (gateway).
  14. Verify that the routes prescribed in step 13 apply:

    esxcli network ip route ipv4 list
  15. Verify that the iSCSI target is available:

    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 you created in step 9;
    • <iscsi_target_ip_address_1> — IP address of the first iSCSI target. Can be viewed in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field IP address of the iSCSI target 1;
    • <vmkernel_name_2> — name of the second virtual network interface 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 ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field IP address of the iSCSI target 2.
  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. Print the list of iSCSI adapters:

    esxcli iscsi adapter list

    A list of iSCSI adapters will appear in the response. For example:

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

    Here in the Adapter field are the names of the iSCSI adapters.

  19. Set the name of the iSCSI initiator:

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

    Specify:

    • <iscsi_adapter_name> — the name of the iSCSI adapter you got in step 18;
    • <initiator_name> — name of the iSCSI initiator. You can look it up in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field Initiator name.
  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 you created in step 9;
    • <vmkernel_name_2> — name of the second virtual network interface you created in step 9;
    • <iscsi_adapter_name> — the name of the iSCSI adapter you got in step 18.
  21. Ensure that the virtual interfaces are bound to the iSCSI adapter:

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

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

    Specify:

    • <iscsi_adapter_name> — the name of the iSCSI adapter you got in step 18;
    • <username> — username to authorize the iSCSI initiator. You can view it in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field Username;
    • <password> — password for authorization of the iSCSI initiator. You can view it in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field Password.
  23. Make sure that CHAP authentication is configured correctly:

    esxcli iscsi adapter auth chap get -A <iscsi_adapter_name>

    Specify <iscsi_adapter_name>is 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> — the name of the iSCSI adapter you got in step 18;
    • <iscsi_target_ip_address_1> — IP address of the first iSCSI target. Can be viewed in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field IP address of the iSCSI target 1;
    • <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 ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field IP address of the iSCSI target 2;
    • <iqn> — IQNs of the first and second iSCSI target. You can view them in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field Target name.
  25. Verify that the static iSCSI targets for the iSCSI adapter are configured correctly:

    esxcli iscsi adapter target list
  26. Run iSCSI-target re-discovery for the iSCSI adapter:

    esxcli iscsi adapter discovery rediscover -A <iscsi_adapter_name>

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

  27. Check the status of the last iSCSI tag detection:

    esxcli iscsi adapter discovery status get -A <iscsi_adapter_name>

    Specify <iscsi_adapter_name>is 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>is 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> — the name of the iSCSI adapter you got in step 18;
    • <iqn> — IQNs of the first and second iSCSI target. You can view them in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field Target name.
  30. Verify that the iSCSI session is running:

    esxcli iscsi session list
  31. Check the availability of iSCSI tags:

    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> — The IP address of the first port on the network card. You can view it in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring network interfaces → column Port IP address;
    • <iscsi_target_ip_address_1> — IP address of the first iSCSI target. Can be viewed in the control panel: in the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field IP address of the iSCSI target 1;
    • <ip_address_2> — The IP address of the second port on the network card. You can view it in control panel: from the top menu, click ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring network interfaces → column Port IP address;
    • <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 ProductsDedicated Servers → section Network Disks and Storage → tab Network Disks → disk page → block Configuring an iSCSI connection → field IP address of the iSCSI target 2.
  32. Update the list of all adapters:

    esxcli storage core adapter rescan --all
  33. Get the ID of the network disk:

    esxcli storage core device list

    A list of connected storage devices will appear in the response. 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

    Here:

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

    esxcli storage core device list -d <device_id>

    Specify <device_id> is the network drive ID you obtained in step 33.

  35. Configure the network disk access policy:

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

    Specify:

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

    • <path_selection_policy> — path selection policy, defines the way I/O requests to the storage are routed if there are several available paths:

      • 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. Switches to another path on failure, does not return to the original path after it is restored. Suitable for configurations with active-passive storage;

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

      • Fixed with Automatic Path Failover (VMW_PSP_FIXED_AP) — The policy is similar to Fixed, but switching between paths is automatic.

  36. Output the network disk information:

    esxcli storage nmp device list -d <device_id>

    Specify <device_id> is the network drive ID 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> is the network drive ID you obtained in step 33.

  38. Make sure that the paths that the server uses to connect to the network drive are configured correctly:

    esxcli storage core path list -d <device_id>

    Specify <device_id> is the network drive ID you obtained in step 33.

4. Mount the VMFS file system

VMFS (VMware File System) is a clustered file system that VMware ESXi uses to store virtual machine files. VMFS supports storage sharing between multiple ESXi hosts. It is an alternative file system type for NAS.

  1. Create a GPT partitioning on the disk:

    partedUtil mklabel /dev/disks/<device_id> gpt

    Specify <device_id> is the network disk ID that you obtained when you connected the network disk to the server in the server OS in step 33.

  2. Get the range of valid sectors for partitioning:

    partedUtil getUsableSectors /dev/disks/<device_id>

    Specify <device_id> is the network disk ID that you obtained when you connected the network disk to the server in the server OS in step 33.

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

    2048 314572766

    Here:

    • 2048 — initial sector;
    • 314572766 — end 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 to the VMFS file system:

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

    Specify:

  5. Make sure the file system is mountable:

    esxcli storage filesystem list
  6. Make sure 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 StorageDatastore.

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