Jump to content


Photo

Forcing udhcpc to report STB's hostname

network busybox dhcp dns

  • Please log in to reply
3 replies to this topic

#1 positron

  • Member
  • 29 posts

+1
Neutral

Posted 5 March 2012 - 16:48

This was my previous /etc/network/interfaces file:

# automatically generated by enigma 2
# do NOT change manually!
auto lo
iface lo inet loopback
iface ath0 inet dhcp
pre-up wpa_supplicant -iath0 -c/etc/wpa_supplicant.ath0.conf -B -dd -Dmadwifi || true
pre-down wpa_cli -iath0 terminate || true
auto eth0
iface eth0 inet dhcp
# EOF

When ifup -a is called by /etc/init.d/network while booting it reads /etc/network/interfaces and carries out
(run 'ifup -a -f -n' by hand to see this):

run-parts /etc/network/if-pre-up.d
ifconfig lo 127.0.0.1 up
run-parts /etc/network/if-up.d
run-parts /etc/network/if-pre-up.d
ifconfig eth0 up
udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0
run-parts /etc/network/if-up.d

With this setup the STB's hostname has is not been recognized by any of my routers.
I have added the hostname option for the corresponding interface in /etc/network/interfaces:

# automatically generated by enigma 2
# do NOT change manually!
auto lo
iface lo inet loopback
iface ath0 inet dhcp
pre-up wpa_supplicant -iath0 -c/etc/wpa_supplicant.ath0.conf -B -dd -Dmadwifi || true
pre-down wpa_cli -iath0 terminate || true
auto eth0
iface eth0 inet dhcp
hostname dm8000
# EOF

Now, ifup -a calls udhcpc with hostname option:

run-parts /etc/network/if-pre-up.d
ifconfig lo 127.0.0.1 up
run-parts /etc/network/if-up.d
run-parts /etc/network/if-pre-up.d
ifconfig eth0 up
udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0 -H dm8000
run-parts /etc/network/if-up.d

My router now sees a the STB's hostname and is able to respond dns client requests for hostname dm8000.
But, when I edit interfaces using enigmas network menu, the hostname option will be deleted again.

I propose two solutions:
1. enigma should take the content of /etc/hostname and add it in /etc/network/interfaces when
changes in the network menue are made
or
2. patch/configure busybox to run udhcpc with -h <hostname> by default.

Thank you.

RX: DM7000; DM8000; ET9000 - SW: OpenPli 4.0 - ANT: T90 9°/10°;13°;19°;28° Ost; DVB-T UHF - MS 17/8


Re: Forcing udhcpc to report STB's hostname #2 andyblac

  • Senior Member
  • 465 posts

+18
Neutral

Posted 5 March 2012 - 17:57

i have fixed this in ViX a while ago.

https://www.assembla...c67c821fa15f860

Re: Forcing udhcpc to report STB's hostname #3 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 5 March 2012 - 18:19

1. enigma should take the content of /etc/hostname and add it in /etc/network/interfaces when
changes in the network menue are made


rather not, as that would mean duplicating data in several config files.

2. patch/configure busybox to run udhcpc with -h <hostname> by default.


Indeed, we don't even need to patch it, busybox allows to do this from the defconfig

Re: Forcing udhcpc to report STB's hostname #4 positron

  • Member
  • 29 posts

+1
Neutral

Posted 5 March 2012 - 22:50

Indeed, we don't even need to patch it, busybox allows to do this from the defconfig


Thank you for changing CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -b -H `hostname`"
This keeps things simple and works for me.

For some cases with several NICs and networks it can be useful to have specific per-interface hostnames.
I guess both solutions do not exclude each other. The question is which hostname will be chosen by ifup and new defconfig
when hostnames are also present in the interfaces file.
If /etc/networking/interfaces has hostname records, they are supposed to override the default value from /etc/hostname.
In that case andyblac's patch should also be applied.

I will see when the altered busybox is on the feed.

RX: DM7000; DM8000; ET9000 - SW: OpenPli 4.0 - ANT: T90 9°/10°;13°;19°;28° Ost; DVB-T UHF - MS 17/8






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users