README.md aktualisiert
This commit is contained in:
@@ -1,19 +1,25 @@
|
||||
# l3-forwarding-xdp
|
||||
|
||||
L3-L4 xdp based forwarding
|
||||
L3-L4 XDP-based forwarding tool.
|
||||
|
||||
xdp-tools is your friend to load xdp in that case.
|
||||
This project implements Layer 3 (IP) and Layer 4 (TCP/UDP) packet forwarding using eBPF and XDP (eXpress Data Path). It leverages the high-performance capabilities of XDP for efficient packet processing in the Linux kernel with bird or FRR.
|
||||
|
||||
# INSTALL
|
||||
```
|
||||
**Note:** `xdp-tools` is highly recommended for loading and managing the XDP program.
|
||||
|
||||
## Installation
|
||||
|
||||
Install the necessary dependencies using `apt`:
|
||||
|
||||
```bash
|
||||
apt update
|
||||
```
|
||||
```
|
||||
apt install clang llvm libbpf-dev libelf-dev pkg-config make git bpftool xdp-tools
|
||||
```
|
||||
|
||||
# Compile
|
||||
```
|
||||
## Compilation
|
||||
|
||||
Compile the eBPF program from the source code:
|
||||
|
||||
```bash
|
||||
clang -O2 -g -Wall -target bpf \
|
||||
-D__BPF_TRACING__ \
|
||||
-I/usr/include \
|
||||
@@ -21,17 +27,39 @@ clang -O2 -g -Wall -target bpf \
|
||||
-c main.c -o main.o
|
||||
```
|
||||
|
||||
# Attach to the interface
|
||||
```
|
||||
This will generate the object file `main.o` which contains the compiled eBPF code.
|
||||
|
||||
## Usage
|
||||
|
||||
### Attach to the Interface
|
||||
|
||||
Load the XDP program onto a network interface (e.g., `eth0`):
|
||||
|
||||
```bash
|
||||
xdp-loader load eth0 ./main.o
|
||||
```
|
||||
```
|
||||
|
||||
Check the status of loaded XDP programs:
|
||||
|
||||
```bash
|
||||
xdp-loader status
|
||||
```
|
||||
|
||||
``` BASH
|
||||
### Monitoring and Debugging
|
||||
|
||||
Use `bpftool` to inspect maps and statistics:
|
||||
|
||||
```bash
|
||||
bpftool map show
|
||||
bpftool map dump name xdp_flow_stats
|
||||
```
|
||||
|
||||
bpftool map dump name xdp_flow_stats
|
||||
These commands will display information about the eBPF maps used in the program, such as flow statistics.
|
||||
|
||||
## Unloading the Program
|
||||
|
||||
To unload the XDP program from the interface:
|
||||
|
||||
```bash
|
||||
xdp-loader unload eth0
|
||||
```
|
||||
Reference in New Issue
Block a user