DHCP mini-HOWTO

Vladimir Vuksan

         vuksan@veus.hr
      

�������: ��������� ��������, SWSoft Pte Ltd.

������� ���������
������� v4.10July 3, 2000��� ���������: vv

� ���� ��������� ������ ������ �� ������� ����������� ��� ��������� DHCP-������� � DHCP-������� �� Linux.


����������
1. ��������
1.1. ���������������
1.2. ����� ������ ����� ���������
1.3. �������� �����
1.4. ���������
1.5. Copyright Information
1.6. ��������� �����
2. �������� DHCP
3. ��������� �������
3.1. ��� ����� ������ (dhcpcd)
3.2. Slackware
3.3. RedHat 6.x � Mandrake 6.x
3.4. RedHat 5.x
3.5. RedHat 4.x � Caldera OpenLinux 1.1/1.2
3.6. Debian
3.7. LinuxPPC � MkLinux
3.8. �������������� ���
3.9. ���������
3.10. �������� �������� � �� �������
3.10.1. � ��� �� ��������� ������� �����
3.10.2. DHCP-������ ������������ RFC 1541 / DHCP-������ ��� Windows NT
3.10.3. �� ����� �������� ���������� ��������� "Using DHCP for eth0 ... failed" (������������� DHCP ��� eth0 : �� ��������), ������ ������� �������� ���������
3.10.4. ���� �������� ��������� �����, � ����� ��������� ��������
3.10.5. ������� ����� ������������ �� ����� ��������, �� � ������� ������ ��������� "NO DHCPOFFER" (� ���� PCMCIA �����)
3.10.6. DHCP-������ ������ �������, �� ����� �� �������� (�������� ����� Peter Amstutz)
3.10.7. � �������� ��� ����������, �� ������ ��� ��� �� � ����
3.10.8. � ���� ���������� ������ MediaOne Express, � � ��-�������� �� ���� ������������ � ����
3.11. �������������� DHCP-������ (ISC dhclient)
4. ��������� DHCP-�������
4.1. DHCP-������ ��� UNIX
4.2. ��������� DHCP-�������
4.3. ����� DHCPd
4.4. ������ �������
4.5. ������ ���������� ���������

1. ��������

1.1. ���������������

����� �� ����� ������� ��������������� �� ���������� ����� ���������. ����������� �������, ������� � ��. �� ��� ����� � ����. ��� ����� ������� ��������� - ��� ����� ��������� ������ � �����������, �������, ������� ��, ����� ��������� ���� �������. �, ���� ��� ������������, ���-���� ���������� � �������������. � �� ���� ������� ��������������� �� ���.

������ �����, ��� ��� �� ����������� ����������. �������� �������� ����� �������������, ���������� �� ����� ������ �����. ����������� ������ ���������� �� ���� ����� � ����.


1.2. ����� ������ ����� ���������

����� ������ �������� �� ������

http://www.oswg.org/oswg-nightly/DHCP.html

������� ��������� �������� DHCP mini-HOWTO:

����� ���� ���������� ��������� ���� �������� �� ������ ����. � ������ ������ ��������� ��� ������� ������ �� �������� � ������� ��� URL, ����� � ��� ������� ��� � ���� ���������.


1.3. �������� �����

���� ��������� ������ ��������������. ��� ������ ������� ����� ��������� � �� ������������ ��. ��� ��� ����� ���� ����������, ����������� � ������� �� ������ .


1.4. ���������

���� �������� ������������� �� �������� ������ ����� �������.

��������� ���� ������������� ��������� ����� mini-HOWTO.

  • Heiko Schlittermann

  • Jonathan Smith

  • Dan Khabaza

  • Hal Sadofsky

  • Henrik Stoerner

  • Paul Rossington

  • � ������ ������


1.5. Copyright Information

This document is copyrighted (c) 1998 Vladimir Vuksan and distributed under the terms of the OpenContent License (OPL). Full text of the license can be found at

http://www.opencontent.org/opl.shtml


1.6. ��������� �����

��������� ����� �� ������� ������� ����� ������ ����������� (c) 2000 SWSoft Pte Ltd. ��� ����� ���������������.

���� �������� �������� ������ ������� Linux HOWTO.

��������� ����� �� ��������� Linux HOWTO ����������� �� �������, ���� ���� �� ������� ����. ��������� Linux HOWTO, � ����� �� ��������, ����� ���� �������������� � �������������� ��������� ��� �������� �� ����� �������� ���������� ��� �����������, ��� ������� ���������� ���� ������� �� ��������� ������ �� ���� ������. ������������ ��������������� ����������� � ����������; �� ��� ��� ����� ����� ������ � ����� �������� ������ �� ����� � ����� �������������.

��� �������� � ����������� ������, ����������� �� ���������� Linux HOWTO ������ �������������� ���� �������� �� ��������� ������. ��� �������� � ����� �������������� ������� ��������� �������������� ����������� �� ��������������� ���������� HOWTO. ���������� ����� ��������� ������ ��������� ������������ ���������� � ������������ Linux HOWTO � ������� ����� ��������� �� ������ ������������ ����.

�� �� ������ �������������� ��� ���������� �� ���� ��������� �������. �� ��� ���� ��������� ��������� ����� � ���� ������������� � ���� ������ ��������������� HOWTO. ���� � ��� �������� �������, ����������, ���������� � ������������ ������� Linux HOWTO �� ����������� �����: , ��� � ������������ �������� �������� Linux HOWTO �������� SWSoft Pte Ltd. �� ������


2. �������� DHCP

DHCP - ��� Dynamic Host Configuration Protocol (�������� ������������ ������������ �����). �� ������������ ��� ��������� ����� ���������� ������� ���������� ����� (��������) � ������� �������. DHCP ��������� ��������� � BOOTP. ��� �������������� ���������� ��. RFC 2131 (RFC 1541) � ��. (��. ������ "������� Internet" � ����� ����� ���������). ������ ����� �������� http://web.syr.edu/~jmwobus/comfaqs/dhcp.faq.html.

���� ����-HOWTO ��������� ������������� ��� DHCP-�������, ��� � DHCP-�������. ����������� ����� ����� DHCP-������, ������� ��������� �� ������� �������� ��� ��������� ���������� c �������. DHCP-������ ��������� ��������������� ���� ��� �������� ���������� DHCP-��������. ��� ���, ���� �� ������� ������������, �� ��� ����� DHCP-������.


3. ��������� �������

� ��������� ������ ���������� ��� ��������� DHCP-������� ��� Linux: dhcpcd, pump � dhclient. ���� ����-HOWTO ��������� ������ � dhcpcd.


3.1. ��� ����� ������ (dhcpcd)

�� ������ ������� DHCP-������, ��������������� ��� ������ ������������. ���� �� ������ ������� ��� �� �������� �������, �� ��� ����� ����� dhcpcd 1.3.18. ��� ���������� Sergei Viznyuk , � � ������ ������ �� ���� � ������� ���� � ����������� �� �������������.

�������� ������ dhcpcd ����� ���� ������� �

����� �������� ������������� �����������.


3.2. Slackware

�� ������ ������� ��������� ������ DHCPcd � ������ ������� Metalab:

�������� ��������� ������ dhcpcd.tar.gz.

  • �������������� ��

    tar -zxvf dhcpcd-1.3.18pl1.tar.gz

  • ������� � ������� � �������� dhcpcd

    cd dhcpcd-1.3.18pl1

    make

  • ������������� (�� ������ ��������� ��������� �������, ������ root-��)

    make install

��� ������� ������� /etc/dhcpc, � ������� DHCPcd ������ ����������, � ���� dhcpcd ����� ���������� � /usr/sbin.

���� �� ������ ���������������� �������, ��������� DHCP �� ����� ��������, ��������:

cd /etc/rc.d

mv rc.inet1 rc.inet1.OLD

��� ����������� ������ ���� ������������� ���� � rc.inet1.OLD. ��� ����� ������� ����� ������ rc.inet1. ��������� ��� - ��, ��� ��� �����:

#!/bin/sh
#
# rc.inet1      ������, ����������� ������� ���������.

HOSTNAME=`cat /etc/HOSTNAME` # �������� ��� � �� �����,
                             # �� � ��� ����� �������

# �������������� ��������� �������� �����.
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo

# ���� � ��� ���� ����, ��������� ������ ����������� ��������� eth0.
# ���� � ��� ������ �������� ����� ��� SLIP-���������, �� ���������������
# ��������� ������.

/usr/sbin/dhcpcd

�������� ���� � ������������� �������.

����� ���������, ���������� � ��������������� ����.


3.3. RedHat 6.x � Mandrake 6.x

��� RedHat 6.0+ ��������� DHCPcd ����� ������. ��� ��� ��� �����, ��� ��������� ������ ����������, ������ control-panel.

  • �������� "Network Configuration" (������������ ����)

  • ������� �� "Interfaces" (����������)

  • ������� "Add" (��������)

  • �������� Ethernet

  • � "Edit Ethernet/Bus Interface" �������� "Activate interface at boot time" (������������ ��������� �� ����� ��������) � �������� "DHCP" � �������� "Interface configuration protocol" (�������� ������������ ����������).

�������, ��� � RedHat 6.x ������ dhcpcd �� ��������� ��������������� DHCP-������ pump. CD-ROM �������� RPM-����� dhcpcd, ��� ��� ���� ��� �� ������� ��������� pump, �� ������ ����������� ���������� dhcpcd (����. ����� rpm -i dhcpcd-1.3.17pl2-1.i386.rpm) � ������ ��������� ���������.

Alexander Stevenson ������������� �������:

� ���� �� ���������� � DHCPcd. ��, ��� � ����� ������ ����������, ��� "pump", ������� ������������ ������ � Linux Mandrake 6.0 (� �����, ��� � RedHat ����). � ����������� �������:

pump -i eth0 -h hostname

��� "hostname" �� ����� ��������, ������ ��� ���� ������ �� ��������.

����� � �������������� ������� ������� � ������� /sbin/ifup, �.�. ��� �� ��������� ����� -h � ���� �� ��������.

������, ���� �� ����������� linuxconf, � ������������ ������� �� "DHCP", ��� ���� �� ��������. ���������� �������� -h hostname � ������ � pump � ������� /sbin/ifup. ������ ��� ������ ��������:

...
if [ -n "$PUMP" ]; then
    echo -n "Determining IP information for $DEVICE..."
    if /sbin/pump -i $DEVICE -h hostname; then
        echo " done."
    else
        echo " failed."
        exit 1
    fi
else ...

��� ���. ������������� ������ � �������� /sbin/ifup eth0 � ��������� ������.


3.4. RedHat 5.x

��� RedHat 5.0+ ��������� DHCPcd ����� ������. ��� ��� ��� �����, ��� ��������� ������ ����������, ������ control-panel.

  • �������� "Network Configuration" (������������ ����)

  • ������� �� "Interfaces" (����������)

  • ������� "Add" (��������)

  • �������� Ethernet

  • � "Edit Ethernet/Bus Interface" �������� "Activate interface at boot time" (������������ ��������� �� ����� ��������) � �������� "DHCP" � �������� "Interface configuration protocol" (�������� ������������ ����������).

When you are finished go the last step.


3.5. RedHat 4.x � Caldera OpenLinux 1.1/1.2

DHCPcd ���������� � ����������� ����������� RedHat ��� RPM-�����, ��� ��� �� ������ ����� � ����� ������������ � �������� RPMS ��� �� ������:

ftp://ftp.redhat.com/pub/redhat/redhat-4.2/i386/RedHat/RPMS/dhcpcd-0.6-2.i386.rpm

���������� ��� �������� - rpm -i dhcpcd-0.6-2.i386.rpm.

����� ����, �� ������ ���� �������������� ���, ������ �����, ��������� � Slackware.

��������� ���������� ��� ����������� .

�� ����� /etc/resolv.conf � ����� ��� ����������� ����� � ��� ������. ������, ������� ������ � "search" � ��� ������ � "nameserver" (�� ����� �� ������� dhcpcd �� ������� ���� /etc/dhcpc/resolv.conf, ��� ��� � ��������� ���������� ���� /etc/resolv.conf).

� /etc/sysconfig/network � ������ ��������� HOSTNAME � GATEWAY, � ������ ������� ��� ���� (NETWORKING, DOMAINNAME, GATEWAYDEV).

� /etc/sysconfig/network-scripts/ifcfg-eth0 � ����� IPADDR, NETMASK, NETWORK, � BROADCAST, � DEVICE � ONBOOT ������� ��� ����. ������ � BOOTPROTO ������� �� BOOTPROTO=dhcp.

�������� ����. � ������������ ���������.

����� ���������, ���������� � ��������������� ����.


3.6. Debian

������� deb-����� DHCPcd ��������� �� ������:

http://ftp.debian.org/debian/dists/slink/main/binary-i386/net/

���, ������ ��������� ����������� �� Slackware.

����� ��������� ����� �������� dpkg -i /where/ever/your/debian/packages/are/dhcpcd*deb.

�����������, ��� ������ ������ ����������� �� ����, �.�.:

 

����� dhcpcd ������������� ������ �������� � /etc/init.d/dhcpcd, ������� ��������� �� ��������� �������� /etc/rc?.d/.

 
--��: Heiko Schlittermann  

���������� ��������� /etc/rc?.d/ ����������� �� ����� ��������.

���� ����� ����������� �� �� ���������������, �� �� ������ ��������� dhcpd �������: /etc/init.d/dhcpcd start.

����� ���������, ���������� � ��������������� ����.


3.7. LinuxPPC � MkLinux

��������� ������ ������� R. Shapiro

�� ������ ���������� "1999" (R5), Linuxppc ������ ����� ��������� ��������� � Redhat, ������ � ����� ���������� (��. ����). � ����� ������, ���������� �������� ����� �����, ��� � � RedHat 6.x � Mandrake 6.x.

���������� ���������� ��� ����, ��� RedHat 6 ���������� 'pump' � �������� �������, � 'pump' �� ����� ������ �������� ��� Linuxppc. ����� ������ ���, �� ������ ��������� ��������� ������ dhcpcd (Sergei Viznyuk) � ��������������� /sbin/ifup �� ������������� dhcpd ������ pump.

��������

if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
     PUMP=true
 fi

 if [ -n "$PUMP" ]; then

��

 if [  "$BOOTPROTO" = bootp ]; then
       echo " done."
     else
       echo " failed."
       exit 1
     fi
 elif [ "$BOOTPROTO" = dhcp ]; then
     echo -n "Determining IP information for $DEVICE..."
     if /sbin/dhcpcd -d $DEVICE ; then
       if [ -f /etc/dhcpc/dhcpcd-${DEVICE}.exe ]; then
           /etc/dhcpc/dhcpcd-${DEVICE}.exe
       fi

� �������������� �������� ifdown. ��������

if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
....
fi

��

if [ "$BOOTPROTO" = bootp ]; then
fi

if [ "$BOOTPROTO" = dhcp ]; then
      if [ -f /var/run/dhcpcd-${DEVICE}.pid ]; then
              kill `cat /var/run/dhcpcd-${DEVICE}.pid`
              rm -f /var/run/dhcpcd-${DEVICE}.pid
      fi
fi

������� ppc rpm ��� dhcpcd ������� � ����������� Linuxppc 1999; ������� ����� ������� rpm �������� � �������� contrib �� ftp://ftp.linuxppc.org/. �������� ������, ������������� ��� Linuxppc 1999, ��������� �� ftp://ftp.phystech.com/pub/dhcpcd-1.3.17-pl9.tar.gz.


3.8. �������������� ���

����� ���� ��� �� ������������� ������, ��� ����� ��������� ������� ���������. ��������: ifconfig.

�� �������� �������������� ���������:

          lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Bcast:127.255.255.255  Mask:255.0.0.0
          UP BROADCAST LOOPBACK RUNNING  MTU:3584  Metric:1
          RX packets:302 errors:0 dropped:0 overruns:0 frame:0
          TX packets:302 errors:0 dropped:0 overruns:0 carrier:0 coll:0

eth0      Link encap:Ethernet  HWaddr 00:20:AF:EE:05:45
          inet addr:24.128.53.102  Bcast:24.128.53.255  Mask:255.255.254.0
          ^^^^^^^^^^^^^^^^^^^^^^^
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:24783 errors:1 dropped:1 overruns:0 frame:1
          TX packets:11598 errors:0 dropped:0 overruns:0 carrier:0 coll:96
          Interrupt:10 Base address:0x300

���� � ��� ���������� ���������� ����� inet addr, ��� ������ ���������. ���� �� ������ 0.0.0.0, �� ������������ - ��� ��������� ��������, ���������� dhcpcd, ����� ���, ��� �� ������� ���������� �����. ���� � ������� ���������� ����� �� ��-�������� ������ 0.0.0.0, ��. ������ �������� �������� � �� �������. DHCPcd �������� ����������, ���� �������� ������. ������ ��� ���� �� ����������� � DHCP-�������� � �������� �������� ������������� ����������� ������. ��� ���� �� ���������� ��� ��������� � ������ syslog (�� Slackware /var/adm/syslog, RedHat/OpenLinux /var/log/syslog).

� �������. ��� ����� ������� DNS-������. �������� ��� ��������: �� ������ ������ ����� DNS-������� � ������ ���������� � ��������� ��� � /etc/resolv.conf; ��� �� DHCPcd ��� ������� ������ �� DHCP-������� � ������� ���� resolv.conf � ������� /etc/dhcpc.

� ����� ������������ resolv.conf, ����������� DHCPcd, ������ ���������:

��������� ������ /etc/resolv.conf: mv /etc/resolv.conf /etc/resolv.conf.OLD

���� ������� /etc/dhcpc �� ����������, ������� ���: mkdir /etc/dhcpc

����� ������ �� /etc/dhcpc/resolv.conf � /etc/resolv.conf: ln -s /etc/dhcpc/resolv.conf /etc/resolv.conf

���� ��� �� ���������, ���������� ��������� (����������� ��������� � ��������� ��������� �� Henrik Stoerner):

���� ��� � ������ ������� ������ � ��� ������, ���� dhcpcd �� ������� ���� /etc/dhcpc/resolv.conf. � ������� /etc/sysconfig/network-scripts/ifup � ������ ��������� ��������� (����� �����, �� ��������):

elif [ "$BOOTPROTO" = dhcp -a "$ISALIAS" = no ]; then
    echo -n "Using DHCP for ${DEVICE}... "
    /sbin/dhcpcd -c /etc/sysconfig/network-scripts/ifdhcpc-done ${DEVICE}
    echo "echo \$$ > /var/run/dhcp-wait-${DEVICE}.pid; exec sleep 30" | sh

    if [ -f /var/run/dhcp-wait-${DEVICE}.pid ]; then
	^^^^
        echo "failed."
        exit 1

� ������� ��:

elif [ "$BOOTPROTO" = dhcp -a "$ISALIAS" = no ]; then
    echo -n "Using DHCP for ${DEVICE}... "
    /sbin/dhcpcd
    echo "echo \$$ > /var/run/dhcp-wait-${DEVICE}.pid; exec sleep 30" | sh

    if [ ! -f /var/run/dhcp-wait-${DEVICE}.pid ]; then
	^^^^^^
       echo "failed."
       exit 1

���������

�������� �������� �� ! (��������������� ����) � ��������� if [ ! -f /var/run/dhcp-wait-${DEVICE}.pid ];

������ ������ ���������� �� ������ ����� � ������������ :-).


3.9. ���������

��������� ���(�) ����� ����������, �� �� ����� ������������ ������ ���������:

  1. ���� �� ������ ����� ��������� ������ � ����, ��������� dhcpcd �� ��������� ������ (��� ����� ����� ���� root): /usr/sbin/dhcpcd.

    ��� ���������� �� ����, �������� /usr/sbin/dhcpcd -k.


3.10. �������� �������� � �� �������

���� �� ��������� ������������� ����, � ������ � ���� ��� � �� ���������, �� ����� ���������� ��������� ���������� �����:


3.10.1. � ��� �� ��������� ������� �����

�� ����� �������� �������� Linux �������� ���������� ��� ����� ����� � ������� ���-�� ����� �����:

eth0: 3c509 at 0x300 tag 1, 10baseT port, address  00 20 af ee 11 11, IRQ 10.
3c509.c:1.07 6/15/95 becker@cesdis.gsfc.nasa.gov

���� ������� ��������� �����������, Linux �� ����� ���������� ��� ����� �����. ���� � ��� ������� Ethernet ����� (���� NE2000), �� ������ ��������� ����� ��� ������ ������ ��� DOS, ������������ �� ����� � ����������. ���������� ������ IRQ (9,10,12) �� ��� ���, ���� Linux �� ��������� �����.


3.10.2. DHCP-������ ������������ RFC 1541 / DHCP-������ ��� Windows NT

���������� ��������� dhcpcd, ������ ������� dhcpcd -r.

��������� ��������� �������� ���������� ����� ifconfig (��������� ��������� ������, ���� ���������� ������� ������������, ������� Inet.addr ����� ���� ����� 0.0.0.0)

���� �������� �����������, �������� ���� "-r" � ������ ��������.

�������� �� RedHat �������������� ������ /etc/sysconfig/network-scripts/ifup, ������� ���������:

        IFNAME=$[ {DEVICE} \
        "/sbin/dhcpcd -r -c /etc/"- � �.�. � �.�.

3.10.3. �� ����� �������� ���������� ��������� "Using DHCP for eth0 ... failed" (������������� DHCP ��� eth0 : �� ��������), ������ ������� �������� ���������

������ ����� �� ��������� � RedHat, � �� ����� ����������� ��������� ����������� :-). �� ���������� ��������������� ���� � ����� �� �������� ����������. ��������� ���� � �������� ��������������� �����������.


3.10.4. ���� �������� ��������� �����, � ����� ��������� ��������

�� ��������� ����������, gated (������ ������) �������� ������������� �� Linux �������, ��� �������� � ������������� ��������. ���������, ������� �� gated: ps -auxww | grep gate.

���� ��� ���, ������� ���, ��������������� RPM ��� ����� ���� �� /etc/rc.d/.


3.10.5. ������� ����� ������������ �� ����� ��������, �� � ������� ������ ��������� "NO DHCPOFFER" (� ���� PCMCIA �����)

��� ����� ���������, ��� �� ����� ������� ����� ����������� ���� 10BaseT ("����������" ������). ����� ����� ��������� �� ����� ���� ��������� ���� ������� ����� �� ����� ��������:

eth0: 3c509 at 0x300 tag 1, 10baseT port, address  00 20 af ee 11 11, IRQ 10.
		            ^^^^^^^^^^^^
3c509.c:1.07 6/15/95 becker@cesdis.gsfc.nasa.gov

� ������� ��������� �� ������������� ����������� �����������, � ������� ���������� ����� �������� ��-�� ������ PCMCIA, ��������������� ��� ������� �� 10Base2 (������ Ethernet). �� ������ ���������, ��� ����������� ��� ���������� 10BaseT. ���� ���, ��������� ������� ����� � ���������������.


3.10.6. DHCP-������ ������ �������, �� ����� �� �������� (�������� ����� Peter Amstutz)

�� ��������� �������� � DHCP-������ ����� �������� ��� ������. � ������ � dhcpcd, ��� �������� ������ -h foohost. � �������� ���������, ������ ����� ��������� ������� ��� ������������ � ����.


3.10.7. � �������� ��� ����������, �� ������ ��� ��� �� � ����

��������� ����� ������ ���������� Ethernet-����� ����� ������� �����, ��� ���, ���� �� ���������� ����� ��������� ��� �������� ������� �����, ��� ����� ���-������ ��������� ��������� ����� ���������� ����� ���������/�����. ������ ��� ����� ���������� ��������� ����� � ����� �������� ��� ��� ���������� ����������, ��� ��������� � ������ ����������� ��������� � ������� ��, ��� �� ������� ����� � ����� ����������.

���� � ��� ���������� Firewall (������� ipfwadm), ��������� �������� �� ������ � ������ 67/68, ������� ���������� DHCP.


3.10.8. � ���� ���������� ������ MediaOne Express, � � ��-�������� �� ���� ������������ � ����

�����������, � DHCP MediaOne ���������� ��������� ����, ������� ��� �� ������ ����. ������ �� ��� �� ������ �������� �������, �� �� ������ �� ���������. ���� �� (��)���������� ���������� Windows NT, ������ ��������� Event Viewer �� ������� �������� ����� ��������������:

DHCP received an unknown option 067 of length 005. The raw option data is
given  below.

0000: 62 61 73 69 63            basic

���� ��� �������� ��������, �������� �������� ������ ��� ������� ��������� c ftp://vanbuer.ddns.org/pub/.


3.11. �������������� DHCP-������ (ISC dhclient)

���� ��� �� ������� �������� ������ � dhcpcd, �� ������ ����������� ISC dhclient. �� ���� ������ � ������������� ISC DHCP, ������� �������� � DHCP-������ � DHCP-������. ����������, ��� ������� ����������� ISC DHCP, ����� ���� ������� �����. ����� ���������, ��������� � ���� ������ ��� ��������� �������.

���������

��������� ���������� ����������� Ted Lemon <>, ���� �� ������� dhclient.

� ������� ������ DHCP-������� ��� �� ����� ���� �� ����� ���� dhclient.conf. ���, ��� ��� ����� �������, ��� ������ ��������� dhclient: /sbin/dhclient.

��� ���� ���������� ��� ��������� ����������. ���� ����� �� ��������� ��� �� ������ ��������� ������ ���� ���������, �������� /etc/dhclient.conf � �������� ����� �������������:

interface "eth0" {
  send dhcp-client-identifier 1:xx:xx:xx:xx:xx:xx;
  send dhcp-lease-time 86400;
}

����� ������������ ��������� eth0 (���� ��� ����� ������, �� �������������� �������� eth0). �������� xx:xx:xx:xx:xx �� Ethernet-����� �����. ��� ������ dhclient ������ ������� �� ������ Win95.


4. ��������� DHCP-�������

4.1. DHCP-������ ��� UNIX

���������� ��������� ��������� DHCP-�������� ��� Unix � ������������, � ����������. �������� ���������� ��������� Paul Vixie/ISC DHCPd. ��������� ������ 2.0 (��� ����������� �������������) ��� ����-������ 3.0 �� ������ ����� �� ������

ftp://ftp.isc.org/isc/dhcp/

��������� ������������ ������������� ������� ����� dhcpd, ��� ��� �� ������ ���������� ���� ������, ���� �� � ��� ����.

�������� � �������������� ���. ����� ����� ��������� � ������� � ��������� �������� � ��������: ./configure

����� ����, ��� ���������� ��������� �� ���� �������, ��������: make � make install.


4.2. ��������� DHCP-�������

����� ��������� ���������� �������� ifconfig -a. �� ������� �������� ���������:

eth0      Link encap:10Mbps Ethernet  HWaddr 00:C0:4F:D3:C4:62
          inet addr:183.217.19.43  Bcast:183.217.19.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2875542 errors:0 dropped:0 overruns:0
          TX packets:218647 errors:0 dropped:0 overruns:0
          Interrupt:11 Base address:0x210

���� � ��������� �� ����� ����� MULITICAST, �� ������ ����������� ���� � ���������� ��������������. �� ����������� ������ ��� ��� ��������.

��������� ����� ����� ���������� ������������� �� 255.255.255.255. ������ �� DHCPd README:

"����� dhcpd ������� � ������������ DHCP-��������� (����. Windows 95), �� ������ ����� ����������� �������� ������ �� IP-������ 255.255.255.255. � ���������, Linux ���������� 255.255.255.255 � �������� ������ �������� �� ���� ��������� ���� (� ��� ��� 192.5.5.223). ��� �������� � ������� � ��������� DHCP, �� ������� ������ DHCP-������� �� �������� ��������, ���� ��������� (�������� ��� DHCP-������ Microsoft) ��� �� ��������. �������, ������� ��� ��������, �� ����� ��������� ������� DHCPOFFER."

��������: route add -host 255.255.255.255 dev eth0

���� �������� ��������� "255.255.255.255: Unknown host", ��� ����� �������� ��������� ������ � ���� /etc/hosts file:

255.255.255.255 all-ones

����� �����������:

route add -host all-ones dev eth0

���

route add 255.255.255.0 dev eth0

��� eth0 - ���, ������� ��, ��� ����� ������� �����.


4.3. ����� DHCPd

