본문 바로가기
컴퓨터 & IT (Computer & IT)/Linux

[Linux] /etc/dhcp/dhcp.conf (/etc/dhcp.conf – redhat 계열)

by UltraLowTemp-Physics 2020. 7. 6.

  1. 파일 설명: 리눅스 DHCP 데몬의 설정 파일
  2. 주요 설정 항목

N

명령어

의미

1

   range

IP 주소

   클라이언트에 할당할 IP의 범위를 지정한다

2

   range dynamic-bootp

IP주소

   DHCP 클라이언트 뿐만 아니라 BOOTP 클라이언트도 같이 할당한다.

3

   option domain-name

이름

   도메인 이름을 지정한다

4

   option domain-name-servers

IP주소

   네임 서버를 지정한다

5

   option routers

IP주소

   게이트웨이 주소를 지정한다

6

   option broadcast-address

IP주소

   브로드캐스트 주소를 지정한다

7

   option subnet-mask

IP주소

   서브넷 마스크 값 지정

8

   default-lease-time

숫자

   임대 요청 만료시간을 초단위로 지정한다

9

   max-lease-time

숫자

   클라이언트가 IP를 가질 수 있는 최대 시간을 초단위로 지정한다

10

   ddns-update-style

Interim/
none

   마스터 도메인 서버와 슬레이브와의 연계


  3. 파일의 구성

swift
접기
$vim /etc/dhcp.conf
#global parameters //전체에 값 적용
allow booting; //directs DHCP server to respond queries from particular clients
allow bootp; //directs DHCP server to respond bootp queries
#subnet: 네트워크 주소와 넷마스크 주소를 지정하며, 그 외 서브넷 주소를 지정한다.
subnet ip-adress1 netmask ip-address2 { #ip-address1: dhcp 서버의 대역대
range xxx.xxx.xxx.aaa xxx.xxx.xxx.bbb; # range: IP의 할당 대역
option subnet-mask xxx.xxx.xxx.xxx; # 클라이언트에 할당되는 netmask 값
option domain-name “sample.com”; # 클라이언트에 할당되는 도메인 네임
option domain-name-servers xxx.xxx.xxx.xxx; # 클라이언트에 할당되는 도메인 네임 서버의 주소
option routers xxx.xxx.xxx.xxx; # 클라이언트에 할당되는 게이트워에 주소
option time-offset 18000;
option default-lease-time 18000;
host host_name{ #host_name: 고정IP로 사용할 host의 이름 지정
hardware-ethernet FF:FF:FF:FF:FF:FF; #고정IP로 사용할 컴퓨터의 맥주소
fixed-address xxx.xxx.xxx.xxx; #host_name에 할당할 고정IP
filename “pxelinux.0”; #부팅파일로 “pxelinux.0”을 사용함

 

  4. 관련 명령어    

   - ubuntu dhcp 서버 설치 : #sudo apt-get install isc-dhcp-server
   - IP 임대파일 설정: touch /var/lib/dhcp/dhcp.leases
   - 클라이언트에서 동작확인: #cat /var/log/messages or #discover-offer-request-pack
   - 방화벽 설정: /etc/sysconfig/iptables
                 -A INPUT -m state –state NEW -m udp --dport 67:68 -i eth0 -j ACCEPT
   - 서비스 재시작: #sudo service dhcpd restart or $sudo /etc/init.d/isc-dhcp-server restart

 

 

■ Reference:
[1]
http://itwiki.kr/w/리눅스_dhcpd.conf
[2] https://congabba.tistory.com/82
[3]
https://allthatlinux.com/dokuwiki/doku.php?id=dhcp_%EC%84%9C%EB%B2%84_%EA%B5%AC%EC%84%B1
[4] http://www.met.reading.ac.uk/~marc/pxeboot/tftp_server/dhcp/

댓글