找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 8243|回复: 3

請教udhcpd(DHCP伺服)在2410開發版

[复制链接]
发表于 2009-11-25 19:27:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
本帖最后由 kalowt 于 2009-11-25 20:05 编辑

核心系統是linux(非uclinux)
2410有一個網卡eth0(外網)
我另裝上一個usb有線網卡作為eth1來當dhcp伺服器
  1. # Sample udhcpd configuration file (/etc/udhcpd.conf)

  2. # The start and end of the IP lease block

  3. start                 192.168.2.2        #default: 192.168.0.20
  4. end                192.168.2.254        #default: 192.168.0.254


  5. # The interface that udhcpd will use

  6. interface        eth1  #default: eth0


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

  9. #max_leases        101                #default: 254


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

  15. #remaining        yes                #default: yes


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

  19. #auto_time        7200                #default: 7200 (2 hours)


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

  22. #decline_time        3600                #default: 3600 (1 hour)


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

  25. #conflict_time        3600                #default: 3600 (1 hour)


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

  27. #offer_time        60                #default: 60 (1 minute)

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

  30. #min_lease        60                #defult: 60


  31. # The location of the leases file

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

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

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

  37. #notify_file                                #default: (no script)

  38. #notify_file        dumpleases         # <--- usefull for debugging

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

  40. #siaddr                192.168.0.22                #default: 0.0.0.0

  41. #sname                zorak                        #default: (none)

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

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

  47. #Examles
  48. opt        dns        192.168.2.1
  49. option        subnet        255.255.255.0
  50. opt        router        192.168.2.1
  51. #opt        wins        192.168.2.1
  52. #option        dns        192.168.2.1 168.95.1.1 168.95.192.1        # appened to above DNS servers for a total of 3
  53. #option        domain        local
  54. #option        lease        864000                # 10 days of seconds


  55. ###static_lease    08:08:08:08:27:12       192.168.104.104

  56. # Currently supported options, for more info, see options.c
  57. #opt subnet
  58. #opt timezone
  59. #opt router
  60. #opt timesvr
  61. #opt namesvr
  62. #opt dns
  63. #opt logsvr
  64. #opt cookiesvr
  65. #opt lprsvr
  66. #opt bootsize
  67. #opt domain
  68. #opt swapsvr
  69. #opt rootpath
  70. #opt ipttl
  71. #opt mtu
  72. #opt broadcast
  73. #opt wins
  74. #opt lease
  75. #opt ntpsrv
  76. #opt tftp
  77. #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
routeros
发表于 2011-8-18 20:21:08 | 显示全部楼层
果然是高手
routeros
回复

使用道具 举报

发表于 2011-8-28 09:10:21 | 显示全部楼层
档我想看看合适参考发
routeros
回复

使用道具 举报

发表于 2014-11-29 13:00:36 | 显示全部楼层
绝对的高手 我自己研究下
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-12-22 15:01 , Processed in 0.054683 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表