Cloud Tech by Victor
DevOpsIntermediate

Linux Networking

How ip and ss replaced ifconfig and netstat as the modern tools for interfaces and sockets, what TCP socket states like LISTEN and TIME-WAIT actually mean, and how nftables organizes firewall rules into tables and chains.

Updated 2026-07-243 min read

Overview

Modern Linux networking tooling replaced the older ifconfig/netstat pair with ip and ss from the iproute2 suite, ip address/ip route manage interfaces and routing, while ss inspects sockets directly from kernel data structures with far more TCP state detail than netstat ever exposed. Understanding TCP socket states (LISTEN for a server waiting on a port, ESTABLISHED for an active two-way connection, TIME-WAIT during teardown) is usually the fastest way to diagnose "is this service actually up and bound where I expect." Firewalling has moved the same direction: nftables consolidates what used to be separate iptables/ip6tables/arptables tools into one framework, organizing rules into tables and chains, with a chain only doing anything once it's attached to a kernel hook like input, output, or forward.

Quick Reference

ToolReplacesPurpose
ip address / ip routeifconfig, routeManage interfaces, addresses, routing
ssnetstatInspect sockets and connection states
nft (nftables)iptables, ip6tables, arptablesUnified packet filtering across address families
TCP stateMeaning
LISTENBound to a port, waiting to accept connections
ESTABLISHEDActive, two-way connection to a specific peer
TIME-WAITConnection closed, waiting to ensure delayed packets don't arrive

Syntax

bash
ip address show dev eth0        # show an interface's addresses
ss -tulpn                        # listening TCP/UDP sockets, with process names

Examples

bash
# nftables - a table containing a chain hooked to "input", with
# one rule allowing established/related connections back in.
nft add table inet filter
nft add chain inet filter input { type filter hook input priority 0 \; }
nft add rule inet filter input ct state established,related accept

A missing LISTEN socket is the fastest first diagnostic

If a service isn't reachable, check ss -tulpn for its expected port before anything else. No LISTEN entry means the process isn't running, crashed, or bound to a different address/port than expected, no firewall or routing investigation is relevant until that's confirmed.

Visual Diagram

Common Mistakes

  • Reaching for netstat out of habit when ss is the actively maintained tool with materially more socket detail available.
  • Assuming a connectivity problem is a firewall issue before checking whether the service even has a LISTEN socket on the expected port.
  • Writing an nftables chain without attaching it to a hook, then being confused when its rules never seem to apply to any traffic.
  • Duplicating similar rules across separate ip/ip6 address families out of old iptables/ip6tables habit, when a single inet family table in nftables covers both.

Performance

  • ss reads kernel socket tables directly and is considerably faster on systems with a large number of open connections than parsing /proc the way netstat traditionally did.
  • nftables' rule evaluation is generally more efficient than equivalent iptables rulesets at scale, since related rules can be organized into sets and maps the kernel can match more efficiently than a long linear rule chain.

Best Practices

  • Default to ip and ss over ifconfig/netstat; they're the actively maintained tools and expose meaningfully more detail.
  • Check socket state (ss -tulpn) before firewall rules when diagnosing "can't connect," it's the faster and more direct signal.
  • Organize nftables rulesets by address family (inet for both IPv4 and IPv6) instead of duplicating rules the old per-protocol way.
  • Always verify a new chain is attached to the correct hook and priority; a chain with no hook silently does nothing.

Interview questions

What is the difference between ss and the older netstat command, and why would you reach for ss first?

Both report socket/connection information, but ss reads directly from kernel data structures and can display considerably more TCP and socket state detail than netstat, including fine-grained state groupings like every "connected" state (everything except listening and closed) or every "synchronized" state, which makes targeted filtering much easier. netstat has been effectively superseded across current Linux distributions, and ss is the tool actively maintained as part of the iproute2 suite alongside ip, which is why it is the modern default for socket inspection rather than a mere alternative.

A socket shows up in the LISTEN state versus ESTABLISHED. What is actually different about what that socket is doing?

LISTEN means a server-side socket is bound to a port and passively waiting to accept incoming connection requests, it isn't attached to any specific remote peer yet. ESTABLISHED means a full connection has completed its handshake and is actively associated with a specific remote address and port, data can flow in both directions. Seeing a service you expect to be running not show a LISTEN socket on its expected port is usually the very first, most direct signal that the service isn't actually up or isn't bound where you think it is.

How does nftables organize firewall rules, and what actually changed compared to iptables?

nftables organizes rules into tables (containers with no inherent semantics of their own) which hold chains, and chains hold the actual rules; a chain becomes active by being attached to a kernel hook such as input, output, forward, prerouting, or postrouting, which is the point in packet processing where its rules actually get evaluated. The structural change from iptables is consolidation: instead of separate tools for IPv4, IPv6, ARP, and bridge filtering (iptables, ip6tables, arptables, ebtables), nftables provides one framework and one command, `nft`, spanning multiple address families (`ip`, `ip6`, `inet`, `arp`, `bridge`), so a ruleset no longer has to be duplicated per protocol family the way it historically did.

References

ShareXLinkedInReddit
Was this page helpful?
Suggest an improvement