need help working around specifying interface name on dhcpd invocation

Glenn Satchell Glenn.Satchell at
Mon Mar 27 10:42:19 UTC 2006

>X-Original-To: dhcp-users at
>From: "Gordon A. Lang" <glang at>
>To: <dhcp-users at>
>Subject: need help working around specifying interface name on dhcpd invocation
>Date: Mon, 27 Mar 2006 02:14:01 -0500
>X-MailScanner-Information: Please contact the ISP for more information
>X-MailScanner: Found to be clean
>X-MailScanner-SpamScore: sss
>X-archive-position: 289
>X-ecartis-version: Ecartis v1.0.0
>X-original-sender: glang at
>List-software: Ecartis version 1.0.0
>X-List-ID: <>
>X-list: dhcp-users
>I got dhcpd working with USE_SOCKETS and not ALIAS_NAMES_PERMUTED on Solaris 
>10 in a whole-root-zone (not the global zone), but so far I've only been 
>able to get it to work if I specify the precise sub-interface name during 
>e.g. dhcpd  eri0:3
>Is there a way to get dhcpd to not require the interface name under these 
>Needing to know the specific sub-interface name is a problem because the 
>interface name changes according to the zone boot order on Solaris 10.
>If there isn't a work around with the current release of dhcpd, then is 
>there a *simple* way (e.g. available script or utility) to return the 
>interface name for a given IP address?
>Gordon A. Lang 
Perhaps not the most perfect example of perl coding, but I think this
will do the trick. If the script is called getint, then you use it like

dhcpd `getint`

#! /usr/bin/perl -w
my $ip = $ARGV[0] or die "usage: $0 ip-address\n";
open (IF, "/usr/sbin/ifconfig -a |") or die "can't run ifconfig: $!";
#lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 
index 1
#        inet netmask ff000000 
#hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
#        inet netmask ffffff00 broadcast
my $interface;
while (<IF>) {
    if ( /^([a-z0-9:]+): flags/ ) {
        $interface = $1;
    elsif ( /inet (\d+\.\d+\.\d+\.\d+) netmask/ ) {
        if ($ip eq $1) {
            print $interface, "\n";


More information about the dhcp-users mailing list