Udhcpc - Alpine Linux
Udhcpc - Alpine Linux
Udhcpc - Alpine Linux
org/wiki/Udhcpc
Udhcpc
This material needs expanding ...
Please help us expand this article by contributing.
You may want to customize the behavior of the default DHCP client (udhcpc from busybox), which is called by /sbin/ifup by having
"dhcp" in /etc/network/interfaces.
Entries in /etc/network/interfaces for DHCP interfaces will drive the udhcpc command line. For example:
auto eth0
iface eth0 inet dhcp
hostname myhostname
-i eth0 -x hostname:myhostname
The hostname will send the DHCP option to the server to tell the server the name of this client.
The documentation for udhcpc can be found in the busybox udhcpc readme file (https://udhcp.busybox.net/README.udhcpc)
You can add arbitrary command line parameters to the udhcpc_opts setting in /etc/network/interfaces. See the example of
udhcpc_opts in the main networking article.
RESOLV_CONF /etc/resolv.conf no ; NO ; -
Example /etc/udhcpc/udhcpc.conf:
Custom scripts can be added as /etc/udhcpc/pre-* and /etc/udhcpc/post-* to be run before/after deconfig/renew/bound DHCP
events. They must be set as executable by root, e.g. chmod 744
As an example, /etc/udhcpc/post-bound/mtu could contain, to change the interface MTU from the default (1500) to 1492, which is
useful if on ADSL that uses PPPoE (https://en.wikipedia.org/wiki/Maximum_transmission_unit) (which uses 8 bytes for its own header):
Hack alert: I needed to restart my firewall (which replaces the iptables script from Alpine) when the client binds to a new IP, so I added
1 av 2 2022-01-22 18:13
Udhcpc - Alpine Linux https://wiki.alpinelinux.org/wiki/Udhcpc
/etc/init.d/iptables reload
The reload drops all firewall rules, re-acquires the Internal and external IPs, and re-writes the rules. I'm sure there is a better way.
2 av 2 2022-01-22 18:13