作者 主題: 請教udhcpd(DHCP伺服)在2410開發版  (閱讀 6575 次)

0 會員 與 1 訪客 正在閱讀本文。

kalowt

  • 可愛的小學生
  • *
  • 文章數: 16
    • 檢視個人資料
請教udhcpd(DHCP伺服)在2410開發版
« 於: 2009-11-25 18:47 »
核心系統是linux(非uclinux)
2410有一個網卡eth0(外網)
我另裝上一個usb有線網卡作為eth1來當dhcp伺服器
代碼: [選擇]
# Sample udhcpd configuration file (/etc/udhcpd.conf)

# The start and end of the IP lease block

start                 192.168.2.2        #default: 192.168.0.20
end                192.168.2.254        #default: 192.168.0.254


# The interface that udhcpd will use

interface        eth1  #default: eth0


# The maximim number of leases (includes addressesd reserved
# by OFFER's, DECLINE's, and ARP conficts

#max_leases        101                #default: 254


# If remaining is true (default), udhcpd will store the time
# remaining for each lease in the udhcpd leases file. This is
# for embedded systems that cannot keep time between reboots.
# If you set remaining to no, the absolute time that the lease
# expires at will be stored in the dhcpd.leases file.

#remaining        yes                #default: yes


# The time period at which udhcpd will write out a dhcpd.leases
# file. If this is 0, udhcpd will never automatically write a
# lease file. (specified in seconds)

#auto_time        7200                #default: 7200 (2 hours)


# The amount of time that an IP will be reserved (leased) for if a
# DHCP decline message is received (seconds).

#decline_time        3600                #default: 3600 (1 hour)


# The amount of time that an IP will be reserved (leased) for if an
# ARP conflct occurs. (seconds

#conflict_time        3600                #default: 3600 (1 hour)


# How long an offered address is reserved (leased) in seconds

#offer_time        60                #default: 60 (1 minute)

# If a lease to be given is below this value, the full lease time is
# instead used (seconds).

#min_lease        60                #defult: 60


# The location of the leases file

lease_file        /usr/local/etc/udhcpd.leases        #defualt: /var/lib/misc/udhcpd.leases

# The location of the pid file
#pidfile        /var/run/udhcpd.pid        #default: /var/run/udhcpd.pid

# Everytime udhcpd writes a leases file, the below script will be called.
# Useful for writing the lease file to flash every few hours.

#notify_file                                #default: (no script)

#notify_file        dumpleases         # <--- usefull for debugging

# The following are bootp specific options, setable by udhcpd.

#siaddr                192.168.0.22                #default: 0.0.0.0

#sname                zorak                        #default: (none)

#boot_file        /var/nfs_root                #default: (none)

# The remainer of options are DHCP options and can be specifed with the
# keyword 'opt' or 'option'. If an option can take multiple items, such
# as the dns option, they can be listed on the same line, or multiple
# lines. The only option with a default is 'lease'.

#Examles
opt        dns        192.168.2.1
option        subnet        255.255.255.0
opt        router        192.168.2.1
#opt        wins        192.168.2.1
#option        dns        192.168.2.1 168.95.1.1 168.95.192.1        # appened to above DNS servers for a total of 3
#option        domain        local
#option        lease        864000                # 10 days of seconds


###static_lease    08:08:08:08:27:12       192.168.104.104

# Currently supported options, for more info, see options.c
#opt subnet
#opt timezone
#opt router
#opt timesvr
#opt namesvr
#opt dns
#opt logsvr
#opt cookiesvr
#opt lprsvr
#opt bootsize
#opt domain
#opt swapsvr
#opt rootpath
#opt ipttl
#opt mtu
#opt broadcast
#opt wins
#opt lease
#opt ntpsrv
#opt tftp
#opt bootfile
第一次啟動dhcp,eth1的網卡ip是設定成192.168.2.1(在/etc/rc.d/rc.inet1.conf改)確定動起來後,dhcp設定檔如上
我的dhcp啟動指令是/usr/sbin/udhcpd -fS /usr/local/etc/udhcpd.eth1.conf
ok~~dhcp功能可以正常配給WINXP電腦網卡(IP和DNS都設定自動取得)得到192.168.2.2
目前很正常
問題來了
我現在把eth1網卡ip是設定成192.168.3.1(在/etc/rc.d/rc.inet1.conf改),/etc/rc.d/rc.inet1 restart確定動起來後,dhcp設定檔把192.168.2.....都改成了192.168.3.....
我先關掉dhcp指令是killall udhcpd,/etc/rc.d/rc.inet1 restart確定動起來後,然後一樣啟動dhcp指令是/usr/sbin/udhcpd -fS /usr/local/etc/udhcpd.eth1.conf
但在winxp電腦網卡(IP和DNS都設定自動取得)按右鍵選"修復"卻不能得到192.168.3.2~192.168.3.254的IP,而是出現Windows無法完成修復這個問題, : 因為無法完成下列動作:更新您的IP位址
而我試過一些ip分享器產品或adsl數據機開dhcp功能可以修復成功得到ip說,所以覺得是不是哪裡有問題?
而且發現如果真要得到ip,要把開發版手動撥開關重開機(不能reboot),或是在winxp電腦網卡按右鍵停用=>啟用,以上兩種方法可以取得ip
« 上次編輯: 2009-11-25 20:05 由 kalowt »

mjabe

  • 憂鬱的高中生
  • ***
  • 文章數: 194
    • 檢視個人資料
    • http://home.so-net.net.tw/michtw
回覆: 請教udhcpd(DHCP伺服)在2410開發版
« 回覆 #1 於: 2009-12-11 12:22 »
你的 Windows XP 端可能要
$  ipconfig reset
吧 !