Breaking deeper into network layers: analyzing packet traffic with tcpdump, building resilience with network bonding, separating segments via VLANs, to isolated network experiments with network namespaces and a glimpse of nftables.

After episode 20 where we covered Network File Sharing (NFS & Samba) & DNS Basics — building inter-server shares and understanding name resolution — you can now make machines work together. But there's one question still unanswered: how do you know what's really happening on the network? When an application is slow, NFS frequently times out, or an SSH session looks "suspicious", the diagnostic tools from episode 17 (ping, curl, ss) only give external indications. To see the actual packet contents, you need packet analysis.
This is a different episode from the previous ones. Here we don't just use ready-made tools — we start thinking like a network: reading packet headers, understanding how ethernet frames carry VLAN tags, and how Linux separates network worlds from each other via namespaces. These are the skills that distinguish a regular admin from one who can answer "why is this slow?" with evidence, not feelings.
In this episode 21, we'll cover four pillars: tcpdump for dissecting packet traffic, network bonding for resilience and throughput, VLAN for separating virtual networks, and network namespaces as the basis for isolated network experiments — capped with a glimpse of nftables which we already met in episode 19. This is also the final episode of this series' networking block.
tcpdump is the classic tool for packet capture on Linux. It works at the packet level — far deeper than ss or ping. Think of ss as looking at the guest list at the entrance, while tcpdump is like recording the entire conversation word for word.
sudo tcpdump -i eth0sudo tcpdump -i eth0 -nsudo tcpdump -i eth0 -c 10The -n option isn't just cosmetic: without -n, tcpdump does reverse-DNS for every address — slow, and can raise questions on a production network. Always use -n.
Filtering with expressions. This is tcpdump's true power — BPF (Berkeley Packet Filter):
sudo tcpdump -i eth0 -n host 192.168.1.10sudo tcpdump -i eth0 -n tcp port 443sudo tcpdump -i eth0 -n udp port 53sudo tcpdump -i eth0 -n icmp| BPF expression | Function |
|---|---|
host 1.2.3.4 | Traffic to or from an IP |
src 1.2.3.4 / dst 1.2.3.4 | Traffic with a specific source/destination |
port 443 | Traffic on a specific port |
tcp / udp / icmp | Protocol filters |
and / or / not | Combine conditions |
tcp port 443 and host 1.2.3.4 | Complex combinations |
Warning
The number one tcpdump trap: forgetting sudo. Reading raw packets requires a raw socket — without root, tcpdump refuses with you don't have permission. The second trap: capturing on the wrong interface. If the server uses ens3 but you're capturing on eth0, the result is empty — check first with ip -brief addr (episode 17). Use -i any to capture on all interfaces at once.
Capturing in the terminal is good, but deep analysis — following the TCP handshake flow, inspecting payloads — is far more comfortable in Wireshark. Save your captures to a .pcap file:
sudo tcpdump -i eth0 -n -w capture.pcapsudo tcpdump -r capture.pcapsudo tcpdump -r capture.pcap -n tcp port 443Open capture.pcap in Wireshark to visually see the three-way TCP handshake flow (SYN, SYN-ACK, ACK) — a highly sought-after debugging skill in DevOps teams, aligned with the observability topics in other series.
Network bonding combines several physical interfaces into one logical interface bond0. Its two goals: redundancy (one cable breaks, the connection stays alive) and throughput (traffic load spread across several cables).
The bonding modes you should know:
| Mode | Name | Behavior |
|---|---|---|
active-backup (1) | Failover | One active, others standby; the most common for servers |
balance-rr (0) | Round-robin | Packets spread alternately; high throughput, needs switch support |
802.3ad (4) | LACP | Link aggregation; needs LACP switch configuration |
balance-alb (6) | Adaptive load balancing | Load balancing without special switch support |
Tip
For a regular server, active-backup is the safest choice: you get redundancy without touching the switch. For throughput cases, 802.3ad (LACP) is the industry standard — but remember, this mode only works if the switch is also configured as LACP. Choosing a bonding mode without switch support = a connection problem that's hard to trace.
Netplan is the declarative way to manage networking on Ubuntu (briefly covered in episode 17). Config files live in /etc/netplan/:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
eth1:
dhcp4: no
bonds:
bond0:
interfaces: [eth0, eth1]
parameters:
mode: active-backup
primary: eth0
addresses: [192.168.1.10/24]
routes:
- to: default
via: 192.168.1.1sudo netplan applycat /proc/net/bonding/bond0On the RHEL family, the default network manager is NetworkManager, and its command-line tool is nmcli:
sudo nmcli connection add type bond con-name bond0 ifname bond0 mode active-backupsudo nmcli connection add type bond-slave ifname eth0 master bond0
sudo nmcli connection add type bond-slave ifname eth1 master bond0sudo nmcli connection modify bond0 ipv4.addresses 192.168.1.10/24
sudo nmcli connection modify bond0 ipv4.gateway 192.168.1.1sudo nmcli connection up bond0nmcli device statusImportant
Before setting the bond as the primary interface, make sure there's an alternative access path. Changing the main network config remotely (SSH) without a backup is a recipe for locking yourself out — the same lesson from episodes 18 and 19. Keep another active SSH session, or configure via console/out-of-band management.
VLAN (Virtual LAN) lets a single physical cable carry many isolated logical networks. Each VLAN is marked with a 12-bit tag (ID 1–4094) inside the ethernet frame. This is the common way to separate management traffic, service traffic, and guest traffic in a datacenter.
sudo ip link add link eth0 name eth0.100 type vlan id 100sudo ip addr add 192.168.100.10/24 dev eth0.100
sudo ip link set eth0.100 upip -d link show eth0.100With netplan, VLANs are declared permanently:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
vlans:
vlan100:
id: 100
link: eth0
addresses: [192.168.100.10/24]sudo netplan applyWarning
The most common VLAN trap: creating a VLAN interface on the server side without the same configuration on the switch — tagged traffic enters a port not configured as a trunk, so the packets are silently discarded. A VLAN is always two-sided. Use tcpdump -i eth0 vlan to confirm the VLAN tag really appears on the wire before blaming the server.
Network namespaces are one of the technologies that make containers work — each container has its own network stack: interfaces, routing table, ARP table, and firewall rules fully separated. Understanding this is the bridge to Docker/Kubernetes in the later episodes of this series.
ip netns listsudo ip netns add red
sudo ip netns add bluesudo ip netns exec red ip addrThe two namespaces are fully isolated — they can't talk to each other until we create a veth pair (virtual ethernet) connecting them:
sudo ip link add veth-red type veth peer name veth-bluesudo ip link set veth-red netns red
sudo ip link set veth-blue netns bluesudo ip netns exec red ip addr add 10.0.0.1/24 dev veth-red
sudo ip netns exec red ip link set veth-red up
sudo ip netns exec blue ip addr add 10.0.0.2/24 dev veth-blue
sudo ip netns exec blue ip link set veth-blue upsudo ip netns exec red ping -c 2 10.0.0.2PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.083 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.083 msTwo virtual "worlds" can now talk. This is the core of container network architecture: every pod/container gets its own namespace, connected to each other and to the host via veth. You've seen the foundation before entering the container world in the coming episodes.
In episode 19 we touched nftables as iptables' successor. In this deep-networking episode, let's complete the picture. nftables unifies all tables (filter, nat, mangle) in a single syntax and a single ruleset:
sudo nft list rulesettable inet filter {
chain input {
type filter hook input priority 0; policy drop;
tcp dport 22 accept
ct state established,related accept
}
chain forward {
type filter hook forward priority 0; policy drop;
}
chain output {
type filter hook output priority 0; policy accept;
}
}The rules above apply default-deny for input and forward, only accepting SSH and already-established connections. nftables' advantages: a clear hierarchy, better performance, and one tool (nft) for everything — unlike iptables which is split per table. Modern UFW and many new distros already use it as their backend.
1. tcpdump without sudo. Without a raw socket, the command refuses to run. And don't capture on the wrong interface — check ip -brief addr first.
2. Bonding mode without switch support. Choosing 802.3ad without LACP on the switch = traffic jam. Start with active-backup if in doubt.
3. Forgetting to load the bonding module. On some kernels, the bonding module must be loaded first (remember /etc/modules-load.d/ from episode 16). The symptom: bond0 doesn't appear in ip link.
4. One-sided VLAN. A VLAN tag on the server without trunk config on the switch = silently lost packets. Always debug with tcpdump -i eth0 vlan.
5. Namespaces accidentally left behind. Namespaces aren't deleted at reboot, and can pile up on production systems. Clean them with ip netns del <name> after the experiment is done.
6. Changing the primary network config remotely without a backup. Netplan apply / nmcli up on the interface used by SSH = dropped session. Keep an alternative path first — the same lesson from episodes 18 and 19.
In this episode 21, we've broken deeper into Linux's network layers: dissecting packets with tcpdump and saving them to .pcap for Wireshark analysis, building network resilience with network bonding (from active-backup to 802.3ad), separating segments with VLAN, experimenting with network namespaces and veth pairs — the real foundation of container network architecture — and completing the filtering picture with a glimpse of nftables.
Key points to take home:
tcpdump is your third eye: without sudo, without the right interface, without clear filters, it won't help.active-backup bonding gives redundancy without touching the switch; other modes need infrastructure preparation.tcpdump vlan is the best witness.With episode 21 complete, the networking block of the Belajar Linux series is finished: from the foundations in episode 17, secure access via SSH in episode 18, firewall defense in episode 19, file sharing in episode 20, to packet analysis in episode 21. In the next episode 22 we'll enter a new world that uses all this foundation — the topic Container & Virtualization, where you'll apply the network namespaces, cgroups, and image layering you already know conceptually, now in tangible form with Docker and Podman. See you there!