DHCP Discovery Program - Need Help With Boot Options

Discussion in 'C++' started by nebloof, Jul 19, 2012.

  1. nebloof

    nebloof New Member

    Joined:
    Jul 19, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    So I wrote this program in C# using sharppcap with the purpose of sending out a custom DHCP discovery packet. The program works. What I need help with is understanding DHCP Options if anyone has experience/knowledge of this.

    I understand what is supposed to go there, but I don't know if there is supposed to be an order to the byte fields or if anything can go in there (according to the DHCP options).

    For instance, I want the DHCP server to return a packet with the subnet mask (option 1), router (option 3), DNS (option 6), and domain name (option 15).

    So in the string I use in the code, I have this (ddcp being a structure): ddcp.DHCP_OPTIONS = "35370103060F";
    This does return data.

    35 = 53 (DHCP Message Type)
    37 = 55 (Parameter Request List)

    And then do I put codes after 37 to get specific data back, such as 01 for Subnet Mask, 06 for DNS, etc...?

    If anyone can shed light on DHCP Options and how to get useful information back, that would be awesome. This seems to work, but I want to get as much information back as possible that would tell me anything/everything about the DHCP server.

    And I don't know if I'm using Message Type correctly. I think a byte code is supposed to go after it, but then the DHCP server doesn't return a packet. If If I remove 35 from the string, I don't get a response. I've tried 350103, but then I don't get any data back in options. I only get a response with my DHCP Options as-is.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice