블로그 이미지
사람이 살면서 많은 사람과 부딪치면서 서로 관계를 만들어 갑니다. 좋은 관계이든 나쁜 관계이든 다방면으로 말이죠. 사람이 살면서 필요한 것들을 하나씩 차례로 만들어 나갈 생각입니다. [NOVA]

카테고리

분류 전체보기 (42)
Diary (1)
사진 (0)
자기관리 (0)
대인관계 (0)
컴퓨터 (40)
기타 (1)
Total5,085
Today2
Yesterday28

DHCP서버

컴퓨터/리눅스 / 2010/02/25 07:12

DHCP 설정 및 구축

DHCP(Dynamic Host Configuration Protocol)
서버가 클라이언트에게 IP주소를 할당해주는 서버

DHCP 서버구축에 필요한 패키지
dhcp-version.rpm : dhcp 서버 rpm 패키지

[root@server14 Desktop]# rpm -qa | grep dhcp
dhcp-3.0.3-26

rpm -Uvh dhcp-3.0.3-26.i386.rpm

[root@server14 Desktop]# rpm -ql dhcp
/etc/dhcpd.conf
/etc/rc.d/init.d/dhcpd
/etc/rc.d/init.d/dhcrelay
/etc/sysconfig/dhcpd
/etc/sysconfig/dhcrelay
/usr/bin/omshell
/usr/sbin/dhcpd
/usr/sbin/dhcrelay
/usr/share/doc/dhcp-3.0.3
/usr/share/doc/dhcp-3.0.3/README
/usr/share/doc/dhcp-3.0.3/RELNOTES
/usr/share/doc/dhcp-3.0.3/dhcpd.conf.sample  -> dhcpd.conf 파일이 없으면 이파일을 복사해서 사용한다.
/usr/share/man/man1/omshell.1.gz
/usr/share/man/man5/dhcp-eval.5.gz
/usr/share/man/man5/dhcpd.conf.5.gz
/usr/share/man/man5/dhcpd.leases.5.gz
/usr/share/man/man8/dhcpd.8.gz
/usr/share/man/man8/dhcrelay.8.gz
/var/lib/dhcpd
/var/lib/dhcpd/dhcpd.leases

/etc/dhcpd.conf 파일이 없으면 이파일을 복사해서 사용한다.
cp /usr/share/doc/dhcp-3.0.3/dhcpd.conf.sample /etc/dhcpd.conf

DHCP 환경설정 파일
/usr/share/doc/dhcp-3.0.3/dhcpd.conf.sample
dhcpd.conf 샘플파일

/etc/dhcpd.conf
dhcp 주환경 설정파일

dhcpd.conf
dhcp 주환경설정 파일로 ip주소, 넷마스크, dns주소등을 설정한다.

ddns-update-style interim;
ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0  -> subnet 10.10.0.0 netmask 255.255.0.0
클라이언트에 할당된 네트워크 주소와 넷마스크를 지정한다.

option routers                  192.168.0.1;  ->10.10.0.1
클라이언트에게 할당할 게이트웨이 주소를 지정한다.

option subnet-mask              255.255.255.0;  -> 255.255.0.0
클라이언트에게 할다해줄 네트워크 범위를 지정한다.

option nis-domain               "domain.org";
nis를 사용할 경우 도메인을 입력한다.

option domain-name              "domain.org";
dhcp서버에 도메인이 있을경우 도메인을 입력한다.

option domain-name-servers      192.168.1.1;
클라이언트가 사용할 dns서버 주소를 지정한다.

range dynamic-bootp 192.168.0.128 192.168.0.254;  -> 10.10.64.1 10.10.64.128
클라이언트가 할당 할수 있는 IP주소 범위를 입력한다.

default-lease-time 21600;
클라이언트가 할당 받은 IP주소를 가지고 있을수 있는 시간을 의미한다.

max-lease-time 43200;
할당받은 IP주소를 클라이언트가 가지고 있을수 있는 최대 시간을 의미한다.

DHCP에서 고정IP설정(MAC기반)
host ns : host 다음에 클라이언트 호스트 이름을 지정한다.
next-server marvin.redhat.com;

hardware ethernet 12:34:56:78:AB:CD; : 클라이언트의 ethernet MAC 주소를 입력한다.

fixed-address 207.175.42.254; : 클라이언트 IP주소를 입력한다.

*해당 맥어드레스를 가지고 있으면 지정된 ip를 주겠다는 의미, 특정 클라이언트에 맥어드레스를 이용해 특정 ip부여가 가능하다.
        # 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 207.175.42.254;
        } 
 host ns {
                next-server marvin.redhat.com;
                hardware ethernet 12:34:56:74:AB:CD;
                fixed-address 207.175.42.253;
        }
}

 

DHCP 서버구동
/etc/rc.d/init.d/dhcpd start/stop/restart
service dhcpd start/stop/restart

*dhcp서버는 하나의 네트워크 대역에 하나만 존재한다.

service dhcpd start

netconfig 한후 dhcp로 설정한다.

DHCP설정으로 할당받은 사용자 확인하기
tail -f  /var/lib/dhcpd/dhcpd.lease 에서 어떤 사용자들이 내 dhcp를 가져갔는지 알수 있다.
[root@server100 ~]# tail -f  /var/lib/dhcpd/dhcpd.leases
  next binding state free;
  hardware ethernet 00:14:7c:50:a9:60;
}
lease 10.10.66.114 {
  starts 3 2008/07/30 07:13:20;
  ends 3 2008/07/30 13:13:20;
  binding state active;
  next binding state free;
  hardware ethernet 00:16:76:08:b1:87;
}


클라이언트 컴퓨터
DHCP로 설정하고자 하는 클라이언트 컴퓨터를 netconfig를  통해 dhcp로 설정해 준다.

서비스를 재시작해서 dhcp설정을 적용시킨다.
service network restart

ifconfig 명령으로 적용된 상황을 확인해 본다.
ifconfig

저작자 표시 비영리 변경 금지

'컴퓨터 > 리눅스' 카테고리의 다른 글

JSP설치  (0) 2010/02/25
FTP서버  (0) 2010/02/25
DHCP서버  (0) 2010/02/25
APM설치하기  (0) 2010/02/25
Apache  (0) 2010/02/25
페도라코어7에서 무선랜 bg2200환경설정  (0) 2010/02/25
Posted by [NOVA]
TAG ,

최근에 달린 댓글

최근에 받은 트랙백

글 보관함