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_neighbour

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

NUD States

Field Description
permanent The neighbour entry is valid forever and can be only be removed administratively.
noarp the neighbour entry is valid. No attempts to validate this entry will be made but it can be removed when its lifetime expires.
reachable the neighbour entry is valid until the reachability timeout expires.
stale the neighbour entry is valid but suspicious. This option to ip neigh does not change the neighbour state if it was valid and the address is not changed by this command.
none this is a pseudo state used when initially creating a neighbour entry or after trying to remove it before it becomes free to do so.
incomplete the neighbour entry has not (yet) been validated/resolved.
delay neighbor entry validation is currently delayed.
probe neighbor is being probed.
failed max number of probes exceeded without success, neighbor validation has ultimately failed.

List

List multicast addresses

Parameters

Field Type Description
to string
The prefix selecting the neighbours to list.
dev string
only list the neighbours attached to this device.
vrf string
only list the neighbours for given VRF.
proxy boolean
list neighbour proxies.
unused boolean
only list neighbours which are not currently in use.
nud string
Only list neighbour entries in this state. NUD_STATE takes values listed below or the special value all which means all states. This option may occur more than once. If this option is absent, ip lists all entries except for none and noarp.

Result

Returns an array of IPNeighbour structs.

IPNeighbour Fields

Field Type Description
destination IPAddr Destination network address.
device string Which device the neighbour entry is bound to.
lladdr string The link layer address of the neighbour.
state array The state of the neighbour entry.
stats IPNeighbourStats Information about the neighbour entry.

IPNeighbourStats Fields

Field Type Description
used integer Number of seconds since the ARP entry was last used.
confirmed integer Number of seconds since the ARP entry was last confirmed.
updated integer Number of seconds since the ARP entry was last updated.
probes integer Number of probes
ref_count integer Free neighbour cache entry reference count.
host.ip('neighbour', 'list', stats: true)
[
  [ 0] #<Struct:Kanrisuru::Core::IP::IPNeighbour:0x000010e0
    destination = #<IPAddr: IPv4:10.0.0.97/255.255.255.255>,
    device = "ens3",
    lladdr = "fa:16:3e:2d:bd:e9",
    state = [
      [0] "STALE"
    ],
    stats = #<Struct:Kanrisuru::Core::IP::IPNeighbourStats:0x000011d0
      confirmed = 5799900,
      probes = 1,
      ref_count = nil,
      updated = 5799870,
      used = 5799900
    >
  >,
  [ 1] .. [8],
  [ 9] #<Struct:Kanrisuru::Core::IP::IPNeighbour:0x00001ab8
    destination = #<IPAddr: IPv4:10.0.0.241/255.255.255.255>,
    device = "ens3",
    lladdr = "fa:16:3e:f2:a2:8d",
    state = [
      [0] "STALE"
    ],
    stats = #<Struct:Kanrisuru::Core::IP::IPNeighbourStats:0x00001ba8
      confirmed = 5799887,
      probes = 1,
      ref_count = nil,
      updated = 5799859,
      used = 5799980
    >
  >,
  [10] #<Struct:Kanrisuru::Core::IP::IPNeighbour:0x00001bd0
    destination = #<IPAddr: IPv4:10.0.0.92/255.255.255.255>,
    device = "ens3",
    lladdr = "fa:16:3e:3f:8f:96",
    state = [
      [0] "STALE"
    ],
    stats = #<Struct:Kanrisuru::Core::IP::IPNeighbourStats:0x00001cc0
      confirmed = 5799982,
      probes = 1,
      ref_count = nil,
      updated = 5799951,
      used = 5800043
    >
  >
]

Add

Add a new neighbour entry

Parameters

Field Type Description
to string
the protocol address of the neighbour. It is either an IPv4 or IPv6 address.
dev string
the interface to which this neighbour is attached.
proxy boolean
indicates whether we are proxying for this neighbour entry
router boolean
indicates whether neighbour is a router
extern_learn boolean
this neigh entry was learned externally. This option can be used to indicate to the kernel that this is a controller learnt dynamic entry. Kernel will not gc such an entry.

Result

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

Change

Add a new neighbour entry.

Parameters

Coincide with the arguments of add.

Replace

Add a new entry or change an existing one.

Parameters

Coincide with the arguments of add.

Delete

Delete a neighbour entry.

Parameters

The arguments are the same as with ip neigh add, except that lladdr and nud are ignored.

Tested On

  • Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES