The ifconfig module exposes allows the user to query and manipulate network interfaces from Python programs.
The example below does the following:
from openbsd.ifconfig import * i = IFConfig() i.create("tun0") i["tun0"].addAddress("192.168.0.1") i["tun0"].mtu = 1500 i["tun0"].flags = IFF_UP print i["tun0"] i.destroy("tun0")
<--previous | contents | next--> | (12/21/04) |