NVMe over Fabrics (NVMe-oF) Setup Guide: High-Speed Block Storage on Linux

Deploy a production-ready NVMe/TCP target and initiator on Ubuntu 24.04 LTS and RHEL 9 with jumbo frames, Host NQN security, reboot persistence, and fio benchmarks.

iSCSI was built to carry SCSI commands, and that legacy design leaks into every I/O operation. The initiator pushes requests through a SCSI command model, the target translates them into NVMe operations for the drive, and both servers burn CPU cycles on the conversion. Modern Gen4 and Gen5 NVMe SSDs can push hundreds of thousands of IOPS locally. On fast hardware, the storage protocol—not the flash—becomes the bottleneck.

NVMe over Fabrics (NVMe-oF) removes that translation layer. It sends native NVMe commands and queues directly over the network, presenting a remote namespace as a standard /dev/nvmeXnY block device on the client. Using the NVMe/TCP transport, you can run this over ordinary Ethernet with zero specialized RDMA hardware or lossless-fabric switch tuning.

This guide walks through a production-ready NVMe/TCP deployment between two Linux servers on Ubuntu 24.04 LTS: jumbo-frame network tuning, a configfs target, initiator connection, Host NQN whitelisting, firewall rules, reboot persistence, and fio benchmarking. The initiator steps also apply to RHEL 9, AlmaLinux 9, and Rocky Linux 9.

NVMe-oF Architecture and Transport Types

An NVMe-oF deployment splits storage and compute into two distinct roles:

  • The Target (Storage Server): Owns the physical NVMe drive and exports it as a namespace inside a subsystem. By default, it listens on TCP port 4420.

  • The Initiator (Compute / Client Server): Connects to that subsystem over the network and mounts the namespace like a local block device.

Each subsystem uses a unique NQN (NVMe Qualified Name), and each client identifies itself with a Host NQN.

Transport Hardware Required Latency CPU Overhead Best Use Case
NVMe/TCP Standard Ethernet NICs (10/25/100GbE) Low Moderate (kernel TCP/IP stack) General block storage, databases, and Kubernetes on standard networks
NVMe/RDMA (RoCEv2) RDMA-capable NICs + RoCEv2 switch fabric Lowest Lowest (bypasses TCP/IP path) Latency-critical databases, HPC, and AI training clusters
iSCSI Standard Ethernet NICs Higher Higher at small block sizes Legacy SANs, older kernels, broad ecosystem compatibility

Why Choose NVMe/TCP Over iSCSI?

NVMe/TCP runs on standard Ethernet without requiring Priority Flow Control or RDMA network cards. The real performance jump comes from queueing. Traditional iSCSI relies on a single-queue architecture that struggles to keep up with modern flash, whereas NVMe was designed from the ground up for deep parallelism.

In Red Hat's June 2026 OpenShift Virtualization benchmark (tested on a Dell PowerStore all-flash array over 25Gb/s ports), NVMe/TCP delivered roughly 27% to 30% higher small-block write performance than iSCSI, and scaled significantly faster during multi-VM cloning (up to 113% faster at 20 VMs per node).

Still, real-world workloads have nuance. In that same Red Hat study, iSCSI actually delivered better PostgreSQL throughput in small, consolidated 1- to 2-VM setups, while NVMe/TCP pulled ahead by roughly 20% under heavy scale-out contention. Treat NVMe/TCP as the stronger default for parallel, high-queue-depth workloads, but always verify against your own I/O pattern.

Prerequisites and Lab Environment

Before starting, make sure both servers meet these requirements:

  • Operating System: Two Linux servers running kernel 5.15 or newer for mature nvme-tcp support. Ubuntu 24.04 LTS meets this out of the box.

  • Privileges: Root or sudo access on both machines.

  • Storage: An unformatted NVMe drive on the Target (never export your OS drive). Testing in a lab without a spare drive? Create a 10GB loopback device instead and export the resulting /dev/loopN device in place of /dev/nvme0n1:

bash
sudo truncate -s 10G /srv/nvme-test.img
sudo losetup -f --show /srv/nvme-test.img
  • Network: A dedicated private network (10GbE, 25GbE, or 100GbE) on a switch that supports MTU 9000.

  • Example Addresses Used Here: Target 10.10.10.1, Initiator 10.10.10.2, private interface ens2f1. Swap these for your actual values.

RHEL 9 / AlmaLinux 9 Support Note: According to Red Hat's official RHEL 9 storage documentation, RHEL 9 fully supports NVMe/TCP in host (Initiator) mode, but does not support the in-kernel nvmet Target. Build your Target on Ubuntu 24.04; RHEL-family systems work fine as Initiators.

