udhcpc動態獲取ip配置


 

1.配置過程

1.1、配置Linux內核使能DHCP相關選項:
[*]Networking support -->
Networking support
Networking options -->
[*]Packet socket
[*]IP:kernel level autoconfiguration
[*] IP:DHCP support
[*]Network packet filtering framework(Netfilter) --> //下層子選項可不作配置
如下圖:

1.2、配置Busybox,使能以下選項:
Networking Utilities
[*]udhcp server (udhcpd)
[*] dhcprelay
[*] Lease display utility (dumpleases)
[*]udhcp client (udhcpc)
[*] Verify that the offered address is free,using ARP ping
如下圖:

1.3、使用Busybox下的simple.script
進入busybox目錄:busybox1.19.2/example/udhcp/,拷貝文件simple.script到根文件系統的/usr/share/udhcpc/目錄下,更名為default.script,再將default.script中RESOLV_CONF=”/etc/resolv.conf”更改為RESOLV_CONF=”/tmp/resolv.conf”。
(說明:由於測試使用Cramfs文件系統,etc目錄不可寫,運行udhcpc無法在/etc目錄下創建resolv.conf文件。)

1.4、拷貝工具
重新編譯安裝busybox,將安裝文件拷至根文件系統目錄,運行udhcpc即可動態獲取IP。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM