Up: IP Library   [Contents]

3.1 Link

The (ip link) module introduces procedures to access and modify the network links on your machine. They are equivalent to the ip link family of commands, from iproute2.

Modify an existing link and set its flags and attributes to the ones specified by the various keywords. When a keyword is omited, the corresponding attribute is not changed.

device can be a device index (as a number) or a device name (as a string).

Do not set #:up and #:down at the same time. Do not set *-on and *-off at the same time.

Print the set of devices on standard output. Setting any of the keyword to a non-false value will filter the results to only show results that match the corresponding value. You may set more than one keyword.

Add a new link with given name and type. Additional arguments can be passed to control the state of the link at creation. type-args is an association list containing additional values for the given type.

When type is "vlan", type-args can contain a number associated with 'id: the VLAN id to be created.

When type is "veth", type-args can contain a string associated with 'peer: the name of the peer.

The following is an example in which we create a new veth (virtual ethernet) pair and give them a name:

;; same as "ip l add v0p0 type veth peer v0p1"
(link-add "v0p0" "veth" #:type-args '((peer . "v0p1")))

Delete a link. device can contain the name of the link, as a string, or its index, as a number.

Up: IP Library   [Contents]