For production deployments, storage performance depends heavily on your underlying network. BytesRack Bare Metal Dedicated Servers pair Gen4 NVMe drives with dedicated 10G/25G Private VLANs, giving you the low-latency path needed for block storage traffic.

Step 1: Tune the Network for Jumbo Frames (MTU 9000)

Configure MTU 9000 on the private interface of both servers, as well as on every switch port and VLAN between them. If a single hop stays at the default 1500 bytes, packets will fragment or drop silently, killing your throughput.

On Ubuntu 24.04 (Netplan): Create /etc/netplan/60-storage.yaml on the Target:

yaml
network:
  version: 2
  ethernets:
    ens2f1:
      addresses: [10.10.10.1/24]
      mtu: 9000

Use 10.10.10.2/24 on the Initiator, then lock permissions and apply on both servers:

bash
sudo chmod 600 /etc/netplan/60-storage.yaml
sudo netplan apply
ip link show ens2f1 | grep mtu

On RHEL 9 / AlmaLinux 9 (Initiator):

bash
sudo nmcli connection modify ens2f1 802-3-ethernet.mtu 9000
sudo nmcli connection up ens2f1

Verify end-to-end MTU from the Initiator. We send an 8972-byte payload (8972 + 20-byte IP header + 8-byte ICMP header = 9000 bytes) with -M do to forbid fragmentation:

bash
ping -M do -s 8972 -c 4 10.10.10.1

Clean replies confirm the entire path supports jumbo frames. A Message too long error means a NIC or switch port is still set to 1500. Moving a 1 MiB read at MTU 9000 takes roughly 117 TCP segments instead of 724 at MTU 1500—cutting CPU interrupts and header overhead significantly.

Step 2: Configure the NVMe-oF Target (Storage Server)

The Linux kernel manages NVMe targets through configfs. Open a root shell on the Target (sudo -i) so directory changes and redirects work cleanly.

1. Load Kernel Modules

bash
modprobe nvmet
modprobe nvmet-tcp
printf 'nvmet\nnvmet-tcp\n' > /etc/modules-load.d/nvmet.conf

This loads the modules now and ensures they reload at boot.

2. Create the Subsystem and Attach the Drive

An NQN follows the format nqn.<year>-<month>.<reversed-domain>:<name>. Verify your target drive first with lsblk -o NAME,SIZE,MODEL,MOUNTPOINTS so you don't wipe an active disk.

bash
export NQN=nqn.2026-11.com.example:nvme-pool01
mkdir /sys/kernel/config/nvmet/subsystems/$NQN
cd /sys/kernel/config/nvmet/subsystems/$NQN

# Temporarily allow any host for initial testing (locked down in Step 4)
echo 1 > attr_allow_any_host

# Attach the NVMe drive as namespace 1
mkdir namespaces/1
echo -n /dev/nvme0n1 > namespaces/1/device_path
echo 1 > namespaces/1/enable

3. Bind the Network Port

bash
mkdir /sys/kernel/config/nvmet/ports/1
cd /sys/kernel/config/nvmet/ports/1
echo 10.10.10.1 > addr_traddr
echo tcp > addr_trtype
echo 4420 > addr_trsvcid
echo ipv4 > addr_adrfam

ln -s /sys/kernel/config/nvmet/subsystems/$NQN /sys/kernel/config/nvmet/ports/1/subsystems/$NQN

4. Verify the Listener

Check the kernel log and listening sockets:

bash
dmesg | tail -n 3
ss -tlnp | grep 4420

You should see nvmet_tcp: enabling port 1 (10.10.10.1:4420) in dmesg, and an output like this from ss (the process column stays blank because the kernel owns the socket):

plaintext
LISTEN 0      128      10.10.10.1:4420      0.0.0.0:*

Step 3: Configure the NVMe-oF Initiator (Client Server)

Switch to the Initiator server to install nvme-cli, connect to the Target, and verify the remote drive.

1. Install nvme-cli and Load nvme-tcp

Ubuntu / Debian:

bash
sudo apt update && sudo apt install -y nvme-cli
sudo modprobe nvme-tcp
echo nvme-tcp | sudo tee /etc/modules-load.d/nvme-tcp.conf

RHEL 9 / AlmaLinux 9 / Rocky Linux 9:

bash
sudo dnf install -y nvme-cli
sudo modprobe nvme-tcp
echo nvme-tcp | sudo tee /etc/modules-load.d/nvme-tcp.conf

