DHCP: Two Methods for dynamically obtaining ip addresses on the resolution board

Source: Internet
Author: User

DHCP
The Dynamic Host Configuration Protocol (DHCP) is a LAN network Protocol that uses UDP for two purposes:
1. automatically assign IP addresses to internal network or network service providers
2. provide users with internal network administrators as central management means for all computers.

Method 1: dhclient
1. Download
Https://www.isc.org/software/dhcp/
2. Extract
Tar-zxvf dhcp-3.1.3.tar.gz
3. Configuration
Cddhcp-3.1.3
./Configure
The work. linux-2.2 folder is generated after success.
4. Compile
Make "CC =/opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/usr/bin/arm-hismall-linux-gcc-static"
Can be in the work. linux-2.2/client Directory, or in the dhcp-3.1.3 directory make,
5. Copy
Compile dhclient in work. linux-2.2 \ client.
Copy profile dhcp-3.1.3/client/dhclient. conf and/dhcp-3.1.3/client/scripts/linux to the/sbin/directory of the Development Board, and rename the linux File to dhclient-script, and modify the first line of the file #! /Bin/bash is #! /Bin/sh. After saving, modify the chmod + x/sbin/dhclient-script permission.
6. Create a directory
Mkdir-p/var/state/dhcp
Create the state directory under the/var directory, and then create the dhcp directory under the state directory.
7. Run
Dhclient ra0
Result:

Copy codeThe Code is as follows: InternetSystems Consortium DHCP Client V3.1.3
The Copyright2004-2009 Internet Systems Consortium.
Allrights reserved.
Forinfo, please visit https://www.isc.org/software/dhcp/
Listeningon LPF/ra0/7c: dd: 90: 25: 9f: a9
Sendingon LPF/ra0/7c: dd: 90: 25: 9f: a9
Sendingon Socket/fallback
DHCPDISCOVERon ra0 to Protocol 255.255.255 port 67 interval 6
DHCPDISCOVERon ra0 to 255.255.255.255 port 67 interval 12
DHCPDISCOVERon ra0 to Protocol 255.255.255 port 67 interval 14
DHCPOFFERfrom 192.168.1.1
DHCPREQUESTon ra0 to route 255.255 port 67
DHCPACKfrom 192.168.1.1
Bound to 192.168.1.31 -- renewal in 282261 seconds.

Method 2: udhcpc
Udhcpc is a very small DHCP Client for embedded systems, abbreviated as micro-DHCP-client (μdhcpc ).
1. udhcpc-I eth0
Udhcpc just gets an IP, We Need To \ busybox-1.1.2 \ examples \ udhcp under the script simple. script is renamed as default. script, which is placed in the/usr/share/dhcpc/directory on the Development Board. Only the obtained IP address can be written to the specified Nic.
2. ifconfig

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.