# info > nat

---
type: CommandReference
command: tc nat
mode: man
section: 8
source: man-pages
---

## Quick Reference

- `tc ... action nat ingress OLD NEW` — Perform DNAT (translate destination address)
- `tc ... action nat egress OLD NEW` — Perform SNAT (translate source address)
- `OLD` and `NEW` accept IP address with optional netmask or prefix length (e.g., `192.168.1.0/24` or `10.0.0.1/255.255.255.0`)
- Keywords `default`, `any`, or `all` represent the all-zero IP address
- Best used with `u32` filter for efficient large-scale stateless NAT

## Name

nat — stateless native address translation action

## Synopsis

tc ... action nat DIRECTION OLD NEW

DIRECTION := { ingress | egress }
OLD := IPV4_ADDR_SPEC
NEW := IPV4_ADDR_SPEC
IPV4_ADDR_SPEC := { default | any | all | in_addr[/{prefix|netmask}] }
## Options

- `ingress` — Translate destination addresses (DNAT)
- `egress` — Translate source addresses (SNAT)
- `OLD` — Specifies addresses to be translated
- `NEW` — Specifies addresses into which `OLD` is translated

The mask (or prefix length) from `OLD` is reused for `NEW`, ensuring a one-to-one address mapping. Address translation is performed by taking the leading bits from `NEW` (as defined by the netmask of `OLD`) and the remaining bits from the original address.

Rudimentary support for TCP, UDP, and ICMP: for TCP/UDP, checksum recalculation is performed; for ICMP, embedded IP headers are also translated.

## See Also

- [tc(8)](http://localhost/phpMan.php/man/tc/8/markdown)