Skip to content

Commit

Permalink
doc: update
Browse files Browse the repository at this point in the history
  • Loading branch information
EHfive committed Apr 7, 2024
1 parent 7d18c5c commit 952db90
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ This eBPF application implements an "Endpoint-Independent Mapping" and "Endpoint
- **eBPF**: IPv4 to IPv4 NAPT(Network Address Port Translation)
- **eBPF**: IPv6 to IPv6 NAPT
- **eBPF**: Endpoint-Independent(Full Cone) NAT for TCP, UDP and ICMP
- **eBPF**: Partial port-range usage, allows reserving external ports for other usage
- **eBPF**: Partial external port range usage, allows reserving external ports for other usage
- **Frontend**: Automatic reconfiguration on interface address changes
- **Frontend**: Automatic hairpin IP rule and route setup, see https://github.com/EHfive/einat-ebpf/issues/4
- **Frontend**: Automatic IP rule and route setup for hairpinning, see https://github.com/EHfive/einat-ebpf/issues/4

## Requirement

- Linux kernel >= 5.15 (compiled with BPF and BTF support) on target machine
- `libelf` from elfutils
- `zlib`
- `clang` to compile BPF C code
- `clang` for bindgen and compiling BPF C code
- `cargo` and `rustfmt` for building

It's also required the eBPF JIT implementation for target architecture in kernel has implemented support for BPF-to-BPF calls, which is not the case for MIPS and other architectures have less interests. This application is only tested to work on x86-64 or aarch64.
Expand Down Expand Up @@ -69,7 +69,7 @@ You would only need to specify external interface name in a minimal setup, and `
sudo sysctl net.ipv4.ip_forward=1
# With simplified CLI options,
# this setup NAT for traffic forwarding to and from wan0 and setup hairpin
# routing for traffic forwarding from lo and lan0 to wan0
# routing for traffic forwarding from lo or lan0 to wan0
sudo einat --ifname wan0 --hairpin-if lo lan0
# With config file
sudo einat --config /path/to/config.toml
Expand Down
4 changes: 2 additions & 2 deletions config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ nat66 = false
# 0: disable, 1: error, 2: warn, 3: info, 4: debug, 5: trace
# View logs with `cat /sys/kernel/debug/tracing/trace_pipe`
bpf_log_level = 0
# Enable external address(preferd source) lookup, recommend to enable.
# Enable external address(preferd source) lookup, recommended to enable.
# Only works on Linux kernel>=6.7, it's a no-op for kernel on lower version.
bpf_fib_lookup_external = false
# Set this to `false` for early disabling inbound ICMP binding initiation,
Expand Down Expand Up @@ -93,7 +93,7 @@ table_id = 4787
address = "192.168.4.2"
# The address would not be used as NAT external address if this is `true`.
no_snat = false
# Disable hairpin the address.
# Disable hairpinning for the address.
no_hairpin = false
# Defaults to ranges in [defaults] if not specified.
#tcp_ranges = ["10000-65535"]
Expand Down
6 changes: 6 additions & 0 deletions docs/guide/cross.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ apt install libelf-dev zlib1g-dev gcc-aarch64-linux-gnu clang

Install `rustup` to get Rust>=1.74, see https://www.rust-lang.org/tools/install. Also make sure `rustfmt` is installed as it's used by `libbpf-cargo`.

Add required target to Rust toolchain:

```
rustup target add aarch64-unknown-linux-gnu
```

### Target Dependencies

```
Expand Down
4 changes: 3 additions & 1 deletion docs/guide/openwrt.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
As said in [README](../../README.md), `einat` requires a kernel with BPF and BTF support enabled which is not the default.
And `einat` requires running kernel for target architecture has support for BPF-to-BPF calls, which is not the case for MIPS and other older architectures.

So if the architecture of your router is not x86-64 or aarch64 or other actively maintained architecture in kernel, your router would mostly not be able to run `einat`.
So if the architecture of your router is not x86-64 or aarch64 or other actively maintained architecture in kernel, your router would mostly not be able to have `einat` working.

The following is OpenWrt build configs required for `einat` to work.

### Build Configs

Expand Down

0 comments on commit 952db90

Please sign in to comment.