ss: "ipv4" is invalid family
- tool
- ss / netstat
- exit code
- 255
- versions
- iproute2 5.x, iproute2 6.x
- os
- linux
ss: "ipv4" is invalid family means the value given to -f / --family is not a family name ss accepts. ss uses its own names: inet (IPv4), inet6 (IPv6), link (packet sockets), unix, netlink, vsock, tipc and xdp. Use -f inet or the shortcut -4 for IPv4, and select TCP or UDP with -t or -u, not with -f. After the message ss prints its usage text and exits with status 255.
Family names and shortcuts
| Wanted | ss -f value | Short option |
|---|---|---|
| IPv4 | inet | -4 (--ipv4) |
| IPv6 | inet6 | -6 (--ipv6) |
| Packet (raw link-layer) sockets | link | -0 |
| Unix domain sockets | unix | -x |
| Netlink sockets | netlink | (none) |
| VM sockets | vsock | --vsock |
| TIPC | tipc | --tipc |
| XDP sockets | xdp | --xdp |
ss -f help prints the help text, whose FAMILY := line lists the names your version accepts. The names are matched exactly, so INET is rejected too. Confusingly, --ipv4 and --ipv6 do exist as long options (the same as -4 and -6); only -f ipv4 is wrong.
Protocols are separate options
ss -4 -tln # IPv4 TCP listening sockets
ss -f inet6 -uan # all IPv6 UDP sockets
ss -tn -f inet state established
ss -xl # listening Unix sockets-t, -u, -w (raw), -S (SCTP), -M (MPTCP) and -x pick the socket tables; -f, -4 and -6 restrict the address family. Combine them as needed.