Routing and handling of network interfaces.

class scapy.route.Route[source]

Bases: object

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

Ex: add(net=””,gw=””)

delt(host|net, gw|dev)[source]
get_if_bcast(iff: str) List[str][source]
ifadd(iff: str, addr: str) None[source]
ifchange(iff: str, addr: str) None[source]
ifdel(iff: str) None[source]
invalidate_cache() None[source]
make_route(host: Optional[str] = None, net: Optional[str] = None, gw: Optional[str] = None, dev: Optional[str] = None, metric: int = 1) Tuple[int, int, str, str, str, int][source]
resync() None[source]
route(dst: Optional[str] = None, verbose: int = 2) Tuple[str, str, str][source]

Returns the IPv4 routes to a host. :param - dst: the IPv4 of the destination host

returns: (iface, output_ip, gateway_ip)
  • iface: the interface used to connect to the host

  • output_ip: the outgoing IP that will be used

  • gateway_ip: the gateway IP that will be used