[DHCP] Option 82


Trong mạng metro hoặc mạng doanh nghiệp cỡ lớn, DHCP option 82 (relay agent option) được dùng để cung cấp thêm thông tin nhận diện client theo vị trí (thay vì dùng MAC). Ví dụ: PC1 kết nối với ALS1 qua cổng F0/5. Định dạng của Option 82 như sau:

RFC 3046 chỉ định nghĩa 1 cặp sub-option: “remote-id” (ID 0×2)“circuit-id” (ID 0×01). Hai giá trị này dùng để nhận diện thiết bị và cổng đã nhận bản tin DHCP request. Chú ý: tùy theo version IOS, thiết bị Cisco sử dụng sub-option 0x6 thay cho 0x1 để nhận diện circuit-id.

Trong ví dụ này, chúng ta sẽ dùng Option 82 để xác định khoảng địa chỉ IP cấp phát cho PC1 và PC2.

1.Cấu hình trên ALS1: Option 82 được bật khi cấu hình DHCP snooping

ALS1#show running-config | begin ip dhcp snooping 

ip dhcp snooping vlan 333     

ip dhcp snooping

ALS1#show ip dhcp snooping

Switch DHCP snooping is enabled

DHCP snooping is configured on following VLANs:

333

DHCP snooping is operational on following VLANs:

333

DHCP snooping is configured on the following L3 Interfaces:

 

Insertion of option 82 is enabled

   circuit-id format: vlan-mod-port

    remote-id format: MAC       //sử dụng Base ethernet MAC Address

Option 82 on untrusted port is not allowed

Verification of hwaddr field is enabled

Verification of giaddr field is enabled

DHCP snooping trust/rate is configured on the following Interfaces:

 

Interface                    Trusted     Rate limit (pps)

————————     ——-     —————-

FastEthernet0/13             yes         unlimited

ALS1#show running-config interface f0/13

interface FastEthernet0/13

 switchport trunk encapsulation dot1q

 switchport mode trunk

 switchport nonegotiate

 ip dhcp snooping trust

Cấu hình circuit-id trên cổng F0/5 và F0/24

ALS1#show running-config interface f0/5

interface FastEthernet0/5

 switchport access vlan 333

 switchport mode access

 ip dhcp snooping vlan 333 information option format-type circuit-id string group1

ALS1#show running-config interface f0/24

interface FastEthernet0/24

 switchport access vlan 333

 switchport mode access

 ip dhcp snooping vlan 333 information option format-type circuit-id string group2

Bật debug trên ALS1

ALS1#debug ip dhcp snooping packet

DHCP Snooping Packet debugging is on

Và cho PC1 xin cấp địa chỉ IP:

*Mar  4 23:02:52.512: DHCP_SNOOPING: received new DHCP packet from input interface (FastEthernet0/5)

ALS1#02:52.512: DHCP_SNOOPING: add relay information option.

*Mar  4 23:02:52.512: DHCP_SNOOPING_SW: Encoding opt82 CID in string format

*Mar  4 23:02:52.512: DHCP_SNOOPING_SW: Encoding opt82 RID in MAC address format

*Mar  4 23:02:52.512: DHCP_SNOOPING: binary dump of relay info option, length: 22 data:

0x52 0x14 0x1 0x8 0x1 0x6 0x67 0x72 0x6F 0x75 0x70 0x31 0x2 0x8 0x0 0x6 0x0 0x14 0x69 0xC3 0xCC 0x0

*Mar  4 23:02:54.776: DHCP_SNOOPING: binary dump of extracted circuit id, length: 10 data:

0x1 0x8 0x1 0x6 0x67 0x72 0x6F 0x75 0x70 0x31     // theo bảng mã ASCII, “group1”= 0x67 0x72 0x6F 0x75 0x70 0x31

*Mar  4 23:02:54.776: DHCP_SNOOPING: binary dump of extracted remote id, length: 10 data:

0x2 0x8 0x0 0x6 0x0 0x14 0x69 0xC3 0xCC 0x0     // 0x0 0x14 0x69 0xC3 0xCC 0x0= base ethernet MAC address của ALS1

Cho PC2 xin cấp địa chỉ IP:

*Mar  4 23:21:34.764: DHCP_SNOOPING: received new DHCP packet from input interface (FastEthernet0/24)

ALS1#3:21:34.764: DHCP_SNOOPING: add relay information option.

*Mar  4 23:21:34.764: DHCP_SNOOPING_SW: Encoding opt82 CID in string format

*Mar  4 23:21:34.764: DHCP_SNOOPING_SW: Encoding opt82 RID in MAC address format

*Mar  4 23:21:34.764: DHCP_SNOOPING: binary dump of relay info option, length: 22 data:

0x52 0x14 0x1 0x8 0x1 0x6 0x67 0x72 0x6F 0x75 0x70 0x32 0x2 0x8 0x0 0x6 0x0 0x14 0x69 0xC3 0xCC 0x0

*Mar  4 23:21:35.008: DHCP_SNOOPING: binary dump of extracted circuit id, length: 10 data:

0x1 0x8 0x1 0x6 0x67 0x72 0x6F 0x75 0x70 0x32     // theo bảng mã ASCII, “group2”= 0x67 0x72 0x6F 0x75 0x70 0x32

*Mar  4 23:21:35.008: DHCP_SNOOPING: binary dump of extracted remote id, length: 10 data

0x2 0x8 0x0 0x6 0x0 0x14 0x69 0xC3 0xCC 0x0     // 0x0 0x14 0x69 0xC3 0xCC 0x0= base ethernet MAC address của ALS1

Cấu hình DHCP Relay trên ALS1:

ALS1#show running-config interface vlan 333

interface Vlan333

 ip address 3.3.3.254 255.255.255.0

 ip helper-address 4.4.4.2

2.Cấu hình trên ROUTER

ROUTER#debug ip dhcp server packet

Khi PC xin cấp địa chỉ IP, xuất hiện thông báo sau:

ROUTER#

*Mar  1 04:04:01.334: DHCPD: inconsistent relay information.

*Mar  1 04:04:01.338: DHCPD: relay information option exists, but giaddr is zero.

Mặc định, thiết bị Cisco không xử lý bản tin có “giaddr” là zero. DHCP snooping đã thay đổi trường thông tin này.

Để chuyển tiếp các bản tin đến server DHCP, các bạn cấu hình như sau:

ROUTER(config)# ip dhcp relay information trust-all

3.Cấu hình trên DHCP server

DHCP#show running-config | section dhcp

ip dhcp excluded-address 3.3.3.1

ip dhcp excluded-address 3.3.3.254

ip dhcp excluded-address 3.3.3.1 3.3.3.10

ip dhcp pool LAN3

   network 3.3.3.0 255.255.255.0

   default-router 3.3.3.254

   dns-server 8.8.8.8

   class GROUP1

      address range 3.3.3.100 3.3.3.150           // PC1 sẽ được cấp dải IP này

   class GROUP2

      address range 3.3.3.200 3.3.3.250           //PC2 sẽ được cấp dải IP này

ip dhcp class GROUP1

   relay agent information

      relay-information hex 0108010667726f75703102080006001469c3cc00 //”remote-id” và “circuit-id” nhận diện PC1

ip dhcp class GROUP2

   relay agent information

      relay-information hex 0108010667726f75703202080006001469c3cc00 //”remote-id” và “circuit-id” nhận diện PC2

Bật debug để xem chuỗi Option 82 trong bản tin DHCP chuyển tiếp từ ALS1

DHCP#debug ip dhcp server class

Khi PC1 xin cấp địa chỉ IP, các bạn thấy như sau:

DHCP#

*Mar  1 03:37:03.595: DHCPD: Class ‘GROUP1’ matched by default

*Mar  1 03:37:03.595: DHCPD: Searching for a match to ‘relay-information 0108010667726f75703102080006001469c3cc00’ in class GROUP1

*Mar  1 03:37:03.595: DHCPD: input pattern ‘relay-information 0108010667726f75703102080006001469c3cc00’ matches class GROUP1

*Mar  1 03:37:03.599: DHCPD: input matches class GROUP1

Khi PC2 xin cấp địa chỉ IP, các bạn thấy như sau:

DHCP#

*Mar  1 01:59:36.183: DHCPD: Class ‘GROUP1’ matched by default

*Mar  1 01:59:36.183: DHCPD: Searching for a match to ‘relay-information 0108010667726f75703202080006001469c3cc00’ in class GROUP1

*Mar  1 01:59:36.183: DHCPD: Class ‘GROUP2’ matched by default

*Mar  1 01:59:36.183: DHCPD: Searching for a match to ‘relay-information 0108010667726f75703202080006001469c3cc00’ in class GROUP2

*Mar  1 01:59:36.183: DHCPD: input pattern ‘relay-information 0108010667726f75703202080006001469c3cc00’ matches class GROUP2

*Mar  1 01:59:36.187: DHCPD: input matches class GROUP2

Tham khảo:

http://blog.ine.com/2009/07/22/understanding-dhcp-option-82/

http://www.h3c.com/portal/Products___Solutions/Technology/IPv4___IPv6_Services/Configuration_Example/200808/614701_57_0.htm

26 Tháng sáu, 2018

Chưa có bình luận, hãy trở thành người đầu tiên!

Để lại một bình luận

2020 © Learns.vn.

Login

  • Họ tên (bắt buộc)

    Họ tên

  • Địa chỉ

    Địa chỉ

  • Tóm tắt thông tin

    Tóm tắt thông tin

  • Facebook

    Facebook profile link

  • Twitter

    Twitter profile link

  • Chuyên môn

    Kỹ năng chuyên môn

  • Register
Create an Account Back to login/register