Denys Vlasenko a écrit :
On Fri, Mar 19, 2010 at 2:40 PM, Didier Kryn <[email protected]> wrote:
I am working in the field of Particle Physics and setting up the init
sequence of a group of diskless single board computers (Emerson Network
Power MVME3100). I have made an initramfs with a statically linked busybox
and a collection of scripts.
I want to automate the init process so that it can run in various places
where both the host and the NFS server can take various addresses. Forthe
address of the NFS server, I just put a list in a file in the initramfs. For
the host address I perform a DHCP request and it works well.
There is another thing I would like to do: get the hostname from the
network.
More natural method would be to get hostname via DHCP.
Try to configure your DHCP server to provide hostnames too
in its responses.
Maybe there is a new feature but this is the fist time I read that
DHCP server provide address names. And it does not seem that udhcpc gets it.
Another method is to agree on some fixed formula how to assign
hostnames depending on the IP.
Every network administrator in every institution has his own private
scheme.
Final method is to not bother knowing your own hostname.
It is not really needed unless you are a server.
(And if you are, you don't use DHCP dynamic IP).
I usually set it to "localhost". Technically it's true,
even if I boot with no network at all:
my address is 127.0.0.1, it maps to "localhost",
so obviously I am "localhost". :D
I am an ssh server. And, when typing "ssh somehost.somewhere", I
like to read "somehost" in the prompt. Because there are so many reasons
of mistakes. Imagine you have 2 identical boards in one place and the
all prompt like "localhost".
Once udhcpc has configured eth0, I know the IP address. Then I
issue an nslookup with this address and I expect to find the hostname in the
response. But it does not work and I have to look into my own hand-written
/etc/hosts to get it. The final OS is Debian Lenny.
I recently compiled busybox-1.15.2 to give a try the nslookup appletin
the running Debian environment. There it works. But not in a chroot
containing the same files as my initramfs.
Here is the response in the Debian system:
k...@apcdc4:~$ /busybox-1.15.2/bin/busybox nslookup apcdc4
Server: 134.158.184.54
Address 1: 134.158.184.54 apcdns01.in2p3.fr
Name: apcdc4
Address 1: 134.158.186.184 apcdc4.in2p3.fr
k...@apcdc4:
And in my chroot /busybox-1.15.2:
# nslookup apcdc4
Server: 134.158.184.54
Address 1: 134.158.184.54
nslookup: can't resolve 'apcdc4'
I have copied the following files in the /etc of the chroot: host
host.conf nsswitch.conf services
The executable is exactly the same in both cases and it is statically
linked. There must be some file missing but which one?
It is likely /etc/resolv.conf
In principle, there is always a DNS available through a broadcast
request.
I have copied the /etc/resolv.conf from my normal Debian to the
chroot and it does not help.
strace your nslookup run to find it out for sure.
Yep, I'll try to sort out the strace log.
Thanks.
Didier
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox