> ## Documentation Index
> Fetch the complete documentation index at: https://wireblast.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Try it with no spare NIC

> A veth pair and a network namespace give you a sender and a receiver on one machine.

You don't need two servers and a 10G link to try Wireblast. A `veth` pair and a network namespace give you a sender and a receiver on one box. A laptop is fine.

This is the safest possible place to learn the tool. Nothing you do here can touch your real network, and you can turn on `--rx-mode all` without any consequence at all.

<Note>
  `veth` gives you native XDP in copy mode with one queue. Throughput here tells you about your CPU and kernel, not about a NIC, which is exactly right when what you're testing is your own config.
</Note>

## Build the lab

Two commands' worth of setup. `wb0` stays in your normal namespace and does the sending; `wb1` lives in a namespace called `wblab` and does the receiving.

```bash theme={null}
# A namespace to receive in
sudo ip netns add wblab

# A virtual cable: wb0 <-> wb1
sudo ip link add wb0 type veth peer name wb1
sudo ip link set wb1 netns wblab

# Your end
sudo ip addr add 10.99.0.1/24 dev wb0
sudo ip link set wb0 up

# The far end
sudo ip netns exec wblab ip addr add 10.99.0.2/24 dev wb1
sudo ip netns exec wblab ip link set wb1 up
sudo ip netns exec wblab ip link set lo up
```

Check the cable works:

```bash theme={null}
ping -c2 10.99.0.2
```

```text theme={null}
2 packets transmitted, 2 received, 0% packet loss, time 1063ms
rtt min/avg/max/mdev = 0.021/0.025/0.029/0.004 ms
```

## Run a test through it

Two terminals. **Receiver first**, so it's listening before traffic starts.

<Tabs>
  <Tab title="Terminal 1 — receiver">
    ```bash theme={null}
    sudo ip netns exec wblab wireblast -i wb1 \
      --mode receive --rx-mode udp-port --rx-port 9000 -d 30s
    ```
  </Tab>

  <Tab title="Terminal 2 — sender">
    ```bash theme={null}
    sudo wireblast -i wb0 --dst-ip 10.99.0.2 --dst-port 9000 \
      --packet-size 512 --pps 100k -d 8s
    ```
  </Tab>
</Tabs>

<Warning>
  `sudo wireblast` won't find a binary that only exists in your user's `GOPATH`. Either install it to `/usr/local/bin` or give the full path, and note that inside `ip netns exec` you'll want the absolute path too.
</Warning>

## What you should see

Sender:

```text theme={null}
started: wb0: 1 queue(s), copy, native XDP, rx filter none
running for 8s (Ctrl-C to stop early)

[0:01] tx 74.97 k pkts  99.86 kpps  L1 424.99 Mbit/s  L2 409.02 Mbit/s  avg 512B
[0:02] tx 174.92 k pkts  100 kpps  L1 425.6 Mbit/s  L2 409.6 Mbit/s  avg 512B
...
ran for 0:08
  tx: 800.06 k packets, 409.63 MB, 100 kpps, L1 425.59 Mbit/s, L2 409.59 Mbit/s, avg frame 512B
      udp 800.06 k, tcp 0, other 0
```

Receiver:

```text theme={null}
started: wb1: 1 queue(s), copy, native XDP, rx filter udp/9000

ran for 0:20
  rx: 800.06 k packets, 409.63 MB, avg frame 512B
      udp 800.06 k, tcp 0, other 0
```

**800,060 sent, 800,060 received.** Exactly. That's the number to look for. If the two ends agree to the packet, everything in between is working.

Two other things worth noticing:

* **No link bounce.** `veth` has no physical link to renegotiate, so the attach is instant. On a real NIC this is where you'd wait about 8 seconds.
* **`copy` not `zero-copy`.** Expected on veth, and covered in [hardware and drivers](/concepts/hardware).

## How fast does it go?

Single queue on a 12-core box, so you have a reference point:

| Far end                                   | Rate                                    |
| ----------------------------------------- | --------------------------------------- |
| the kernel stack consuming the packets    | about 530 kpps, whatever the frame size |
| a Wireblast receiver draining via AF\_XDP | about 800 kpps, zero loss               |

It's packet-rate bound rather than bit-rate bound, so 1518-byte frames reach around 6.5 Gbit/s while 64-byte frames reach around 0.37 Gbit/s. Again, that's your CPU and kernel, not a NIC.

## Things to try in here

Since nothing here can hurt anything, this is the place to experiment with the settings you'd be careful about on a real box.

<AccordionGroup>
  <Accordion title="The match-all receive mode">
    ```bash theme={null}
    sudo ip netns exec wblab wireblast -i wb1 \
      --mode receive --rx-mode all --allow-match-all -d 30s
    ```

    You'll get the typed-`yes` confirmation. Read what it says: that's the screen that matters on a real interface. Here, the worst case is that a namespace with nothing in it stops receiving.
  </Accordion>

  <Accordion title="Unlimited rate">
    ```bash theme={null}
    sudo wireblast -i wb0 --dst-ip 10.99.0.2 --pps unlimited -d 5s
    ```

    Find out what your CPU does with a software interface. Then try `--packet-size 64` versus `--packet-size 1518` and watch packets/sec and bits/sec trade off against each other.
  </Accordion>

  <Accordion title="Flows and hashing">
    ```bash theme={null}
    sudo wireblast -i wb0 --dst-ip 10.99.0.2 --flows 1000 --vary-dst-port -d 10s
    ```

    Run `tcpdump -ni wb1` inside the namespace at a low `--pps` and watch the tuples change.
  </Accordion>

  <Accordion title="PCAP replay">
    Capture a few seconds of something real, then put it back on the wire:

    ```bash theme={null}
    sudo tcpdump -ni any -c 300 -w /tmp/sample.pcap
    sudo wireblast -i wb0 --pcap /tmp/sample.pcap --pcap-timing original
    ```
  </Accordion>
</AccordionGroup>

## Tear it down

Deleting the namespace takes `wb1` with it, and a `veth` pair dies together, so this is all you need:

```bash theme={null}
sudo ip netns del wblab
```

Verify:

```bash theme={null}
ip link show wb0
```

```text theme={null}
Device "wb0" does not exist.
```

## A one-shot script

The [examples directory](https://github.com/atoonk/wireblast/tree/main/examples/001-veth-quickstart) has all of this wrapped up: [001-veth-quickstart](https://github.com/atoonk/wireblast/tree/main/examples/001-veth-quickstart) builds the lab, sends traffic, and tears it down again in one command.

## Then what

When you're ready for real hardware, the [two-box test](/guides/two-box) is the same shape with a switch in the middle, plus the link bounce, VLAN tags and zero-copy that a physical NIC brings.
