This is the development version of Kanrisuru. Since this is still a pre-1.0 release, we don't recommend using this in system-critical production environments.

Kanrisuru

ip_maddress

Manage ip address interfaces in ruby
linux manual

Actions

name description
list List multicast addresses
add Add a multicast address
delete Delete a multicast address

List

List multicast addresses

Parameters

Field Type Description
family string
Specifies the protocol family to use. The protocol family identifier can be one of inet, inet6, bridge, mpls or link.
dev string
Specify the device name

Result

Returns an array of IPAddressProperty structs.

IPMAddress Fields

Field Type Description
index integer Position of address property
name string Name of the device
maddr array An array of IPMAddressEntry items

IPMAddressEntry Fields

Field Type Description
family string The protocol family identifier
link string Link address
address string (IPv4 or IPv6) address attached to the network device.
users integer Number of members belonging to this group.

Example

host.ip('maddr', 'list').to_a
[
    [0] #<Struct:Kanrisuru::Core::IP::IPMAddress:0x000007d0
        index = 1,
        maddr = [
            [0] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000820
                address = "224.0.0.1",
                family = "inet",
                link = nil,
                users = nil
            >,
            [1] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000898
                address = "ff02::1",
                family = "inet6",
                link = nil,
                users = nil
            >,
            [2] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000910
                address = "ff01::1",
                family = "inet6",
                link = nil,
                users = nil
            >
        ],
        name = "lo"
    >,
    [1] #<Struct:Kanrisuru::Core::IP::IPMAddress:0x000009b0
        index = 2,
        maddr = [
            [0] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000a00
                address = nil,
                family = nil,
                link = "01:00:5e:00:00:01",
                users = nil
            >,
            [1] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000a50
                address = nil,
                family = nil,
                link = "33:33:00:00:00:01",
                users = nil
            >,
            [2] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000aa0
                address = nil,
                family = nil,
                link = "33:33:ff:76:73:94",
                users = nil
            >,
            [3] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000af0
                address = nil,
                family = nil,
                link = "01:80:c2:00:00:00",
                users = nil
            >,
            [4] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000b40
                address = nil,
                family = nil,
                link = "01:80:c2:00:00:03",
                users = nil
            >,
            [5] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000b90
                address = nil,
                family = nil,
                link = "01:80:c2:00:00:0e",
                users = nil
            >,
            [6] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000be0
                address = "224.0.0.1",
                family = "inet",
                link = nil,
                users = nil
            >,
            [7] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000c58
                address = "ff02::1:ff76:7394",
                family = "inet6",
                link = nil,
                users = nil
            >,
            [8] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000cd0
                address = "ff02::1",
                family = "inet6",
                link = nil,
                users = 2
            >,
            [9] #<Struct:Kanrisuru::Core::IP::IPMAddressEntry:0x00000d48
                address = "ff01::1",
                family = "inet6",
                link = nil,
                users = nil
            >
        ],
        name = "ens3"
    >
]

Add

Add a new multicast address to an interface.

This command needs escalated privileges to make changes to certain files and directory ownership.

Parameters

Field Type Description
address string
The link-layer multicast address
dev string
the device to join/leave this multicast address.

Result

No explicit data struct returned, only option is success?, failure?, and status to see if the program exited properly.

Example

host.su('root')
result = host.ip('maddress', 'add', dev: 'ens3', address: '192.16.9.13')
result.success?
true

Delete

Delete a multicast address from an interface.

This command needs escalated privileges to make changes to certain files and directory ownership.

Parameters

Field Type Description
address string
The link-layer multicast address
dev string
the device to join/leave this multicast address.

Result

No explicit data struct returned, only option is success?, failure?, and status to see if the program exited properly.

Example

host.su('root')
result = host.ip('address', 'delete', dev: 'ens3', address: '192.16.9.13')
result.success?
true