基於FS2410的DHCP移植

來源:互聯網
上載者:User

  一、下載源碼
     在http://gd.tuwien.ac.at/infosys/servers/isc/dhcp/ ,選中 dhcp-3.1-ESV-R3.tar.gz。

二、配置、編譯
(1)解壓 tar -zxvf dhcp-3.1-ESV-R3.tar.gz,然後進入./dhcp-3.1-ESV-R3/,
home/dhcp/dhcp-3.1-ESV-R3$
回合組態./configure
home/dhcp/dhcp-3.1-ESV-R3$./configure
之後產生work.linux-2.2檔案夾,進入work.linux-2.2/目錄
home/dhcp/dhcp-3.1-ESV-R3/work.linux-2.2$
輸入make "CC=arm-linux-gnu-gcc -static" (在此靜態編譯,以免發生命令找不到。當然可以動態編譯,只要和你的檔案系統用的庫一致)
home/dhcp/dhcp-3.1-ESV-R3/work.linux-2.2$make "CC=arm-linux-gnu-gcc -static"
將在dhcp-3.1-ESV-R3/work.linux-2.2/client目錄下編譯產生dhclient。

三、移植到開發板
(1)拷貝產生的dhclient到FS2410開發板上,為方便使用,可以放在/usr/bin/或/sbin目錄下;
dhcp-3.1-ESV-R3/work.linux-2.2/client$cp dhclient /rootfs/filesystem/sbin
拷貝另外兩個設定檔到開發板,分別是/dhcp-3.1-ESV-R3/client/dhclient.conf
                                                                      /dhcp-3.1-ESV-R3/client/scripts/linux
到開發板的/sbin/目錄下。並改名後一個檔案為dhclient-script
home/dhcp/dhcp-3.1-ESV-R3/client$cp dhclient.conf /rootfs/filesystem/sbin
home/dhcp/dhcp-3.1-ESV-R3/client/scripts$cp linux /rootfs/filesystem/sbin/dhclient-script
(2)並修改dhclient-script該檔案的第一行#!/bin/bash#!/bin/sh

(3)儲存後修改許可權 rootfs/filesystem$sudo chmod +x /sbin/dhclient*

四、測試
為eth0 或者wlan0配置dhcp服務,輸入dhclient eth0 或者dhclient wlan0 即可,得到如下類似資訊:

eth0:

Listening on LPF/eth0/08:90:90:90:90:90
Sending on   LPF/eth0/08:90:90:90:90:90
Sending on   Socket/fallback
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPNAK from 192.168.1.1
eth0: link down
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
receive_packet failed on eth0: Network is down
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.1.1
DHCPACK from 192.168.1.1
bound to 192.168.1.108 -- renewal in 40380 seconds.

wlan0:

Internet Systems Consortium DHCP Client V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/00:60:b3:01:92:dc
Sending on   LPF/wlan0/00:60:b3:01:92:dc
Sending on   Socket/fallback
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.106 -- renewal in 41564 seconds.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.