Skip to content

NVMe over TCP: exposing NVMe targets over a standard network

Configure an NVMe-over-TCP target and initiator on Linux using nvmet and nvme-cli, with the performance tradeoffs vs iSCSI and the kernel version notes that matter.

NVMe over TCP (NVMe/TCP) extends the NVMe protocol — the language that local NVMe SSDs already speak — across a standard TCP/IP network. It’s the no-RDMA-required version of NVMe over Fabrics, and on Linux 5.0+ it works with just nvmet (target) and nvme-cli (initiator) over Ethernet you already own. Compared to iSCSI, the protocol is leaner, the kernel path is shorter, and the per-IO latency is meaningfully lower. This article walks the target setup, the initiator-side discovery and connect, and the kernel-version and tuning notes that decide whether NVMe/TCP actually beats iSCSI in your environment.

How to verify

# Kernel modules
modinfo nvmet | head -5
modinfo nvme-tcp | head -5
lsmod | grep nvme

# Target side
sudo nvmetcli ls
sudo cat /sys/kernel/config/nvmet/subsystems/*/namespaces/*/device_path

# Initiator side
sudo nvme list
sudo nvme list-subsys
ss -tn | grep 4420

What’s happening

NVMe over Fabrics is the protocol family that takes the NVMe command set — the same one your local NVMe SSD speaks via PCIe — and ships it across a network. NVMe/RDMA uses RoCE or InfiniBand and gets the lowest latency; NVMe/TCP uses standard TCP and gets close to it without the RDMA infrastructure investment. The protocol exposes a “subsystem” (analogous to an iSCSI target) that contains one or more “namespaces” (analogous to LUNs), each backed by a block device, a partition, or an LVM volume on the target.

On Linux, nvmet is the target kernel module — it presents local block devices as NVMe namespaces over TCP, RDMA, or FC. The userspace nvmetcli tool (or the configfs interface directly) configures the target. On the initiator side, nvme-cli discovers and connects to subsystems, and the nvme-tcp module presents them as local NVMe devices (/dev/nvme1n1, etc.) that the OS treats exactly like a PCIe NVMe.

The latency story is real. iSCSI carries SCSI commands wrapped in TCP, with the SCSI midlayer’s queue depth limits and the round-trip overhead of SCSI’s chatty protocol. NVMe/TCP carries native NVMe commands with the NVMe driver’s much higher queue depth (64K command queue per namespace), and the wire protocol has less overhead per command. In our testing on a 10GbE LAN with NVMe-backed targets, NVMe/TCP shows 30-50% lower per-request latency than iSCSI on the same hardware.

The kernel version note matters. NVMe/TCP support landed in Linux 5.0 and has had bug fixes through 6.x; for production, Ubuntu 24.04 (kernel 6.8+) is the comfortable floor. Older distros either lack the modules or have known issues with reconnect behavior under network blips.

The procedure

  1. On the target host, enable the kernel modules and tooling:

    sudo apt update
    sudo apt install -y nvmetcli nvme-cli
    sudo modprobe nvmet
    sudo modprobe nvmet-tcp
    echo nvmet | sudo tee /etc/modules-load.d/nvmet.conf
    echo nvmet-tcp | sudo tee -a /etc/modules-load.d/nvmet.conf
  2. Configure a target subsystem and namespace via nvmetcli. First, ensure you have a backing block device (/dev/nvme1n1, an LVM LV, or a partition):

    sudo nvmetcli
    # In the interactive shell:
    cd /subsystems
    create nqn.2024-06.com.example:storage01
    cd nqn.2024-06.com.example:storage01
    set attr allow_any_host=1
    cd namespaces
    create 1
    cd 1
    set device path=/dev/nvme1n1
    set enable 1
    exit
  3. Add a TCP port to expose the subsystem:

    sudo nvmetcli
    cd /ports
    create 1
    cd 1
    set addr trtype=tcp adrfam=ipv4 traddr=10.0.0.11 trsvcid=4420
    cd subsystems
    create nqn.2024-06.com.example:storage01
    exit
  4. Persist the configuration:

    sudo nvmetcli save /etc/nvmet.json
    sudo systemctl enable --now nvmet
  5. Open the firewall for port 4420:

    sudo ufw allow from 10.0.0.0/24 to any port 4420 proto tcp
  6. On the initiator host:

    sudo apt install -y nvme-cli
    sudo modprobe nvme-tcp
    sudo nvme discover -t tcp -a 10.0.0.11 -s 4420
    sudo nvme connect -t tcp -n nqn.2024-06.com.example:storage01 -a 10.0.0.11 -s 4420
    sudo nvme list
    # Should show /dev/nvme1n1 or similar — the new remote NVMe namespace
  7. Persist the connection across reboots via /etc/nvme/discovery.conf:

    -t tcp -a 10.0.0.11 -s 4420

    Then enable nvmf-autoconnect.service:

    sudo systemctl enable --now nvmf-autoconnect.service
  8. Format and mount as if it were local:

    sudo mkfs.xfs /dev/nvme1n1
    sudo mkdir -p /mnt/remote-nvme
    sudo mount /dev/nvme1n1 /mnt/remote-nvme

Common pitfalls

  • Forgetting to enable the namespace (set enable 1) leaves the subsystem visible but the namespace empty, and the initiator sees an empty device.
  • allow_any_host=1 is fine for trusted networks; for any environment with untrusted clients, configure host NQN allowlists (/sys/kernel/config/nvmet/hosts/) and bind subsystems to specific NQNs.
  • TCP/4420 firewall rules must allow both directions of traffic for the discovery and command flow; partial allowlists cause silent reconnect loops.
  • Mismatched MTU between target and initiator triggers IO stalls on large writes — the symptom is nvme list showing connected but writes hanging. Match MTU across the path.
  • Reconnect during network blips: by default the initiator retries, but a long outage gives up. Tune via --ctrl-loss-tmo on connect (or via nvme-cli config) for the timing your environment needs.

In the engagements we run, NVMe/TCP shows up when we’re replacing iSCSI in a high-IOPS environment — typically the storage target sits on a JBOF with several NVMe drives, and we expose them to compute nodes over 10GbE or 25GbE. We standardize on Ubuntu 24.04, monitor connection state and per-namespace IO latency in Prometheus via the node_exporter block stats, and treat the NVMe/TCP path as one tier of the clustered storage solution — not a replacement for replicated storage, but a faster way to expose block devices than iSCSI.