2. Discover and Connect to the Target

Query the Target for available subsystems:

bash
sudo nvme discover -t tcp -a 10.10.10.1 -s 4420

Look for subnqn: nqn.2026-11.com.example:nvme-pool01 in the output, then connect:

bash
sudo nvme connect -t tcp -n nqn.2026-11.com.example:nvme-pool01 -a 10.10.10.1 -s 4420

3. Format and Mount the Remote Drive

Confirm the drive appears as a local NVMe block device:

bash
sudo nvme list

Example output (the model reads Linux because the kernel target presents itself generically):

plaintext
Node             Generic       SN                   Model   Namespace  Usage                 Format        FW Rev
---------------- ------------- -------------------- ------- ---------- --------------------- ------------- --------
/dev/nvme1n1     /dev/ng1n1    8c1f2d4a6b7e9f013a5c Linux   0x1        3.84 TB / 3.84 TB     512 B + 0 B   6.8.0-49

Format and mount the device (swap /dev/nvme1n1 for your actual node, or use mkfs.ext4 if preferred):

bash
sudo mkfs.xfs /dev/nvme1n1
sudo mkdir -p /mnt/nvmeof
sudo mount /dev/nvme1n1 /mnt/nvmeof
df -h /mnt/nvmeof

Step 4: Lock Down Production Security

Never leave attr_allow_any_host set to 1 in production—any server that can reach port 4420 could mount and overwrite your storage. Lock down access using two layers: Host NQN whitelisting and strict firewall rules.

1. Whitelist the Initiator's Host NQN

First, grab the Initiator's unique Host NQN (run on the Initiator):

bash
cat /etc/nvme/hostnqn
# If the file is missing, generate one:
# nvme gen-hostnqn | sudo tee /etc/nvme/hostnqn

Next, register that exact Host NQN on the Target (as root) and disable open access:

bash
export NQN=nqn.2026-11.com.example:nvme-pool01
export HOSTNQN=nqn.2014-08.org.nvmexpress:uuid:<paste-initiator-hostnqn-here>

mkdir /sys/kernel/config/nvmet/hosts/$HOSTNQN
echo 0 > /sys/kernel/config/nvmet/subsystems/$NQN/attr_allow_any_host
ln -s /sys/kernel/config/nvmet/hosts/$HOSTNQN /sys/kernel/config/nvmet/subsystems/$NQN/allowed_hosts/$HOSTNQN

Note: A Host NQN acts as access control, not cryptographic authentication. If your environment requires strict in-band authentication, NVMe/TCP also supports DH-HMAC-CHAP.

2. Restrict TCP Port 4420 in the Firewall

Allow port 4420 exclusively from the Initiator's private IP (10.10.10.2). On Ubuntu (ufw) on the Target, always allow SSH first so you don't lock yourself out:

bash
sudo ufw allow OpenSSH
sudo ufw allow from 10.10.10.2 to 10.10.10.1 port 4420 proto tcp
sudo ufw enable
sudo ufw status numbered

Step 5: Make NVMe-oF Persistent Across Reboots

Because configfs lives in memory, everything configured in Steps 2 and 4 vanishes when the Target reboots.

1. Save Target Configuration (Ubuntu 24.04)

Install nvmetcli and save your active configuration to /etc/nvmet/config.json:

bash
sudo apt install -y nvmetcli
sudo mkdir -p /etc/nvmet
sudo nvmetcli save /etc/nvmet/config.json

Ubuntu's nvmetcli package does not always ship with an enabled systemd unit out of the box. Create /etc/systemd/system/nvmet.service so the Target restores cleanly at boot:

ini
[Unit]
Description=Restore NVMe-oF Target Configuration
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/nvmetcli restore /etc/nvmet/config.json
ExecStop=/usr/sbin/nvmetcli clear
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Reload systemd and enable the service:

bash
sudo systemctl daemon-reload
sudo systemctl enable --now nvmet.service

Remember to re-run sudo nvmetcli save /etc/nvmet/config.json whenever you modify subsystems or allowed hosts.

2. Configure Auto-Connect and Mounting on the Initiator

Register the Target in /etc/nvme/discovery.conf and enable the auto-connect service:

bash
echo "--transport=tcp --traddr=10.10.10.1 --trsvcid=4420" | sudo tee -a /etc/nvme/discovery.conf
sudo nvme connect-all
sudo systemctl enable nvmf-autoconnect.service

Device names like /dev/nvme1n1 can shift after a reboot, so always mount by UUID. Grab the UUID first:

bash
sudo blkid /dev/nvme1n1

