BusyBox ifup udhcpc后台运行

本文介绍了如何让BusyBox中的udhcpc服务在后台永久运行的方法。通过在/etc/network/interfaces文件中为udhcpc添加-b参数,可以实现在获取不到IP时自动转为后台运行的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/**********************************************************************
 *              BusyBox ifup udhcpc后台运行
 * 说明:
 *     发现ifup会调用udhcpc,但是并不会切换到后台运行,解决一下。
 *
 *                                  2016-10-11 深圳 南山平山村 曾剑锋
 *********************************************************************/


一、参考文档:
    1. How to get BusyBox udhcpc to run in background forever?
        https://unix.stackexchange.com/questions/267733/how-to-get-busybox-udhcpc-to-run-in-background-forever

二、解决办法:
    1. cat /etc/network/interfaces
        # interface file auto-generated by buildroot
        
        auto lo
        iface lo inet loopback
        
        auto eth0
        iface eth0 inet dhcp
            udhcpc_opts -b          # <------ 添加udhcpc参数
        
    2. 启动输出信息:
        ...
        Starting network: eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=1:01, irq=-1)
        udhcpc: started, v1.26.2
        udhcpc: sending discover
        PHY: 1:01 - Link is Up - 100/Full
        udhcpc: sending discover
        udhcpc: sending discover
        udhcpc: no lease, forking to background
        ...

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值