{
    "mode": "man",
    "parameter": "ip-nexthop",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/ip-nexthop/8/json",
    "generated": "2026-06-15T13:27:11Z",
    "synopsis": "ip [ ip-OPTIONS ] nexthop  { COMMAND | help }\nip nexthop { show | flush } SELECTOR\nip nexthop { add | replace } id ID NH\nip nexthop { get | del } id ID\nip nexthop bucket list BUCKETSELECTOR\nip nexthop bucket get id ID index INDEX\nSELECTOR := [ id ID ] [ dev DEV ] [ vrf NAME ] [ master DEV ] [ groups ] [ fdb ]\nBUCKETSELECTOR := SELECTOR  | [ nhid ID ]\nNH := { blackhole | [ via ADDRESS ] [ dev DEV ] [ onlink ] [ encap ENCAP ] [ fdb ] | group\nGROUP [ fdb ] [ type TYPE [ TYPEARGS ] ] }\nENCAP := [ ENCAPMPLS ]\nENCAPMPLS := mpls [ LABEL ] [ ttl TTL ]\nGROUP := id[,weight[/...]\nTYPE := { mpath | resilient }\nTYPEARGS := [ RESILIENTARGS ]\nRESILIENTARGS := [ buckets BUCKETS ] [ idletimer IDLE ] [ unbalancedtimer UNBALANCED ]",
    "sections": {
        "NAME": {
            "content": "ip-nexthop - nexthop object management\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ip [ ip-OPTIONS ] nexthop  { COMMAND | help }\n\n\nip nexthop { show | flush } SELECTOR\n\nip nexthop { add | replace } id ID NH\n\nip nexthop { get | del } id ID\n\nip nexthop bucket list BUCKETSELECTOR\n\nip nexthop bucket get id ID index INDEX\n\nSELECTOR := [ id ID ] [ dev DEV ] [ vrf NAME ] [ master DEV ] [ groups ] [ fdb ]\n\nBUCKETSELECTOR := SELECTOR  | [ nhid ID ]\n\nNH := { blackhole | [ via ADDRESS ] [ dev DEV ] [ onlink ] [ encap ENCAP ] [ fdb ] | group\nGROUP [ fdb ] [ type TYPE [ TYPEARGS ] ] }\n\nENCAP := [ ENCAPMPLS ]\n\nENCAPMPLS := mpls [ LABEL ] [ ttl TTL ]\n\nGROUP := id[,weight[/...]\n\nTYPE := { mpath | resilient }\n\nTYPEARGS := [ RESILIENTARGS ]\n\nRESILIENTARGS := [ buckets BUCKETS ] [ idletimer IDLE ] [ unbalancedtimer UNBALANCED ]\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "ip nexthop is used to manipulate entries in the kernel's nexthop tables.\n\nip nexthop add id ID\nadd new nexthop entry\n\nip nexthop replace id ID\nchange the configuration of a nexthop or add new one\n\nvia [ FAMILY ] ADDRESS\nthe address of the nexthop router, in the address family FAMILY.  Address fam‐\nily must match address family of nexthop instance.\n\ndev NAME\nis the output device.\n\nonlink pretend that the nexthop is directly attached to this link, even if it does not\nmatch any interface prefix.\n\nencap ENCAPTYPE ENCAPHDR\nattach tunnel encapsulation attributes to this route.\n\nENCAPTYPE is a string specifying the supported encapsulation type. Namely:\n\nmpls - encapsulation type MPLS\n\nENCAPHDR is a set of encapsulation attributes specific to the ENCAPTYPE.\n\nmpls\nMPLSLABEL - mpls label stack with labels separated by /\n\n\nttl TTL - TTL to use for MPLS header or 0 to inherit from IP header\n\n\ngroup GROUP [ type TYPE [ TYPEARGS ] ]\ncreate a nexthop group. Group specification is id with an optional weight\n(id,weight) and a '/' as a separator between entries.\n\nTYPE is a string specifying the nexthop group type. Namely:\n\nmpath - Multipath nexthop group backed by the hash-threshold algorithm.\nThe default when the type is unspecified.\n\nresilient - Resilient nexthop group. Group is resilient to addition and\ndeletion of nexthops.\n\n\nTYPEARGS is a set of attributes specific to the TYPE.\n\nresilient\nbuckets BUCKETS - Number of nexthop buckets. Cannot be changed for an\nexisting group\n\n\nidletimer IDLE - Time in seconds in which a nexthop bucket does not\nsee traffic and is therefore considered idle. Default is 120 seconds\n\nunbalancedtimer UNBALANCED - Time in seconds in which a nexthop\ngroup is unbalanced and is therefore considered unbalanced. The ker‐\nnel will try to rebalance unbalanced groups, which might result in\nsome flows being reset. A value of 0 means that no rebalancing will\ntake place. Default is 0 seconds\n\n\nblackhole\ncreate a blackhole nexthop\n\nfdb    nexthop and nexthop groups for use with layer-2 fdb entries.  A fdb nexthop\ngroup can only have fdb nexthops.  Example: Used to represent a vxlan remote\nvtep ip. layer-2 vxlan fdb entry pointing to an ecmp nexthop group containing\nmultiple remote vtep ips.\n\n\nip nexthop delete id ID\ndelete nexthop with given id.\n\n\nip nexthop show\nshow the contents of the nexthop table or the nexthops selected by some criteria.\n\ndev DEV\nshow the nexthops using the given device.\n\nvrf NAME\nshow the nexthops using devices associated with the vrf name\n\nmaster DEV\nshow the nexthops using devices enslaved to given master device\n\ngroups show only nexthop groups\n\nfdb    show only fdb nexthops and nexthop groups\n\nip nexthop flush\nflushes nexthops selected by some criteria. Criteria options are the same as show.\n\n\nip nexthop get id ID\nget a single nexthop by id\n\n\nip nexthop bucket show\nshow the contents of the nexthop bucket table or the nexthop buckets selected by some\ncriteria.\n\nid ID\nshow the nexthop buckets that belong to a nexthop group with a given id\n\nnhid ID\nshow the nexthop buckets that hold a nexthop with a given id\n\ndev DEV\nshow the nexthop buckets using the given device\n\nvrf NAME\nshow the nexthop buckets using devices associated with the vrf name\n\nmaster DEV\nshow the nexthop buckets using devices enslaved to given master device\n\n\nip nexthop bucket get id ID index INDEX\nget a single nexthop bucket by nexthop group id and bucket index\n\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "ip nexthop ls\nShow all nexthop entries in the kernel.\n\nip nexthop add id 1 via 192.168.1.1 dev eth0\nAdds an IPv4 nexthop with id 1 using the gateway 192.168.1.1 out device eth0.\n\nip nexthop add id 2 encap mpls 200/300 via 10.1.1.1 dev eth0\nAdds an IPv4 nexthop with mpls encapsulation attributes attached to it.\n\nip nexthop add id 3 group 1/2\nAdds a nexthop with id 3. The nexthop is a group using nexthops with ids 1 and 2 at equal\nweight.\n\nip nexthop add id 4 group 1,5/2,11\nAdds a nexthop with id 4. The nexthop is a group using nexthops with ids 1 and 2 with\nnexthop 1 at weight 5 and nexthop 2 at weight 11.\n\nip nexthop add id 5 via 192.168.1.2 fdb\nAdds a fdb nexthop with id 5.\n\nip nexthop add id 7 group 5/6 fdb\nAdds a fdb nexthop group with id 7. A fdb nexthop group can only have fdb nexthops.\n\nip nexthop add id 10 group 1/2 type resilient buckets 32\nAdd a resilient nexthop group with id 10 and 32 nexthop buckets.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "ip(8)\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Original Manpage by David Ahern <dsahern@kernel.org>\n\n\n\niproute2                                     30 May 2019                               IP-NEXTHOP(8)",
            "subsections": []
        }
    },
    "summary": "ip-nexthop - nexthop object management",
    "flags": [],
    "examples": [
        "ip nexthop ls",
        "Show all nexthop entries in the kernel.",
        "ip nexthop add id 1 via 192.168.1.1 dev eth0",
        "Adds an IPv4 nexthop with id 1 using the gateway 192.168.1.1 out device eth0.",
        "ip nexthop add id 2 encap mpls 200/300 via 10.1.1.1 dev eth0",
        "Adds an IPv4 nexthop with mpls encapsulation attributes attached to it.",
        "ip nexthop add id 3 group 1/2",
        "Adds a nexthop with id 3. The nexthop is a group using nexthops with ids 1 and 2 at equal",
        "weight.",
        "ip nexthop add id 4 group 1,5/2,11",
        "Adds a nexthop with id 4. The nexthop is a group using nexthops with ids 1 and 2 with",
        "nexthop 1 at weight 5 and nexthop 2 at weight 11.",
        "ip nexthop add id 5 via 192.168.1.2 fdb",
        "Adds a fdb nexthop with id 5.",
        "ip nexthop add id 7 group 5/6 fdb",
        "Adds a fdb nexthop group with id 7. A fdb nexthop group can only have fdb nexthops.",
        "ip nexthop add id 10 group 1/2 type resilient buckets 32",
        "Add a resilient nexthop group with id 10 and 32 nexthop buckets."
    ],
    "see_also": [
        {
            "name": "ip",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/ip/8/json"
        }
    ]
}