1

When alpine linux asks for ipv4 address from dhcp server, it is not sending hostname to dhcp server. So I cant access by server's hostname in LAN. Here is my setup

I am using Alpine Linux 3.12 on my VM (not container), and arch is aarch64.

The router runs openwrt 19.07.3 and BusyBox is v1.31.1

My config:

nodeprealp99:~# cat /etc/network/interfaces 
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
        hostname nodeprealp99 

I also tried with this:

nodeprealp99:~# cat /etc/network/interfaces 
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
        hostname nodeprealp99
        udhcpc_opts -h $HOSTNAME

I appreciate your help

ozkolonur
  • 129
  • 1
  • 4

2 Answers2

0

I have ended up using dhclient, which is also very lightweight

apk add dhclient coreutils

create a config file at /etc/dhcp/dhclient.conf

send host-name = gethostname();
prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, host-name;
require subnet-mask, domain-name-servers;
timeout 60;
retry 60;
reboot 10;
select-timeout 7;
script "/etc/dhclient-script";

lease {
  interface "eth0";
}

and reboot

reboot
ozkolonur
  • 129
  • 1
  • 4
0

@ozkolonur Solution has worked for me. Though it adds another 3-4 MB (doubles the clean OS size)

There is a bug in new ifupdown script (supposed ifupdown-ng new generation!):

ifupdown-ng-0.8.5-r0 x86_64 {ifupdown-ng} (ISC) [installed]

Just remove it and install the good old ifupdown:

apk update
apk del ifupdown-ng
apk add ifupdown
reboot
  • thanks, regarding, "doubles the clean OS size", do you mean doubles the docker image size? In my case I was using Alpine on a VM and my installation was 500Mb+ – ozkolonur Sep 14 '20 at 09:21