D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Perl NIC subroutine?



On Thu, 2004-02-26 at 13:40, John Horne wrote:
On Thu, 2004-02-26 at 13:24, mike@xxxxxxxxxxxxx wrote:
True,

Maybe you should tell us whay are trying to do, there might be a 'better 
solution' TM

The webmin third-party module b9ddns (http://sf.net/projects/b9ddns)
access the local DNS using the loopback interface. However, I was
requested to look at the possibility of using a different system
interface because some sites configure their DNS such that queries and
dynamic updates are only allowed via the network interface and not the
loopback. Hence I need a perl module or subroutine to find out what
interfaces the local host has.

I didn't find too much about this on the web over the weekend. There is
a perl module for handling the interfaces (Net::Interface) but most of
the code that I found tends to rely on ifconfig.

The solution however seems to be by using hostname to get the local host
name and then getaddrbyname to get the IP address. This works fine but
not for multihomed machines. However, I think the way to resolve this is
simply for the dns queries to be directed to the local hosts name rather
than an address. singlehomed (??) machines will work okay, and a
multihomed machine will (generally) receive queries on a round-robin
basis as the dns provides the IP address using round-robin. So that
takes care of that. I tested it on a Uni multihomed system and it seems
to work fine.

Many thanks to those who replied and for the suggestions. 


John.

-- 
---------------------------------------------------------------
John Horne, University of Plymouth, UK  Tel: +44 (0)1752 233914
E-mail: John.Horne@xxxxxxxxxxxxxx       Fax: +44 (0)1752 233839



--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.



Lynx friendly