<--previous | contents | next-->

# ifconfig

The ifconfig module exposes allows the user to query and manipulate network interfaces from Python programs.

## Example

The example below does the following:

- Creates a new interface "tun6"
- Adds the address "192.168.0.1" to the interface.
- Sets its MTU to 1500
- Sets the UP flag on the interface (equivalent to "ifconfig tun6 up")
- Prints human-readable information on tun0
- And then destroys "tun6"

    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)

PyOpenbsd v0.1 Manual