Linux (X86) 자료실 - 포기하지 않으면 실패하지 않는다!
Vote Modify Delete Forward Prev Next List

  작성자   : 조성환 [ ladmin ] 추천: 2566, 수정: 7, 조회: 7608, 줄수: 212, 분류: Etc.
dhcp 서버 설정후 서비스 하기

Download Site : http://www.wowunix.com/down/set/dhcp/



아래는 리눅스 서버에 기본으로 제공되는 dhcp 서버 패키지를 가지고 설명드리겠습니다.

(컴파일후에도 동일하게 설정후 데몬 가동하시면 됩니다.)





<<가정>>

dhcp Server : 192.168.1.40/24
dhcp Service Range (range dynamic-bootp) : 192.168.1.200 ~ 192.168.1.254



[root@linux /root]# ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:C0:26:5C:B6:31
         inet addr:192.168.1.40  Bcast:192.168.1.255  Mask:255.255.255.0
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:131007 errors:0 dropped:0 overruns:0 frame:0
         TX packets:111514 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:100
         Interrupt:9 Base address:0xa000




(config 파일)

[root@linux /root]# vi /etc/dhcpd.conf

subnet 192.168.1.0 netmask 255.255.255.0 {
# --- default gateway
       option routers                  192.168.1.1;
       option subnet-mask              255.255.255.0;

       option nis-domain               "wowunix.com";
       option domain-name              "wowunix.com";
       option domain-name-servers      168.126.63.1, 168.126.63.2;

       option time-offset              -5;     # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#       option netbios-node-type 2;

       range dynamic-bootp 192.168.1.200 192.168.1.254;
       default-lease-time 180000;
       max-lease-time 720000;

       # we want the nameserver to appear at a fixed address
       host ns {
               next-server marvin.redhat.com;
               hardware ethernet 12:34:56:78:AB:CD;
               fixed-address 192.168.1.199;
       }
}


#        ddns-update-style none;
       ddns-update-style ad-hoc;



:wq!






(참고)

default-lease-time 180000;
max-lease-time 720000;


에 대해서 설명드리면.......



hardware ethernet 12:34:56:78:AB:CD;
fixed-address 192.168.1.199;

은 특정 dhcp Client 들에게 Static 으로 IP를 할당해주는 방법이다.

예를 들어 ethernet 카드 Mac 주소가 12:34:56:78:AB:CD 을 가진 Client 가 있다면 IP 주소를 192.168.1.199으로 할당한다는 뜻이다.


단, 설정하기 전에 해당 Mac Address 를 알아야 하므로 Mac 주소를 찾아서 넣어주는 것도 좋지만 dhcp 서버에 ping 명령을 한번 준후 dhcp 서버에서 다음과 같이 arp -a 명령을 주면 쉽게 Mac Address 를 찾을수 있다.




(arp 테이블 확인)

[root@linux /root]# arp -a

? (192.168.1.1) at 00:20:ED:11:03:DE [ether] on eth0
? (192.168.1.53) at 00:90:FE:22:1F:2A [ether] on eth0
? (192.168.1.28) at 00:C0:26:71:C2:CB [ether] on eth0



(192.168.1.7번 서버에서 40번 dhcp 서버로 ping test)

kw_hp@root[/root]# ping 192.168.1.40
PING 192.168.1.40: 64 byte packets
64 bytes from 192.168.1.40: icmp_seq=0. time=1. ms
64 bytes from 192.168.1.40: icmp_seq=1. time=0. ms
64 bytes from 192.168.1.40: icmp_seq=2. time=0. ms
64 bytes from 192.168.1.40: icmp_seq=3. time=0. ms
(ctrl+c)



(arp 테이블 재확인)

[root@linux /root]# arp -a

? (192.168.1.1) at 00:20:ED:11:03:DE [ether] on eth0
? (192.168.1.9) at 00:30:6E:48:44:55 [ether] on eth0
? (192.168.1.53) at 00:90:FE:22:1F:2A [ether] on eth0
? (192.168.1.28) at 00:C0:26:71:C2:CB [ether] on eth0



이렇게 하면 00:30:6E:48:44:55 라는 (9번 서버의)  Mac Address 를 쉽게 얻을수 있다.




"ddns-update-style ad-hoc;" 옵션은

dhcp 3.0 버젼 이상부터 생긴 옵션으로 그냥 /etc/dhcpd.conf 파일에 ddns-update-style ad-hoc;
이 라인을 추가해 주시면 됩니다. (이 옵션에 대해서는 잘 모르겠습니다.)

이 옵션이 없을때 데몬실행시 다음과 같은 에러를 보입니다.


#  /usr/sbin/dhcpd

Internet Systems Consortium DHCP Server V3.0.2rc1
Copyright 2004 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

** You must add a global ddns-update-style statement to /etc/dhcpd.conf.
  To get the same behaviour as in 3.0b2pl11 and previous
  versions, add a line that says "ddns-update-style ad-hoc;"
  Please read the dhcpd.conf manual page for more information. **

If you did not get this software from ftp.isc.org, please
get the latest from ftp.isc.org and install that before
requesting help.

If you did get this software from ftp.isc.org and have not
yet read the README, please read it before requesting help.
If you intend to request help from the dhcp-server@isc.org
mailing list, please read the section on the README about
submitting bug reports and requests for help.

Please do not under any circumstances send requests for
help directly to the authors of this software - please
send them to the appropriate mailing list as described in
the README file.

exiting.




반드시 해당 옵션을 넣어주셔야 다음과 같이 dhcpd 데몬이 뜹니다.......



#  /usr/sbin/dhcpd

Internet Software Consortium DHCP Server V3.0pl2
Copyright 1995-2003 Internet Software Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 1 leases to leases file.
Listening on LPF/eth0/00:c0:26:80:ea:9d/192.168.1.0/24
Sending on   LPF/eth0/00:c0:26:80:ea:9d/192.168.1.0/24
Sending on   Socket/fallback/fallback-net



# ps -ef |grep dhcpd
root     22844     1  0 11:38 ?        00:00:00 /usr/sbin/dhcpd
root     22852 22807  0 11:40 pts/3    00:00:00 grep dhcpd




(이상)





이전: Xmanager의 XDMCP를 이용해서 리눅스의 KDE나 GNOME 환경을 사용하려면
다음: 하드웨어 정보 확인하는 명령 (command)
2004/10/14(11:41) from 210.92.85.114
CrazyWWWBoard 2000

Vote Modify Delete Forward Prev Next List
(c) Nobreak Technologies, Inc.