{
    "mode": "man",
    "parameter": "tc-nat",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/tc-nat/8/json",
    "generated": "2026-09-10T04:10:34Z",
    "synopsis": "tc ... action nat DIRECTION OLD NEW\nDIRECTION := { ingress | egress }\nOLD := IPV4ADDRSPEC\nNEW := IPV4ADDRSPEC\nIPV4ADDRSPEC := { default | any | all | inaddr[/{prefix|netmask}]",
    "sections": {
        "NAME": {
            "content": "nat - stateless native address translation action\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "tc ... action nat DIRECTION OLD NEW\n\nDIRECTION := { ingress | egress }\n\nOLD := IPV4ADDRSPEC\n\nNEW := IPV4ADDRSPEC\n\nIPV4ADDRSPEC := { default | any | all | inaddr[/{prefix|netmask}]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The  nat  action allows one to perform NAT without the overhead of conntrack, which is desir‐\nable if the number of flows or addresses to perform NAT on is large. This action is best used\nin combination with the u32 filter to allow for efficient lookups of a large number of state‐\nless NAT rules in constant time.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "ingress",
                    "content": "Translate destination addresses, i.e. perform DNAT.\n\negress Translate source addresses, i.e. perform SNAT.\n\nOLD    Specifies addresses which should be translated.\n\nNEW    Specifies addresses which OLD should be translated into.\n"
                }
            ]
        },
        "NOTES": {
            "content": "The accepted address format in OLD and NEW is quite flexible. It may either consist of one of\nthe keywords default, any or all, representing the all-zero IP address or a combination of IP\naddress and netmask or prefix length separated by a slash (/) sign. In any case, the mask (or\nprefix length) value of OLD is used for NEW as well so that a one-to-one mapping of addresses\nis assured.\n\nAddress translation is done using a combination of binary  operations.  First,  the  original\n(source or destination) address is matched against the value of OLD.  If the original address\nfits,  the new address is created by taking the leading bits from NEW (defined by the netmask\nof OLD) and taking the remaining bits from the original address.\n\nThere is rudimental support for upper layer protocols, namely TCP, UDP and ICMP.   While  for\nthe  first two only checksum recalculation is performed, the action also takes care of embed‐\nded IP headers in ICMP packets by translating the respective address therein, too.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "tc(8)\n\niproute2                                     12 Jan 2015                         NAT action in tc(8)",
            "subsections": []
        }
    },
    "summary": "nat - stateless native address translation action",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "tc",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/tc/8/json"
        },
        {
            "name": "tc",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/tc/8/json"
        }
    ]
}