Ethernet address

Hi,
I am trying to get an ethernet address by sending ioctl to socket descriptor. I am using SIOCGENADDR command. Looks like this is not supported under Solaris 8.0. Due to some reasons, I do not wish to use DLPI for getting the same.
The sockio.h has the definition for above command.
Any idea, what is going wrong?
-Bob

Using the SIOCGIFCONF ioctl to learn the interface name? Section 16.6
of UNIX Network Programming, Volume 1, Second Edition by the late W. Richard
Stevens provides a good example of its use.
Please refer this URL for source code :
http://www.cis.temple.edu/~ingargio/cis307/software/StevensBook/unpv12e/ioctl/
Thanks,
Senthilkumar
Developer Technical Support
http://www.sun.com/developers/support

Similar Messages

  • Reading the ethernet address without root permissions

    Hello,
    Is there a way to get the ethernet address of a network interface without root permissions (in a user program)?
    I need the mac address in order to generate DCE's uuids. The mac address is used as a unique machine identifier.
    Serge

    HI
    You may use this program copied from a technote 2856-09 to get MAC address in C. Works fine only if arp cache is present though . It
    does not talk to the driver directly . May be usefull to you. Compile
    with "-lsocket -lnsl" flags.
    <pre>
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/sockio.h>
    #include <sys/socket.h>
    #include <net/if.h>
    #include <net/if_arp.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>
    #include <netdb.h>
    #include <errno.h>
    main(argc, argv)
    int argc;
    char *argv[];
    int sockfd, i;
    struct arpreq arpreq;
    struct sockaddr_in *sin;
    struct hostent *hp;
    char host[256];
    if(argc != 2)
    printf("Usage : %s hostname\n", argv[0]), exit(1);
    strcpy(host, argv[1]);
    bzero(&arpreq, sizeof(struct arpreq));
    arpreq.arp_pa.sa_family = AF_INET;
    sin = (struct sockaddr_in *)&arpreq.arp_pa;
    sin->sin_family = AF_INET;
    sin->sin_addr.s_addr = inet_addr(host);
    if (sin->sin_addr.s_addr == -1) {
    hp = gethostbyname(host);
    if (hp == NULL) {
    fprintf(stderr, "%s: %s: unknown host\n",
    argv[0], host);
    exit(1);
    bcopy((char *)hp->h_addr, (char *)&sin->sin_addr,
    sizeof
    (sin->sin_addr));
    if ( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0 )
    perror("can't open datagram socket");
    if (ioctl(sockfd, SIOCGARP, (caddr_t)&arpreq) < 0)
    if (errno == ENXIO)
    printf("%s (%s) -- no entry\n",
    host, inet_ntoa(sin->sin_addr));
    else
    perror("SIOCGARP IOCTL failed");
    exit(1);
    printf("Hostname : %s", host);
    for (i=0; i<6; i++)
    printf("%c%x", i == 0 ? '\t': ':', (unsigned
    char)arpreq.arp_ha.sa_data);
    printf("\n");
    close(sockfd);
    exit(0);
    </pre>

  • Ethernet address setup

    Hi,
    I am trying to configure a network interface
    for IPv4 in Solaris 8.
    I setup the IP address, the broadcast
    address and the Interface flags using
    ioctl commands SIOCSIFADDR,
    SIOCSIFBRDADDR and SIOCSIFNETMASK.
    How do I setup the MAC address (Ethernet address)
    for this interface? Its different from that for
    the rest of the network interfaces in this machine,
    so the default address doesn't work.
    Thanks.

    Hello,
    I, also, am trying to get the ethernet address for a Solaris machine. I have been looking though the Documentation and using ioctl; however, I do not know what flags to use. The main one I have been working with is SIOCGLIFADDR. Moreover, I use lifr_req.lifr_name, hme0. But, when I print the ethernet address one byte at a time as a unsigned char, my results are not the same as the output using ifconfig -a. Does anyone know how to retrieve the ethernet address on a Solaris machine?
    Thank you,
    Larry-0 at Conetic

  • Multiple ethernet addresses vs. IP addresses

    Hi,
    Using Workgroup Manager on SLS 10.6.4, I have successfully mapped hosts and their MAC addresses to fixed IP addresses within our LAN. All is well, until someone works on the back of one of the Mac Pros and ends up plugging the ethernet cable into jack #2 instead of #1. Now the MAC address is unintentionally different.
    I suppose I could make a secondary set of hostnames for ethernet2, but that seems ugly and if you're depending on host foobar being available for a particular printer, but it's now foobar2, that seems unpredictable.
    How do you deal with this? I assume this is in the same realm as having a laptop that connects via wireless one day but via an ethernet cable the next day? It's the same host, just not the same MAC address. Does WGM have a way to deal with multiple ethernet addresses?
    Thanks,
    -- Antoine

    ahh, i see.
    you're running up against a few limitations here.
    bootpd uses MACs to define static mappings.
    OD uses MACs to identify nodes/clients.
    your client machines have multiple MACs and may present one or the other on the network, depending on whether someone plugs in the wrong port.
    here are some options/workarounds off the top of my head:
    1. disable the second interface. if you need it for some reason, you'll have to deal with this situation another way.
    2. bond the two interfaces. the downside is that you'll need to have both plugged in for optimal results, but you'll have one MAC, i believe.
    3. use another dhcp server configured to deny all dhcp requests except those from your approved MACs (en1, let's say).
    4. use local MCX and not deal with changing MACs at all. this is a little more difficult to manage, however.
    5. manage prefs in some other way, like with puppet or casper, that don't strictly depend on MACs.
    i'm sure there are other ways to deal with this situation, but if you're managing these systems, i'd probably just disable the second interfaces. people will learn quickly when they can't access the network. determine if this is more of a technological or a policy/personnel management issue.

  • Yukon: Ethernet and Airport: Ethernet addresses...

    Sorry if this is a stupid question but what is the difference between the Yukon and Airport ethernet addresses?  Are they supposed to be the same or different? Many thanks.

    Hello,
    The first is Ethernet, the second is Wifi or Airport, those are two different interfaces, now as far as addresses go, they have IP addresses, and Hardware Machine Access Code addresses.
    To see them, At the Apple Icon at top left>About this Mac, then click on More Info, then click on Network.
    It can be confusing how the term Ethernet is used.

  • Ethernet address conflict

    So I have been getting the message:
    "The ethernet address you have chosen conflicts with an ethernet address to another computer.
    You can't assign the ethernet address xx:xx:xx:xx:xx:xx to two different computers."
    Of course I use the actual MAC address in place of the x's, but I have searched the entire directory and this MAC address is not in use.
    Now it use to be bound, but was deleted some time ago. I changed its name, to assign it to another lab on campus, and rebound it with this error message. I have a handful of Macs this is happening to. Not sure how to purge or "cleanup" OD. I am sure it needs a good cleaning to clear out its spiderwebs, but flushing OD cache did not help.
    Any advice or references would be most appreciated. I am running 10.5.8 Server on an Xserve.
    Thank you

    Of course I use the actual MAC address in place of the x's, but I have searched the entire directory and this MAC address is not in use.
    I don't understand this statement. The message isn't telling you there is a device in your directory with that IP address, it's telling you that there's a machine on your network that's using the address.
    That device doesn't have to be in your directory, it doesn't have to be using DHCP.. it's just physically connected. Whether it should be, or whether it should have a different IP address is something you'll need to determine.
    Do you know the device it's referring to? The MAC address will map to a physical device. If you don't know which device it is you may be able to wean that information from your switches, which may tell you which port it's connected to (assuming it's a wired ethernet device).

  • Hardware ethernet address

    Hey everyone,
    I'm trying to help a friend set up her wireless printer but I'm having some problems finding the hardware ethernet address for her Photosmart C4780. Does anyone have any advice on where I can look to find this?
    Thanks a lot!

    Do you mean the MAC address (Media Access Control - network device "serial number") or the IP address?
    Both should be on the Network Config Test in the Setup [Scan] > Network area of the printer control panel.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • Acsess ethernet address???urgent

    How to access the ethernet address of a machine?

    Perhaps coul you use the output of ifconfig or ipconfig of the OS and parse it

  • Retrieving ethernet address???

    how to access ethernet address of a machine??

    That is an Network/Socket issue; perhaps post in a more appropriate forum.
    Meanwhile, have a look at the InetAddress APIs.
    Reagrds.

  • Ethernet address on two trunked switches at the same time

    I have two access layer switches sharing a dot1q trunk ( a port channel with four members), and an HP blade server with one connection (a port channel with two members) into each..  The blade server's connections into each switch is also a dot1q trunk tagging just one vlan.  In each connection from the blade server to each switch the mac addresses look very much alike.  I determine this by writing a script to log into both switches at once and run the "show mac add int" command on each port channel to the blade server.  In tcpdumps the commands are sent typically about .1 - .4 seconds apart on average.
    So if the "show mac addr int" command is being run .1 - .4 seconds apart on each switch and have a number of mac addresses in common, would this indicate that these ethernet addresses are flapping in a way that might cause interruptions in packet delivery?  Some are experiencing missed pings.  No VPCs are used in this configuration -  just a pair of either 6509 or 7018 switches connected via a dot1q port channel.

    It sounds to me like what you are trying to achieve is network teaming on the HP Blade Server whereby you can have a connection to two different switches.
    Natively something like this would cause problems because both switchports (or portchannels) would see the same L2 Address which would then confuse upstream switches as they would not know where to forward frames to. I believe the HP servers may allow this type of setup but it requires a specific config on the teaming element to prevent a single MAC address being shown on two different ports.
    Have a read of the whitepaper below:
    http://www.hp.com/sbso/bus_protect/teaming.pdf

  • WLC4402 sends strange ethernet address in snmp reply

    Hello,
    I got a very strange thing with 7.0.250.0 on a WLC 4402 controler. My snmp query receives this entry for one particular wifi client:
    .1.3.6.1.4.1.14179.2.1.4.1.1.68.116.108.115.51.42 "Dtls3*" as ethernet address.
    It is the ascii representation of 44:74:6c:73:33:2a. The expected snmp string is "44:74:6c:73:33:2a".
    Have you already seen this kind of bugs?

    Yes, you are right. Thanks.
    "MAC address entries need to be queried with the SNMP option -O x so that they only return results in HEX."

  • Hiding/spoofing the ethernet-address

    How can one either hide or fake/dummy/spoof the ethernet-address when online? (I.e. the hex-address shown in SystemPreferences->Network->Built-inEthernet:'Ethernet ID'.) Any method, such as Unix commands in Terminal, is fine as long as it works.

    HI
    You may use this program copied from a technote 2856-09 to get MAC address in C. Works fine only if arp cache is present though . It
    does not talk to the driver directly . May be usefull to you. Compile
    with "-lsocket -lnsl" flags.
    <pre>
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/sockio.h>
    #include <sys/socket.h>
    #include <net/if.h>
    #include <net/if_arp.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>
    #include <netdb.h>
    #include <errno.h>
    main(argc, argv)
    int argc;
    char *argv[];
    int sockfd, i;
    struct arpreq arpreq;
    struct sockaddr_in *sin;
    struct hostent *hp;
    char host[256];
    if(argc != 2)
    printf("Usage : %s hostname\n", argv[0]), exit(1);
    strcpy(host, argv[1]);
    bzero(&arpreq, sizeof(struct arpreq));
    arpreq.arp_pa.sa_family = AF_INET;
    sin = (struct sockaddr_in *)&arpreq.arp_pa;
    sin->sin_family = AF_INET;
    sin->sin_addr.s_addr = inet_addr(host);
    if (sin->sin_addr.s_addr == -1) {
    hp = gethostbyname(host);
    if (hp == NULL) {
    fprintf(stderr, "%s: %s: unknown host\n",
    argv[0], host);
    exit(1);
    bcopy((char *)hp->h_addr, (char *)&sin->sin_addr,
    sizeof
    (sin->sin_addr));
    if ( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0 )
    perror("can't open datagram socket");
    if (ioctl(sockfd, SIOCGARP, (caddr_t)&arpreq) < 0)
    if (errno == ENXIO)
    printf("%s (%s) -- no entry\n",
    host, inet_ntoa(sin->sin_addr));
    else
    perror("SIOCGARP IOCTL failed");
    exit(1);
    printf("Hostname : %s", host);
    for (i=0; i<6; i++)
    printf("%c%x", i == 0 ? '\t': ':', (unsigned
    char)arpreq.arp_ha.sa_data);
    printf("\n");
    close(sockfd);
    exit(0);
    </pre>

  • Ethernet address lost after uninstalling Office 2008

    I use AsanteTalk with an Ethernet cable to print to HP printer. Uninstalled Office 2008 and can no longer print. Assumed first it was a Printer/OS X issue and have question in that forum. Have now noticed that there is no longer an Ip address for the built in Ethernet. Unfortunately, uninstalled on 2 laptops, and both can no long print.
    How to recapture the IP address would be very helpful in starting to problem solve this issue.

    Ok, computer finally found it's ethernet address. Still can't print but that could be another issue.

  • Podcast producer ethernet address

    Hi there trying to get podcast producer to work, it runs jobs in xgrid until about 90% then fails when it is trying to post to blogg i noticed that the mac address in my workgroup manager is giving the the WAN port address and not the LAN address i would have thought it needed as i'm running a NAT network. Just wondered is this important? Also what user should you run jobs as? On the BLOGG it says their is a student group but when i go to it, it says 404 no group is hosted on this server????
    Any ideas?

    it turned out to be a problem with not binding the cameras or having mail service started and was running xgrid as the wrong user, i had to use pcastadmin

  • Ethernet MAC address on ipod touch?

    Hi,
    I'm using a iPod Touch 2G (16GB, ordered this summer with a new MacBook Pro), and I'm trying to register the device with my school wireless.
    The form that I have to fill out in order to request wireless access for new devices asks for system type (APPLE-IPOD), OS (IPHONE-OS), and the ethernet and wireless MAC addresses (or "ethernet hardware address"/"wireless hardware address"). These two entries can be found on computers in System Profile/Network, where you can find the MAC addresses for Airport and Ethernet.
    However, I'm not sure what to do in the case of the iPod. I understand that you can find a MAC address in Settings/Network, but this only shows the Airport MAC address, correct? I can't submit the form without including the Ethernet address, and I can't submit using the same MAC address for both Ethernet/wireless. Is there somewhere else I should be looking for this information, or is this an issue that I have to bring up with the IT office directly?
    Your help is greatly appreciated!

    whoops, my mistake--I meant that I'd already found General/About/Settings, but the Wi-Fi address there only indicates the equivalent of the Airport MAC address, correct? Where would I find the equivalent of the Ethernet MAC address? (or if the "Wi-Fi address" on the iPod touch is equivalent to the Ethernet MAC address, what is the wireless MAC address?

Maybe you are looking for

  • Free Goods with Batch Management Activated !!!

    Hi Gurus, I have defined a free goods master data for material on which batch is activated. I have defined the it as with a min of 10 qty 1 free good will be delivered as exclusive item Now as the batch management is active and each batch has 1 qty i

  • Error when trying to patch Crystal Report 10

    Hi, I'm having problem when trying to apply patches on PC running on Windows 7 64bit. Below is the error msg I got: [http://imageshack.us/photo/my-images/845/errorcy.jpg/] It seemed to be something to do with the registry as I was unable to find crys

  • Does erasing my hard drive erase pages, keynote and numbers (bought separately)?

    Hi, I would like to erase my disk, and reinstall it, but i'm afraid i would lose Apps such as pages, numbers and Keynote which i bought in a seperate Cd that i no longer have. Whta happens in the case i erase and reinstall?

  • How to delete the incorrected Functional Location / Equipment

    Dear PM Guru's please let me know the procedure to delete the incorrected functional location / equipment or any other data like plans, orders, task lists etc. i went in change mode and i clicked on Deletion flag and clicked on Set option. when it wi

  • Animation/3D tutorials/resources?

    Hi, I want to learn more about creating 3D animations in Flex 4, but don't know where to start. For example, if I wanted to create a carousel (probably not necessary, because there's so many out there), what would I need to understand? Are there any