Z
Zebee Johnstone
I have a machine with more than one ethernet interface, and several
IP's aliased to the interfaces.
And several machines with aliases but only one interface.
So I don't want to hardcode interface names like eth0 into anything.
I want a list of IP addresses on the machine and the interface each IP
lives on.
I've been using grep and awk on the output from ifconfig -a to get the
IPs for use in a shellscript, but the new interface has kyboshed that as
ifconfig puts the interface name and IP address on different lines.
So I thought I should write a short perlscript to produce the
information for the shellscript.
Is there a module I can use to get the information, or will I have to
OPEN an ifconfig pipe and parse what I get from that? I'm trying to
avoid shell calls in perl if I can.
I've searched on CPAN but couldn't find anything that understood both
interface and IP.
Zebee
IP's aliased to the interfaces.
And several machines with aliases but only one interface.
So I don't want to hardcode interface names like eth0 into anything.
I want a list of IP addresses on the machine and the interface each IP
lives on.
I've been using grep and awk on the output from ifconfig -a to get the
IPs for use in a shellscript, but the new interface has kyboshed that as
ifconfig puts the interface name and IP address on different lines.
So I thought I should write a short perlscript to produce the
information for the shellscript.
Is there a module I can use to get the information, or will I have to
OPEN an ifconfig pipe and parse what I get from that? I'm trying to
avoid shell calls in perl if I can.
I've searched on CPAN but couldn't find anything that understood both
interface and IP.
Zebee