Canonical: https://nitride.xyz/docs/cli

# Command-line checks

We don't ship a command-line tool, and you don't need one. Five standard Linux commands tell you whether shreds reach the machine, which process gets them, and whether any are lost on the way in.

## Which check answers which question?
| Question | Command |
| --- | --- |
| Do packets reach the network interface? | `tcpdump` |
| Is a process listening on the port, on the right address? | `ss` |
| Is the kernel throwing packets away? | `nstat` |
| Is the firewall letting the traffic in? | `ufw` or `nft` |
| How busy is the stream right now? | `tcpdump` with a count, or your receiver's own counter |

Work down the list in that order. Each answer narrows where a problem can be. Examples use port `9000`; substitute yours.

## See packets: tcpdump
tcpdump reads traffic below the socket layer, so it shows datagrams even when no program is listening:

```sh
sudo tcpdump -n -i any -c 20 'udp dst port 9000'
```

`-c 20` stops after twenty packets, and `-n` skips name lookups. Each line shows the sender, your address and the datagram length; shreds are never longer than 1,228 bytes. No lines at all means the traffic is not reaching the interface: look at the address and port registered with us, the cloud firewall and NAT.

To estimate the rate, time a fixed count:

```sh
time sudo tcpdump -n -i any -c 5000 'udp dst port 9000' > /dev/null
```

## Find the socket: ss
ss lists UDP sockets with the owning process:

```sh
sudo ss -ulnp 'sport = :9000'
```

You want exactly one line, with your receiver's process name. Check the local address column: `0.0.0.0:9000` accepts traffic on every IPv4 interface, while a specific private address only works if NAT delivers to that address. No line means nothing is bound; two lines mean two programs are competing for the same packets.

## Count drops: nstat
The kernel keeps UDP counters for the whole host. Take two readings a few seconds apart and compare:

```sh
nstat -az UdpInDatagrams UdpRcvbufErrors UdpInErrors
```

- `UdpInDatagrams` counts datagrams handed to sockets.
- `UdpRcvbufErrors` counts datagrams thrown away because a socket's receive buffer was full.
- `UdpInErrors` counts datagrams discarded for any reason, buffer overflow included.

If `UdpRcvbufErrors` climbs while the stream runs, your receiver is reading too slowly for its buffer. Make the buffer larger and the receive loop leaner, as described under [receive-side requirements](https://nitride.xyz/docs/udp#tuning). For a per-socket view, the `drops` column of `/proc/net/udp` shows the same thing for each socket.

## Open the port: ufw, nftables
While your destination is being verified, the port has to accept UDP from the internet. The verification datagram comes from our server, but support only gives you the numeric source address once delivery is active:

```sh file="ufw"
sudo ufw allow 9000/udp
```

```sh file="nftables"
sudo nft insert rule inet filter input udp dport 9000 accept
```

Once delivery is active, support can give you the address we send from, and you can narrow the rule to it. The narrower rules are:

```sh file="ufw"
sudo ufw allow proto udp from <source-ip> to any port 9000
sudo ufw delete allow 9000/udp
```

```sh file="nftables"
sudo nft insert rule inet filter input ip saddr <source-ip> udp dport 9000 accept
```

The nftables rules assume an `inet filter` table with an `input` chain; `insert` puts each rule at the top, ahead of any final drop rule. Remove the open nftables rule by its handle (`sudo nft -a list chain inet filter input` shows handles). Persist rules the way your distribution expects, and mirror them in any cloud firewall in front of the server.

## When the checks disagree
- **tcpdump sees packets, your program doesn't:** another process owns the port, or your program is bound to the wrong address. Check with ss.
- **Your program sees fewer packets than tcpdump:** the gap is on your host. Check nstat for buffer drops.
- **Nothing anywhere:** the traffic is not reaching the machine. Work through [troubleshooting](https://nitride.xyz/docs/troubleshooting), and the [quickstart](https://nitride.xyz/docs) if you are still setting up.
