Subject: | Sys::HostAddr not picking up all addresses on each interface |
Date: | Thu, 05 Jan 2012 16:11:13 +0000 |
To: | bug-Sys-HostAddr [...] rt.cpan.org |
From: | David Whitmarsh <david.whitmarsh [...] sixwhits.com> |
Perl version: This is perl, v5.10.1 (*) built for
x86_64-linux-gnu-thread-multi
OS version: Ubuntu 10.04 LTS: Linux sideshowbob 2.6.32-37-server
#81-Ubuntu SMP Fri Dec 2 20:49:12 UTC 2011 x86_64 GNU/Linux
Sys::HostAddr version 0.95 - Fetching with LWP:
http://www.perl.org/CPAN/authors/id/J/JK/JKISTER/Sys-HostAddr-0.95.tgz
Running this perl script:
------------------------------
use Sys::HostAddr;
use Data::Dumper;
$s = Sys::HostAddr->new();
print Dumper $s->ip();
------------------------------
Produces this output:
------------------------------
$VAR1 = {
'lo' => [
{
'netmask' => '255.0.0.0',
'address' => '127.0.0.1'
}
],
'eth1' => [
{
'netmask' => '255.255.255.0',
'address' => '192.168.7.104'
}
],
'eth0' => [
{
'netmask' => '255.255.255.0',
'address' => '192.168.0.104'
}
]
};
------------------------------
but "ip addr show" gives:
------------------------------
david@sideshowbob:~$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
link/ether 80:ee:73:14:7a:25 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.104/24 brd 192.168.0.255 scope global eth0
inet 192.168.0.101/24 scope global secondary eth0
inet6 fe80::82ee:73ff:fe14:7a25/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UNKNOWN qlen 1000
link/ether 00:05:5d:0d:12:e9 brd ff:ff:ff:ff:ff:ff
inet 192.168.7.104/24 brd 192.168.7.255 scope global eth1
inet 192.168.7.101/24 scope global secondary eth1
inet6 fe80::205:5dff:fe0d:12e9/64 scope link
valid_lft forever preferred_lft forever
------------------------------
Addresses 192.168.0.101 on eth0 and 192.168.7.101 on eth1 are not
included in the results of Sys::HostAddr->ip, behaviour is similar for
other methods, these addresses are never seen by the perl module.
Regards,
David Whitmarsh