������ ��� ���� ��������� DHCPd. ����� ��� �������, ��� ����� ������� ��� ��������������� ���� /etc/dhcpd.conf. ���������� ����� ����������� ��������� kcmdhcpd ��� dhcpd ��� KDE ( http://www.kde.org/ ), ������� ���������� ������������� DHCP ��� Windows NT. ����� ������ KDE 2.0, ��� ������ ���� ������ � kcmdhcpd, ��� �� ������ ������ ��� ��������������� �:

ftp://ftp.us.kde.org/pub/kde/unstable/apps/network/

���� �� ������ ��������� ��� �������, �������� ������������� �����������.

� ����������� ������� ��� ����� ��������� ��������� IP ������. ��� ����� ���� ������� ��� ������ ��������� ���������:

# ������ /etc/dhcpd.conf
# (�������� ���� ����������� �����)
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.org";

subnet 192.168.1.0 netmask 255.255.255.0 {
   range 192.168.1.10 192.168.1.100;
   range 192.168.1.150 192.168.1.200;
}

� ���������� ����� DHCP-������ ������ �������� IP-������ �� ��������� 192.168.1.10-192.168.1.100 ��� 192.168.1.150-192.168.1.200. ���� ������ �� ����������� ��������� �����, ������ ������ ����� �� 600 ������. � ��������� ������, ����������� ��������� ����� ����� ����������� � 7200 ������. ������ ����� ����� "����������" ������� ������������ 255.255.255.0 � �������� ����� �������, 192.168.1.255 ��� �������� ������� (broadcast), 192.168.1.254 � �������� ��������������/����� � 192.168.1.1 � 192.168.1.2 ��� DNS-�������.

���� �� ������ ������� WINS-������ ��� �������� � Windows, ��� ����� �������� �����:

option netbios-name-servers 192.168.1.1;

�� ������ ����� ������� IP-�����, ����������� �� ������ ������� �����:

host haagen {
   hardware ethernet 08:00:2b:4c:59:23;
   fixed-address 192.168.1.222;
}

��� ���� ������� ����� � ������� 08:00:2b:4c:59:23 ����� ����������� IP-����� 192.168.1.222.

�� ������ ����� ��������� � �������� ���������. ��������, �� ������ ������ ������������ �������� (�������� ��������) "�����������" IP-�����, � ������ ������������ ����� (�������� ������������� � ������������ ������������). ����� ���� ���������� ��������� ������ ��������, ����� ��� ����� NIS-�������, ������� ������� ������� � �.�. ���� ��� ����� ����� ���������, ���������� ����������� �� dhcpd.conf.


4.4. ������ �������

����� �������� ������� ��� ����� ������� ������ ���� ����. � ����������� ������� ��� ����������� �� ��������� ���� dhcpd.leases. �� ����� DHCPd ��� �������� ���������� � ������� ���������� ������� � ������������ �� ���� ������� ��������� ����, ������� ����� ���������� �� ����� ������ DHCPd. ����� ������� ��� ��������:

touch /var/state/dhcp/dhcpd.leases

��������� ������ ���� (�������� �������). ��������� ������ (<2.0) ������ dhcpd ������ ���� ���� � /etc/dhcpd.leases. ��� �� ����� �������� ���� dhcpd.leases - ��� ������ ��� dhcpd. ���� ��� ��� �������� ��������� ������, ��� �� ��� ����������, ������ ����������� �� � ���������� � ���������� ����.

������ �� ������ ��������� DHCP-������. ������ �������� (��� �������� � ������ ��������)

/usr/sbin/dhcpd

��� ��� dhcpd ���������� �� ���������� eth0. ���� �� ������ ��������� ��� �� ������ ������� �����, ������ �������

/usr/sbin/dhcpd eth1

����� ���������, ��� ��� �������� ���������, �� ������ �������� ����� �������:

/usr/sbin/dhcpd -d -f

����� �������� ������ �� ����� ��������, �� ������� ��������� ��������� ���������� ���������. ���� ��� �������� ���������, �� �� ���� �� ������ ��������� :-). ������� �� dhcpd � ��������� ��� ��� ���������� -d -f. ���� �� ������ ��������� dhcpd �� ����� �������� �������, �������� dhcpd �������� � ������

/etc/rc.d/rc.local

4.5. ������ ���������� ���������

� ���������� Linux Magazine ���� ������� ������, ������� ���������� Network Nirvana: How to make Network Configuration as easy as DHCP, ������� ��������� ��������� DHCP.




������:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
�������:

�������� �� �����
���������� �� ���������
Created 1996-2026 by Maxim Chirkov
��������, ����������, ����������