Giter Club home page Giter Club logo

dhcpforinternetapplication's Introduction

DHCP

需要两台虚拟机分别运行客户端和服务器端,程序中具体的IP地址和网卡需根据实际情况自行修改。可以在ubuntu gcc下编译并运行,包含 DHCP 客户端和服务器端。程序比较简陋,有一些未完成的和处理不太合适的小地方。但其中程序的框架和所用到的数据结构有一定的参考意义。

Overview

Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask and default gateway. RFCs 2131 and 2132 define DHCP as an Internet Engineering Task Force (IETF) standard based on Bootstrap Protocol (BOOTP), a protocol with which DHCP shares many implementation details. DHCP allows hosts to obtain necessary TCP/IP configuration information from a DHCP server.

The goal of the project is to deeply understand the details of DHCP (Dynamic Host Configuration Protocol). And specific goal is as follows:

  • Complete a DHCP server program and run it in one Ubuntu virtual machine.
  • Complete a DHCP client program and run it in another Ubuntu virtual machine.

Requirements Analysis

Environmental Requirements

Operating System

Ubuntu 14.04.5 Server

Programming Language

Linux C language

Configuration Requirements

  • For Client: Netcard “eth1” is for inter network, which does not has IP address.
  • For Server: Netcard “eth1” is for inter network, which IP address is “192.168.0.1”. File “dhcp.config” saves available IP address in pool. “dhcp.lease” saves the IP lease data.

Functional Requirements

  • Support DHCP messages: DHCP operations fall into four phases: sever discovery, IP lease offer, IP lease request and IP lease acknowledgement. All these stages are completed through DHCP messages exchange. Supporting DHCP messages is the most basic requirements for this model.

  • Support DHCP options: DHCP options are variable length octet strings. DHCP options contains special parameters closely related to the process. A DHCP server can provide optional configuration parameters to the client, and a DHCP client can select, manipulate and overwrite these parameters.

  • Four messages during address acquisition can be delivered on broadcast packets: DHCPDICOVER, DHCPOFFER, DHCPREQUEST and DHCPACK are used during address acquisition. Actually, DHCPOFFER and DHCPACK are delivered on unicast packets in usual case, but for simplicity, we assume all these packets are delivered through broadcast.

  • Support DHCP procedures: All the operations in the program should follow the actual procedures in DHCP.

  • DHCP Server functions: Listen to UDP port 67 . For first request, select free IP address from IP address pool and reply to client. For inform request, reply ACK with option value. IP range and value of option s are stored in IP address pool (dhcp.config file ) , Assigned IP, client mac address and time stamp are stored in IP lease pool (dhcp.lease file). Print log message DHCP client functionss.

  • DHCP Client functions: Listen to UDP port 68 . User can specify command line arguments to con trol actions of client program. Print log messages.


Module

  • Client file : dhcpclient.c
  • Server file : dhcpserver.c
  • Common file: dhcp.h
  • Configuration file: dhcp.lease, dhcp.config

dhcpforinternetapplication's People

Contributors

zjwbupt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.