Routing and network interface handling for IPv6.

class scapy.route6.Route6[source]

Bases: object

add(*args: Any, **kargs: Any) None[source]

Ex: add(dst=”2001:db8:cafe:f000::/56”) add(dst=”2001:db8:cafe:f000::/56”, gw=”2001:db8:cafe::1”) add(dst=”2001:db8:cafe:f000::/64”, gw=”2001:db8:cafe::1”, dev=”eth0”)

delt(dst: str, gw: str | None = None) None[source]

Ex: delt(dst=”::/0”) delt(dst=”2001:db8:cafe:f000::/56”) delt(dst=”2001:db8:cafe:f000::/56”, gw=”2001:db8:deca::1”)

flush() None[source]
ifadd(iff: str, addr: str) None[source]

Add an interface ‘iff’ with provided address into routing table.

Ex: ifadd(‘eth0’, ‘2001:bd8:cafe:1::1/64’) will add following entry into # noqa: E501

Scapy6 internal routing table:

Destination Next Hop iface Def src @ Metric 2001:bd8:cafe:1::/64 :: eth0 2001:bd8:cafe:1::1 1

prefix length value can be omitted. In that case, a value of 128 will be used.

ifchange(iff: str, addr: str) None[source]
ifdel(iff: str) None[source]

removes all route entries that uses ‘iff’ interface.

invalidate_cache() None[source]
make_route(dst: str, gw: str | None = None, dev: str | None = None) Tuple[str, int, str, str, List[str], int][source]

Internal function : create a route for ‘dst’ via ‘gw’.

remove_ipv6_iface(iface: str) None[source]

Remove the network interface ‘iface’ from the list of interfaces supporting IPv6.

resync() None[source]
route(dst: str = '', dev: Any | None = None, verbose: int = 2) Tuple[str, str, str][source]

Provide best route to IPv6 destination address, based on Scapy internal routing table content.

When a set of address is passed (e.g. 2001:db8:cafe:*::1-5) an address of the set is used. Be aware of that behavior when using wildcards in upper parts of addresses !

If ‘dst’ parameter is a FQDN, name resolution is performed and result is used.

if optional ‘dev’ parameter is provided a specific interface, filtering is performed to limit search to route associated to that interface.