Find the answer to your Linux question:
Results 1 to 5 of 5
Hello, i have to implement dhcp client application in my centos 6.5 embedded system. how to configure the kernel for dhcp client ? how to get dhcp event (callbacks?) such ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2013
    Posts
    9

    dhcp client


    Hello,
    i have to implement dhcp client application in my centos 6.5 embedded system. how to configure the kernel for dhcp client ?
    how to get dhcp event (callbacks?) such as new liecense/expiry etc.?
    Thanks

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    652
    The dhcp client in not in the kernel. A client (such as dhcpcd, dhclient, etc) is used. DHCP talks at the UDP level and is a broadcast on onep port and replies are sent back to the machine on a second port. The "mac address" is included in the response so that the client knows that it was directed to it. It is also legal to recieve more than one offer and the client gets to chose the one that is accepted. The interaction is commonly refererred as DORA (for Discovery (client to sever), Offer (server to client), Request (client to server), and Acknowledge (server to client). The Discovery is a request to get an IP assigned. The Offer is an offer for an IP address (not an assigment). The Request is asking the server for the offered IP address (not the server may have given this to someone else in the mean time). The Acknowledgment is the "You have been assigned the IP address that you requested.

  3. #3
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    947
    This article should help, check out the Client section.

    https://www.linux.com/learn/docs/ldp/483-DHCP#AEN74

  4. #4
    Just Joined!
    Join Date
    Oct 2013
    Posts
    9
    Thanks you both alf55 and docbop,
    i cannot activate DHCP via shell commands but from my C program.
    is there a way to activate DHCP other than to wrap these shell commands with 'exec' call ?
    maybe ioctl , netlink, other ?
    Avi.

  5. #5
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    652
    The most coomon commands to get a DHCP assignment are:
    • dhclient
    • dhcpcd

    Code:
    dhclient -nw -4 eth0
    
    dhcpcd -n eth0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •