Just gimme the IP!
Evan Broder
evan at ebroder.net
Tue Jun 14 03:53:04 UTC 2011
On Mon, Jun 13, 2011 at 6:58 PM, Dustin Kirkland <kirkland at ubuntu.com> wrote:
> In the interest of consistency, I'm wondering if it would make sense
> to create and maintain a stable, definitive utility somewhere in
> Ubuntu's default seed to provide the system's ip address,
> *succinctly*, quickly, and reliably.
>
> I'd think it should:
> a) default to ipv4, but support a -6|--ipv6 option
> b) default to the interface providing the default route, but support
> an optional interface parameter
> c) be very, very fast (ie, I looked at facter, but it's pretty slow)
I think the ifdata program in moreutils is a good start on this:
mingo:~ evan$ time ifdata -pa eth0
172.16.4.140
real 0m0.008s
user 0m0.000s
sys 0m0.000s
It seems to have only the most basic of IPv6 support, and lacks the
ability to enumerate interfaces or default to the interface providing
the default route, but it's explicitly designed to cover the use case
of "getting information about interfaces in shell scripts" - it seems
like trying to enhance it to fill in the gaps would be a better plan
than adding more utilities.
- Evan
More information about the ubuntu-devel
mailing list