Re: How to get network interface info only with its name

From: Tony Nugent (tony@growzone.com.au)
Date: Thu Mar 02 2000 - 00:56:19 EST


You are digging too deep. This sounds as if it is what you are
looking for:

        cat /proc/net/arp

These are also useful tools:

        /sbin/ifconfig
        /sbin/arp -a

Often it is helpful to do a broadcast ping on the local network(s) to
get all the arp entries up to date, eg:

        ping -b <network broadcast address, eg 192.168.1.255>

On Wed Mar 01 2000 at 06:52, Jaekwon Oh wrote:

>
> Hi,
>
> Now, I'm trying to get the network device's MAC address and IP address
> only with its interface name.
>
> In BSD, I can do this by using 'sysctl' with the type of info,
> 'NET_RT_IFLIST' and then matching the interface name with the
> sockaddr_dl's data.
>
> How can I do like this in LINUX?
>
> I tried to use LINUX's sysctl.
> But, I cannot find the name structure similar with BSD's 'NET_RT_IFLIST'.
> Moreover, the documentation about sysctl is too incomplete to know how to
> use LINUX's 'sysctl': e.g, it was very hard to find out the naming
> structure that 'sysctl' will search, and the data structure that 'sysctl'
> will return.
>
> So, I tried, in other way, to use 'routing socket' to do this.
> But, it was also hard to do that: getting the network device's MAC address
> and IP address only with its interface name.
>
> Could anyone who has similar experience help me?
>
> I'd very appreciate your help.
> Thanks a lot.
>
> Regards,
>
> Jaek

Cheers
Tony
 -=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
  Tony Nugent <Tony@growzone.com.au> Systems Administrator, RHCE
  GrowZone OnLine (a project of) GrowZone Development Network
  POBox 475 Toowoomba Oueensland Australia 4350 Ph: 07 4637 8322
 -=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.rutgers.edu



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:26 EST