Add the entry to /etc/fstab using _netdev (waits for the network before mounting) and nofail (prevents the server from dropping into emergency mode if the Target is offline):

plaintext
UUID=<uuid-from-blkid>  /mnt/nvmeof  xfs  defaults,_netdev,nofail  0  0

Test the entry without rebooting:

bash
sudo umount /mnt/nvmeof
sudo mount -a
df -h /mnt/nvmeof

How to Benchmark Your NVMe-oF Setup

Instead of relying on generic lab numbers that won't match your drives or switch fabric, benchmark your own hardware. Run these fio tests locally on the Target first, then remotely from the Initiator. The delta between the two shows the exact overhead of your network and protocol stack.

Install fio (sudo apt install -y fio or sudo dnf install -y fio) on the Initiator and run:

bash
COMMON="--directory=/mnt/nvmeof --ioengine=libaio --direct=1 --size=4G --runtime=60 --time_based --group_reporting"

# 1. 4K random read/write: measures IOPS and tail latency (databases)
fio --name=randread-4k  $COMMON --rw=randread  --bs=4k --iodepth=32 --numjobs=4 --lat_percentiles=1
fio --name=randwrite-4k $COMMON --rw=randwrite --bs=4k --iodepth=32 --numjobs=4 --lat_percentiles=1

# 2. 1M sequential read/write: measures max throughput (AI datasets, media)
fio --name=seqread-1m   $COMMON --rw=read      --bs=1M --iodepth=16 --numjobs=4
fio --name=seqwrite-1m  $COMMON --rw=write     --bs=1M --iodepth=16 --numjobs=4
  • For 4K tests: Focus on IOPS and the clat p99 / p99.9 latency percentiles rather than the average.

  • For 1M tests: Look at the BW (bandwidth) line, and run sar -n DEV 1 in a second terminal to see if you are saturating the NIC.

When you finish testing, remove the temporary 4GB benchmark files to free up space:

bash
rm -f /mnt/nvmeof/rand* /mnt/nvmeof/seq*

Understanding Network Line-Rate Limits

Sequential NVMe/TCP throughput usually hits your network ceiling long before it maxes out a Gen4 NVMe SSD (assuming MTU 9000 over a single path):

Network Speed Theoretical Line Rate Realistic Max Throughput Practical Reality
10GbE 1.25 GB/s ~1.1 – 1.2 GB/s Bottlenecks a single Gen4 NVMe drive
25GbE 3.125 GB/s ~2.8 – 3.0 GB/s Good fit for moderate workloads; below Gen4 sequential peaks
100GbE 12.5 GB/s ~11 – 12 GB/s Handles multi-drive Gen4/Gen5 arrays; CPU and PCIe lanes become the next limit

Common Troubleshooting and Quick Fixes

  • Connection refused or timeout: Check that port 4420 is open on the Target firewall (sudo ufw status) and that addr_traddr matches the Target's private IP. Test reachability from the Initiator with nc -zv 10.10.10.1 4420.

  • Discovery returns nothing or nvme connect fails: Your Initiator's Host NQN is likely missing from the Target's allow-list. Compare cat /etc/nvme/hostnqn on the Initiator against ls /sys/kernel/config/nvmet/hosts/ on the Target, and check dmesg on the Target for rejected host warnings.

  • Packet drops or sluggish throughput: Almost always an MTU 9000 mismatch between a server NIC and the network switch. Re-run ping -M do -s 8972 10.10.10.1 and check ip -s link show ens2f1 for dropped frames.

  • Server hangs during boot: Verify that /etc/fstab includes both _netdev and nofail, and confirm systemctl status nvmf-autoconnect is active.

  • Target configuration vanished after reboot: Confirm /etc/nvmet/config.json exists and that systemctl status nvmet.service is enabled and active.

Conclusion

You now have an NVMe/TCP target and initiator running over a jumbo-frame private network locked down with Host NQN whitelisting and firewall rules, persistent across reboots, and ready to benchmark with fio. Always compare your local and remote fio baselines before migrating production data, and re-save your Target configuration after any change.

Building a high-throughput database cluster, Kubernetes storage pool, or AI data pipeline? Explore BytesRack Bare Metal Dedicated Servers with Gen4 NVMe storage and dedicated 10G/25G Private Networking to deploy your own low-latency storage fabric.

Frequently Asked Questions

Discover BytesRack Dedicated Server Locations

BytesRack servers are available around the world, providing diverse options for hosting high-performance AI workloads. Each region offers unique advantages, making it easier to choose a location that best suits your specific latency needs.