dhcp server 移植记录

  • 这次移植 WIFI ,需要做成 AP 模式,所以,需要移植 dhcp 服务端

  • busybox 里面自带 udhcpd 选项。

  • 打开buildroot , make busybox-menuconfig


  • 这个选上之后,进行 make 编译。

  • 编译完毕之后,发现并没有生成 udhcpd 的软链接,所以手动生成一个

        # 进入生成的文件系统 bin 目录下 ,执行生成软件接
        sudo ln -s busybox  udhcpd
    
  • 配置文件 etc/udhcpd.conf

        # 起始分配的 IP
        start       192.168.5.20
        # 末尾
        end     192.168.5.254
    
        # 指定的连接的节点
        # The interface that udhcpd will use
        interface   ra0
    
        opt dns 192.168.10.2 192.168.10.10    
        option  subnet  255.255.255.0
        opt router  192.168.10.2
        opt wins    192.168.10.10
        option  dns 129.219.13.81   # appended to above DNS servers for a total of 3
        option  domain  local
        option  lease   864000      # default: 10 days
        option  msstaticroutes  10.0.0.0/8 10.127.0.1       # single static route
        option  staticroutes    10.0.0.0/8 10.127.0.1, 10.11.12.0/24 10.11.12.1
        # Arbitrary option in hex form:
        option  0x08    01020304    # option 8: "cookie server IP addr: 1.2.3.4"
    
  • 启动

        touch /var/lib/misc/udhcpd.leases
        udhcpd -f /etc/udhcpd.conf &
    
原文地址:https://www.cnblogs.com/chenfulin5/p/9481249.html