Skip to content
Get host IP / Interfaces
Perl 6
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples add: ipv6 table use. add: some examples May 23, 2019
lib/Sys add: show ipv6 address as default ip in get_default_ip when requested May 24, 2019
.gitignore initial commit May 22, 2019
.travis.yml initial commit May 22, 2019
LICENSE initial commit May 22, 2019
META6.json fix META info May 24, 2019


Build Status

Get system IP / Interfaces




Get system IP addresses and interfaces. It doesn't rely on ifconfig/ipconfig etc. It does this by using routing table default route and C ABI. All method works fine on Linux only ( for now ). BSD is the next target.

Coming soon

BSD, Windows

Why not ifconfig / ipconfig

Really ?


use Sys::IP;

# Get system default IP
say; #

# Get all active IP's
say; # [, ]

# Get all active interfaces
say; # [ { name => eth0, ip-addr => }, ...]


  • :$ipv6 = False include ipv6 addresses
  • :$loopback = False include loopback interface
  • :$active = True include only active interfaces
  • :$ip = True include only interfaces with assigned IP address


  • new( Bool :$ipv6 = False, Bool :$loopback = False, Bool :$active = True, Bool :$ip = True --> Sys::IP )
  • get_default_ip( --> Str ) when used with :ipv6 it will return only ipv6 address
  • get_ips( --> Array )
  • get_interfaces( --> Array[Hash] )


zef install Sys::IP


prove -ve 'perl6 -Ilib'
You can’t perform that action at this time.