RE: getting link-layer addr of unknown interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I saw you have got a solution on your problem.

I just want to comment my answer.

I run "ip addr" on my router:

wan-router:/# ip addr
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope global lo
2: teql0: <NOARP> mtu 1500 qdisc noop qlen 100
    link/void
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
4: tunl0@NONE: <NOARP> mtu 1480 qdisc noop
    link/ipip 0.0.0.0 brd 0.0.0.0
5: gre0@NONE: <NOARP> mtu 1476 qdisc noop
    link/gre 0.0.0.0 brd 0.0.0.0
6: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo qlen 100
    link/ether 00:80:c8:cf:e7:49 brd ff:ff:ff:ff:ff:ff
    inet 10.1.248.249/30 brd 255.255.255.255 scope global eth0
7: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo qlen 100
    link/ether 00:80:c8:cf:e7:4a brd ff:ff:ff:ff:ff:ff
    inet 10.33.1.254/24 brd 255.255.255.255 scope global eth1
8: eth2: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo qlen 100
    link/ether 00:80:c8:cf:e7:4b brd ff:ff:ff:ff:ff:ff
    inet 10.65.1.254/24 brd 255.255.255.255 scope global eth2
9: eth3: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo qlen 100
    link/ether 00:80:c8:cf:e7:4c brd ff:ff:ff:ff:ff:ff
    inet 10.52.0.1/24 brd 255.255.255.255 scope global eth3
    inet 10.52.253.1/24 brd 255.255.255.255 scope global eth3
10: eth4: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo qlen 100
    link/ether 00:80:c8:cd:26:4d brd ff:ff:ff:ff:ff:ff
    inet 10.48.0.126/24 brd 255.255.255.255 scope global eth4
11: eth5: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo qlen 100
    link/ether 00:80:c8:cd:26:4e brd ff:ff:ff:ff:ff:ff
    inet 217.10.105.94/28 brd 255.255.255.255 scope global eth5
12: eth6: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo qlen 100
    link/ether 00:80:c8:cd:26:4f brd ff:ff:ff:ff:ff:ff
    inet 217.10.105.62/29 brd 255.255.255.255 scope global eth6
13: eth7: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 100
    link/ether 00:80:c8:cd:26:50 brd ff:ff:ff:ff:ff:ff
14: eth8: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 100
    link/ether 00:80:c8:ca:b7:f1 brd ff:ff:ff:ff:ff:ff
15: eth9: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 100
    link/ether 00:80:c8:ca:b7:f2 brd ff:ff:ff:ff:ff:ff
16: eth10: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 100
    link/ether 00:80:c8:ca:b7:f3 brd ff:ff:ff:ff:ff:ff
17: eth11: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo qlen 100
    link/ether 00:80:c8:ca:b7:f4 brd ff:ff:ff:ff:ff:ff
    inet 10.1.249.254/24 brd 255.255.255.255 scope global eth11

Note device eth7. The device is not configured, it's not up and running, but
it still shows by "ip addr"....

Regards,
Daniel


-----Original Message-----
From: Amit Kucheria [mailto:amitk@ittc.ku.edu]
Sent: Tuesday, December 11, 2001 9:18 PM
To: Daniel Bergqvist
Cc: Networking
Subject: RE: getting link-layer addr of unknown interface

On Tue, 11 Dec 2001, Daniel Bergqvist wrote:
> Yes, run the command:
>
> ip addr
>
> See http://defiant.coinet.com/iproute2/ and
> http://defiant.coinet.com/iproute2/ip-cref/ for more info.

ip addr is for ip or ipv6. I was looking for link layer addresses. Maybe
i should have mentioned that in the subject line before.

Maybe 'ip link' is what i am looking for. I just glanced at the code.

So does
  ioctl(s, SIOCGIFINDEX, &ifr)
get the list of all interfaces ???

Let me rephrase my requirement.

I should be able to get the link-layer address of an interface by
specifying the interface name ie. eth0, eth1 etc.
(mac address for ethernet)

And this interface might not have an ip address when i do this.

Thanks & Regards,
Amit

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux