본문 바로가기

네트워크

DHCP

DHCP(Dynamic Host Configuration Protocol)
  - 동적으로 IP를 필요로하는 Client에게 IP 정보를 설정해주는 규칙
  - Client가 많을 때 IP 관리, 유지, 문제해결의 편리함을 위해 사용
  - DHCP 서버에 문제가 생기면 모든 client들에 문제가 생김
  - Client의 요청에 대한 인증이 어렵다

  - UDP 67,68 port

 

동작 과정
      Discover
        - client가 broadcast로 DHCP server를 찾아 ip 요청

      Offer
        - DHCP server가 client에게 어떤 ip를 할당 가능한지 제안

     Request
       - client가 server에 해당 ip 할당을 요청

     ACK
      - server가 client에게 ip를 할당

 

설정
(config)# ip dhcp excluded-address  </end address></start address>
  - 제외시킬 ip 범위 설정

(config)# ip dhcp pool </pool name>
  - 범위 이름 설정

(dhcp-config)# default-router 
  - 할당할 게이트웨이 설정

(dhcp-config)# network  
  - 할당할 네트워크 설정

(dhcp-config)# dns-server </ip address>
  - 할당할 dns server ip 설정



DHCP Relay Agent

(config-if)# ip helper-address <dhcp-server ip>
  - DHCP server와 다른 broadcast domain에 있는 client의 요청을 DHCP server에게 중계해줌

 

 

 

 

참고)
APIPA(169.254.0.0/16)
  - 윈도우 기반 운영체재에서 DHCP server로부터 client가 ip를 못받았을 경우 할당 받는 ip


Timestamp(임대 시간)
  T1 : default 12~24시간
  T2 : 재임대 기간 최대 7/8*T1


GARP(Gratuitous ARP)
  - ip 주소 충돌 감지를 위해 사용
  - 호스트에서 자신의 IP 주소를 타겟으로 하여 ARP 요청을 보냈을 때 다른 호스트에서 이에 대한 응답이 있다면

    이미 해당 IP 주소를 사용하고 있는 호스트가 존재하고 있음을 알 수 있음



 


구성도 왼쪽
구성도 오른쪽

 

왼쪽 L3 switch

 

(config)# ip dhcp excluded-address 10.10.10.250 10.10.10.254

(config)# ip dhcp excluded-address 10.10.20.250 10.10.20.254

(config)# ip dhcp excluded-address 10.10.30.250 10.10.30.254

(config)# ip dhcp excluded-address 10.10.40.250 10.10.40.254

 

(config)#  ip dhcp pool dhcp10

(dhcp-config)# network 10.10.10.0 255.255.255.0

(dhcp-config)# default-router 10.10.10.254

(dhcp-config)# exit

 

(config)#  ip dhcp pool dhcp20

(dhcp-config)# network 10.10.20.0 255.255.255.0

(dhcp-config)# default-router 10.10.20.254

(dhcp-config)# exit

 

(config)#  ip dhcp pool dhcp30

(dhcp-config)# network 10.10.30.0 255.255.255.0

(dhcp-config)# default-router 10.10.30.254

(dhcp-config)# exit

 

(config)#  ip dhcp pool dhcp40

(dhcp-config)# network 10.10.40.0 255.255.255.0

(dhcp-config)# default-router 10.10.40.254

(dhcp-config)# exit

 

 

VLAN 30의 16번 노트북

왼쪽 L3 switch를 DHCP server로 사용했을 때 DHCP server에 할당할 ip 범위를 전부 생성 해줘도

다른 broadcast domain에 있는 vlan30, 40의 PC들은 DHCP server까지 요청이 도달하지 못해 ip를 받아올 수 없다

(DHCP server로부터 ip를 할당 받지 못해 APIPA를 받아온 것을 확인)

 

 그렇기 때문에 Client의 요청을 다른 boradcast doamin에 있는 DHCP server에 전달하기 위해

DHCP Relay Agent 설정을 통해 중계 해줄 필요가 있다

 

 

 

오른쪽 L3 switch

(config)# int vlan 30

(config-if)# ip helper-address 10.10.50.1

(config-if)# exit

 

(config)# int vlan 40

(config-if)# ip helper-address 10.10.50.1

(config-if)# exit

 

 

DHCP Relaly Agent를 설정 하면 Client의 요청과 응답을 DHCP server가 unicast로 진행함으로써

ip까지 성공적으로 할당 받을 수 있는 것을 확인할 수 있다

 

VLAN 30 16번 노트북

 

'네트워크' 카테고리의 다른 글

HSRP  (0) 2022.11.29
EtherChannel  (0) 2022.11.28
SVI  (0) 2022.11.24
PVST  (0) 2022.11.23
VLAN  (0) 2022.11.22