Kulim13 / alt-f

Automatically exported from code.google.com/p/alt-f
0 stars 0 forks source link

Request: Add hostname to dhcp client request #133

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As it is now Alt-F 0.1RC2 does not send its own hostname with dhcp request. 
Thus, my local nameserver does not have enough information to combine any 
hostname to the IP it gives.

Adding option "hostname <hostname>" along with other options in 
/etc/network/interfaces will fix the problem.

Original issue reported on code.google.com by huru_u...@hotmail.com on 23 Feb 2013 at 10:27

GoogleCodeExporter commented 9 years ago
Can you please post /etc/network/interfaces with your changes?

Original comment by whoami.j...@gmail.com on 23 Feb 2013 at 3:50

GoogleCodeExporter commented 9 years ago
Find below entire contents of my /etc/network/interfaces. The last line is my 
doing device's hostname being "lato".

--

# cat /etc/network/interfaces 
auto lo
  iface lo inet loopback

auto eth0
iface eth0 inet dhcp
  client udhcpc
  mtu 1500
  hostname lato

Original comment by huru_u...@hotmail.com on 24 Feb 2013 at 5:30

GoogleCodeExporter commented 9 years ago
It might work for you, but I get a warning from udhcpc, regarding the "-H 
<hostname>" option.
I might have to patch busybox networking/ifupdown.c

I don't have any problem with DHCP, and I think to remember that it used to be 
practice to send the hostname do the DHCP server, but most servers now don't 
require this anymore (using MAC?). What server are you using?

Thanks,

Current state:

PID   USER     COMMAND
...
 1045 root     udhcpc -R -n -p /var/run/udhcpc.eth0.pid -i eth0
...

~ # ifup eth0
udhcpc (v1.20.2) started
udhcpc: Deconfiguring eth0
Sending discover...
eth0: link up, 1000 Mb/s, full duplex, flow control disabled
Sending discover...
Sending select for 192.168.1.76...
Lease of 192.168.1.76 obtained, lease time 86400
udhcpc: udhcpc environment:
udhcpc:    router=192.168.1.254
udhcpc:    subnet=255.255.255.0
udhcpc:    METHOD=dhcp
udhcpc:    MODE=start
udhcpc:    domain=homenet
udhcpc:    PHASE=pre-up
udhcpc:    interface=eth0
udhcpc:    dns=192.168.1.254
udhcpc:    IF_MTU=1500
udhcpc:    ADDRFAM=inet
udhcpc:    serverid=192.168.1.254
udhcpc:    IF_CLIENT=udhcpc
udhcpc:    PATH=/sbin:/usr/sbin:/bin:/usr/bin
udhcpc:    ip=192.168.1.76
udhcpc:    lease=86400
udhcpc:    mask=24
udhcpc:    IFACE=eth0
udhcpc:    PWD=/root
udhcpc:    opt53=05
udhcpc: Updating /etc/hosts
udhcpc: Updating /etc/httpd.conf
udhcpc: Updating /etc/samba/smb.conf
udhcpc: Updating default route
route: SIOCDELRT: No such process
udhcpc: Updating /etc/resolv.conf
udhcpc: adding dns 192.168.1.254

**** After adding "hostname nas" to the dhcp stanza,

~ # ifup eth0
udhcpc: option -h NAME is deprecated, use -x hostname:NAME
udhcpc (v1.20.2) started
udhcpc: Deconfiguring eth0
Sending discover...
eth0: link up, 1000 Mb/s, full duplex, flow control disabled
Sending discover...
Sending select for 192.168.1.76...
Lease of 192.168.1.76 obtained, lease time 86400
udhcpc: udhcpc environment:
udhcpc:    router=192.168.1.254
udhcpc:    subnet=255.255.255.0
udhcpc:    METHOD=dhcp
udhcpc:    MODE=start
udhcpc:    domain=homenet
udhcpc:    PHASE=pre-up
udhcpc:    interface=eth0
udhcpc:    dns=192.168.1.254
udhcpc:    IF_MTU=1500
udhcpc:    ADDRFAM=inet
udhcpc:    serverid=192.168.1.254
udhcpc:    IF_CLIENT=udhcpc
udhcpc:    PATH=/sbin:/usr/sbin:/bin:/usr/bin
udhcpc:    IF_HOSTNAME=nas
udhcpc:    ip=192.168.1.76
udhcpc:    lease=86400
udhcpc:    mask=24
udhcpc:    IFACE=eth0
udhcpc:    PWD=/root
udhcpc:    opt53=05
udhcpc: Updating /etc/hosts
udhcpc: Updating /etc/httpd.conf
udhcpc: Updating /etc/samba/smb.conf
udhcpc: Updating default route
route: SIOCDELRT: No such process
udhcpc: Updating /etc/resolv.conf
udhcpc: adding dns 192.168.1.254

PID   USER     COMMAND
...
 1189 root     udhcpc -R -n -p /var/run/udhcpc.eth0.pid -i eth0 -H nas

Original comment by whoami.j...@gmail.com on 24 Feb 2013 at 8:00

GoogleCodeExporter commented 9 years ago
I was not aware of the warning but it seems to work for the moment at least. 
Apparently they have changed something at udhcpd.

My broadband modem acts as both DHCP server and name server. It's probably 
busybox and dnsmasq there for what I know. The name server adds an entry for 
each DHCP client that provides a name. That's why the client must send its 
name. It's all dynamic this way, I have no static nameserver entries at all.

I am bit puzzled how the server might guess clients' names otherwise. I checked 
my Linux Mint /etc/dhcp/dhclient.conf and it has the following line there:
send host-name = gethostname();

I am inclined to think that clients sending their name is the standard 
behaviour still.

Br

Original comment by huru_u...@hotmail.com on 24 Feb 2013 at 11:13

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2138.

Original comment by whoami.j...@gmail.com on 25 Feb 2013 at 12:53

GoogleCodeExporter commented 9 years ago
You are right.

Closed by svn commit 2138: /etc/network/interface: make dhcp stanza contain the 
hostname. Closes issue 133.

I still have to test it.

Original comment by whoami.j...@gmail.com on 25 Feb 2013 at 12:58