Module sysbot.modules.linux.ip

Linux Network Interface Module

This module provides methods for managing and querying network interfaces, IP addresses, routes, and network connectivity on Linux systems using the iproute2 (ip) command suite.

Classes

class Ip

Network interface and routing management class for Linux systems.

Ancestors

Methods

def addr(self, alias: str, interface: str, **kwargs) ‑> dict

Get IP address information for a network interface.

Args

alias
Session alias for the connection.
interface
Network interface name (e.g., eth0, ens33).
**kwargs
Additional command execution options.

Returns

Dictionary containing IP address configuration in JSON format.

Get link layer information for a network interface.

Args

alias
Session alias for the connection.
interface
Network interface name (e.g., eth0, ens33).
**kwargs
Additional command execution options.

Returns

Dictionary containing link layer information in JSON format.

def ping(self, alias: str, host: str, **kwargs) ‑> bool

Test network connectivity to a host using ping.

Args

alias
Session alias for the connection.
host
Hostname or IP address to ping.
**kwargs
Additional command execution options.

Returns

True if host is reachable, False otherwise.

def resolve(self, alias: str, fqdn: str, **kwargs) ‑> dict

Resolve a fully qualified domain name to an IP address.

Args

alias
Session alias for the connection.
fqdn
Fully qualified domain name to resolve.
**kwargs
Additional command execution options.

Returns

Resolved IP address as a string.

def route(self, alias: str, **kwargs) ‑> dict

Get routing table information.

Args

alias
Session alias for the connection.
**kwargs
Additional command execution options.

Returns

Dictionary containing routing table in JSON format.

def speed(self, alias: str, interface: str, **kwargs) ‑> str

Get the link speed of a network interface.

Args

alias
Session alias for the connection.
interface
Network interface name (e.g., eth0, ens33).
**kwargs
Additional command execution options.

Returns

Link speed in Mbps as a string.