[SOLVED] Re: Finding active interface and its ip address within a perl script ?

2010-10-12 Thread Aaron Lewis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/12/2010 02:23 PM, joshua stein wrote: >> But is there any better ways to work it out ? > > you could get the ip of the interface that the default route is > going through: > > route -n get default | grep 'if address' | sed 's/.*: //' >

Re: Finding active interface and its ip address within a perl script ?

2010-10-11 Thread joshua stein
> But is there any better ways to work it out ? you could get the ip of the interface that the default route is going through: route -n get default | grep 'if address' | sed 's/.*: //' or ask ifconfig what is in the egress group and assume the first ip on the first interface will be ok

Finding active interface and its ip address within a perl script ?

2010-10-11 Thread Aaron Lewis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I'm trying to write a simple script which can grab the ip address of current active interface. e.g iwn0 -> 10.7.22.23/24 , route 10.7.22.254 em0 -> 192.168.133.2/24 , route 192.168.133.1 ( active ,