How to connect to a target - linux-nvme/nvme-cli GitHub Wiki

Connect (IPv4)

TCP (IPv4)

Example

Connect to target via eth0 to remote target 192.168.1.10 on port 4420.

$ nvme connect -t tcp -a 192.168.1.10 -s 4420 --host-iface=eth0 -n nqn.io-1 --hostnqn nqn.2014-08.com.example:nvme.1

Connect (IPv6)

RDMA (IPv6)

nvme connect arguments that may need IPv6 considerations. A scoped address suffixes the IP address with "%".

[ --traddr=, -a ] --- transport address. Use scoped address for RDMA over IPv6, e.g. fe80::020c:caff:fe12:2a0c%enp129s0f0np0
[ --host-iface=, -f ] --- host interface (for tcp transport only. Do not use for RDMA over IPv6)
[ --host-traddr=, -w ] --- host traddr (e.g. FC WWN's). Do not use for RDMA over IPv6

Example

$ nvme connect -t rdma -s 4420 -a fe80::020c:caff:fe12:2a0c%enp129s0f0np0 -i 2 -n nqn.2014-08.com.example:nvme.1

TCP (IPv6)

Scoped addresses (i.e. addr%iface) as defined in RFC4007 are only specified for IPv6. It is not supported for IPv4. That is why the option -f was added for TCP transport. This allows specifying an interface for IPv4. The -f option can also be used for IPv6, or a scoped IPv6 address can be used instead of the -f option.

The -w option is used to specify a different source address of a TCP socket. It is not used to specify the interface. Interfaces can have more than one IP address assigned to them. There is a primary IP address, which is used by default when making a connection. There may also be secondary addresses assigned to an interface, and if a user wants to use one of those secondary addresses as the source address of the connection, then they must tell the kernel with the -w option.

⚠️ **GitHub.com Fallback** ⚠️