个人工具

UbuntuHelp:UbuntuLTSP/StaticIPsWithDHCP

来自Ubuntu中文

跳转至: 导航, 搜索
This page is specific to Ubuntu versions 8.04, 8.10

If you find this information applicable to additional versions/releases, please edit this page and modify this header to reflect that. Please also include any necessary modifications for this information to apply to the additional versions.


Introduction

This page describes two different ways to setup static IPs for LTSP clients, assuming you have a DHCP server. This may be needed if you want LTSP clients to be assigned IPs and hostnames in a specific order.

  • You will need to obtain the MAC address of each machine that requires to be bootable on the LTSP server. This can be achieved by asking the specified machine to try to boot from LAN. A message will appear, similar to the following
CLIENT MAC ADDR: 00 0C 29 76 88 21  GUID: 234D234D-B4CC-6CEF-0EBD554566345

Static IPs with dhcpd.conf

The recommented way to assign static IPs is by appending host declarations to /etc/ltsp/dhcpd.conf:

host client201 {
	hardware ethernet 08:00:27:89:70:01;
	fixed-address 192.168.0.201;
}

Static IPs with pxelinux.cfg

For PXE or gPXE clients, you may also assign static IPs by creating /var/lib/tftpboot/ltsp/arch/pxelinux.cfg/01-mac-address configuration files. This could be useful if you don't have complete control over the DHCP server, or if your DHCP server doesn't support static IP entries. When a PXE client boots, it loads and executes /var/lib/tftpboot/ltsp/arch/pxelinux.0, which then displays some messages similar to the following:

PXE entry point found (we hope) at 9AE5:00D6
My IP address seems to be C0A80146 192.168.1.70
TFTP prefix:
Trying to load: pxelinux.cfg/01-00-14-22-a1-53-85
Trying to load: pxelinux.cfg/C0A80146
Trying to load: pxelinux.cfg/C0A8014
Trying to load: pxelinux.cfg/C0A801
Trying to load: pxelinux.cfg/C0A80
Trying to load: pxelinux.cfg/C0A8
Trying to load: pxelinux.cfg/C0A
Trying to load: pxelinux.cfg/C0
Trying to load: pxelinux.cfg/C
Trying to load: pxelinux.cfg/default

What happens is that pxelinux.0 tries to load a client-specific configuration file. First it tries with the client MAC address, prefixed with its ARP type code - 01 for Ethernet. If that fails, it tries with the hexadecimal notation of its IP address, and goes on by removing a hex digit for each failure. Ultimately, it tries to load a file named default. So for a client with MAC address 00:14:22:A1:53:85, copy default to 01-00-14-22-a1-53-85 and open the later for editing. It should contain something like

DEFAULT vmlinuz ro initrd=initrd.img

To force the client to use a specific IP, you'd need to modify it to

DEFAULT vmlinuz ro initrd=initrd.img ip=192.168.0.101:192.168.0.10:192.168.0.1:255.255.255.0:client101:eth0:none
# ip=<client-ip>:<server-ip>:<gateway>:<subnet mask>:<client-hostname>:<interface>:<configuration-method>

The IP would be passed as a kernel parameter to vmlinuz, and the klibc ipconfig application in the initramfs would use it. That means that the client would probably use a different IP than the one provided at the PXE boot stage. Your DHCP server will not be aware of the IPs you assign with this method, so they should be outside of any DHCP pools. Furthermore, ipconfig won't be given a boot-filename DHCP option, and the init scripts won't be able to work out the correct tftp path. So if you need to use an lts.conf file, you should put it in /var/lib/tftpboot instead of /var/lib/tftpboot/ltsp/arch/. This method does not work for older Etherboot clients, because they load nbi.img instead of pxelinux.0. In some cases though, you may succeed by changing the filename directive in /etc/ltsp/dhcpd.conf to specify that Etherboot clients also load pxelinux.0.

Hostnames

In either method, you may append the client hostnames to /etc/hosts for DNS resolving:

192.168.0.101	ltsp101
192.168.0.102	ltsp102
...

See Also

  • UbuntuLTSP - Community Ubuntu LTSP Documentation.

External Links

  • PXELinux - PXELinux documentation.
  • gPXE - gPXE is a network bootloader that evolved from the Etherboot project.
  • ipconfig - The initramfs ipconfig application README file.