Next: , Previous: , Up: IP Library   [Contents]


3.2 Addr

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

Scheme Procedure: addr-add device cidr [#:ipv6? #f]

Add the address given in cidr to device. device can contain the name of the link, as a string, or its index, as a number.

cidr must be a string containing the address and prefix length, in CIDR notation (addr/prefix).

(addr-add "enp1s0" "192.0.2.15/24")

If you wish to add an IPv6 address instead, set #:ipv6 to #t, as in the following example.

(addr-add "enp1s0" "2001:db8::1a4c/64" #:ipv6? #t)

Note that using the wrong ip type with the wrong value for the #:ipv6? flag will result in a Bad address exception from inet-pton.

Scheme Procedure: addr-del device cidr [#:ipv6? #f]

Delete the address given in cidr from device. device can contain the name of the link, as a string, or its index, as a number.

cidr must be a string containing the address and prefix length, in CIDR notation (addr/prefix).

(addr-del "enp1s0" "192.0.2.15/24")

If you wish to remove an IPv6 address instead, set #:ipv6 to #t, as in the following example.

(addr-del "enp1s0" "2001:db8::1a4c/64" #:ipv6? #t)

Note that using the wrong ip type with the wrong value for the #:ipv6? flag will result in a Bad address exception from inet-pton.

Scheme Procedure: addr-show [device]

Print the list of addresses for each device on standard output. Setting device to a link name or link identifier will restrict the output to addresses of that device.


Next: , Previous: , Up: IP Library   [Contents]