Does anybody know if there is an API to configure the ip address of an interface?

Discussion in 'Linux Networking' started by bighead_csu, May 24, 2006.

  1. bighead_csu

    bighead_csu Guest

    I got the linux kernel source, but can't find a function to set ip
    address. Who can give me a hand, thanks!
     
    bighead_csu, May 24, 2006
    #1
    1. Advertisements

  2. Any reason you don't want to use ifconfig?

    crt
     
    Claude R Trepanier, May 24, 2006
    #2
    1. Advertisements

  3. Why don't you look at the source code of ifconfig ?
    Davide
     
    Davide Bianchi, May 24, 2006
    #3
  4. bighead_csu

    Tauno Voipio Guest

    There are ioctl() calls to do that, but if you need to ask,
    you probably should not attempt to do it.
     
    Tauno Voipio, May 24, 2006
    #4
  5. bighead_csu

    alchemist Guest

    Check out the ioctls() - SIOCSIFADDR, SIOCSIFNETMASK and
    SIOCSIFBRDADDR. Also you might need a sequence in which these ioctls
    needs to be executed. You will need root permissions to execute these
    ioctls.

    Another quick way to find which systems calls are made is via using
    'strace' on 'ifconfig eth* <IP> <netmask> <bcast'.

    -Shailesh.
     
    alchemist, May 26, 2006
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.