リレーエージェントが中継するDHCP通信の詳細について、パケットキャプチャとCiscoルーターのデバッグログを確認しながら説明します。
DHCPの基礎については、下記を参照してください。
ネットワーク構成
下記の4パターンで、DHCP通信の詳細を確認します。DHCPリレーエージェントはCiscoルーターで構築します。
パターン | DHCPクライアント | DHCPサーバー |
---|---|---|
パターン1 | Desktop(Linux) | Ciscoルーター |
パターン2 | Ciscoルーター | Ciscoルーター |
パターン3 | Desktop(Linux) | Ubuntuサーバー |
パターン4 | Ciscoルーター | Ubuntuサーバー |
DHCPサーバー、DHCPクライアントの設定方法は下記を参照してください。
【パターン1】DHCPクライアント:Desktop(Linux)、DHCPサーバー:Ciscoルーター
【パターン2】DHCPクライアント:Ciscoルーター、DHCPサーバー:Ciscoルーター
【パターン3】DHCPクライアント:Desktop(Linux)、DHCPサーバー:Ubuntuサーバー
【パターン4】DHCPクライアント:Ciscoルーター、DHCPサーバー:Ubuntuサーバー
DHCP通信の確認(パケットキャプチャ・デバッグ)
DHCPサーバーとなるCiscoルーターには下記のコマンドで、DHCPのデバッグを有効にします。
debug ip dhcp server events
debug ip dhcp server packet
【パターン1】DHCPクライアント:Desktop(Linux)、DHCPサーバー:Ciscoルーター
パターン1の場合の通信の詳細は下記のとおりです。DHCPリレーエージェントからDHCPクライアントへの通信は、ユニキャスト通信が使用されています。
パケットキャプチャ確認
通信の全体の流れは下記のとおりです。DHCP Discover を受信したDHCPサーバーは、割り当て予定のIPアドレスにPing(ICMP)エコーリクエストを送信し、応答が無いことを確認した上で DHCP Offer を送信しています。また、DHCPリレーエージェントからDHCPサーバーへの通信は、送信元がDHCPクライアント側のIPアドレス(172.16.1.254)となります。
DHCPクライアント → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x10142107
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (61) Client identifier
Length: 7
Hardware type: Ethernet (0x01)
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 576
Option: (55) Parameter Request List
Length: 7
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (3) Router
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (12) Host Name
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (28) Broadcast Address
Parameter Request List Item: (42) Network Time Protocol Servers
Option: (60) Vendor class identifier
Length: 12
Vendor class identifier: udhcp 1.32.1
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000000000000000
0… …. …. …. = Broadcast flag: Unicast
→ この部分のフラグがセットされていない場合、DHCPサーバーからの通信はユニキャストとなります。
Option: (55) Parameter Request List
→ この部分でDHCPにより要求するネットワーク情報を提示しています。
DHCPリレーエージェント → DHCPサーバー
Dynamic Host Configuration Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x10142107
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (61) Client identifier
Length: 7
Hardware type: Ethernet (0x01)
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 576
Option: (55) Parameter Request List
Length: 7
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (3) Router
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (12) Host Name
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (28) Broadcast Address
Parameter Request List Item: (42) Network Time Protocol Servers
Option: (60) Vendor class identifier
Length: 12
Vendor class identifier: udhcp 1.32.1
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000000000000000
Hops: 1
→ DHCPパケットがリレーエージェントを経由するとカウントアップされます。
Relay agent IP address: 172.16.1.254
→ DHCPリレーエージェントのIPアドレスが入ります。DHCPサーバーはこのアドレスをもとに割り当てるサブネットを判断します。
※上記以外の情報は、DHCPクライアントからの DHCP Discover と同じ内容です。
DHCPサーバー → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Offer)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x10142107
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Offer)
Length: 1
DHCP: Offer (2)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (86400s) 1 day
Option: (58) Renewal Time Value
Length: 4
Renewal Time Value: (43200s) 12 hours
Option: (59) Rebinding Time Value
Length: 4
Rebinding Time Value: (75600s) 21 hours
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000
Your (client) IP address: 172.16.1.1
→ 割り当て予定のIPアドレスを通知しています。
Option: (XX)
→ その他のオプションとして割り当てる情報を通知しています。
DHCPリレーエージェント → DHCPクライアント
Dynamic Host Configuration Protocol (Offer)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x10142107
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Offer)
Length: 1
DHCP: Offer (2)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (86400s) 1 day
Option: (58) Renewal Time Value
Length: 4
Renewal Time Value: (43200s) 12 hours
Option: (59) Rebinding Time Value
Length: 4
Rebinding Time Value: (75600s) 21 hours
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000
DHCPサーバー → DHCPリレーエージェントへの通信と同じ内容です。
DHCPクライアント → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Request)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x10142107
Seconds elapsed: 2
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Request)
Length: 1
DHCP: Request (3)
Option: (61) Client identifier
Length: 7
Hardware type: Ethernet (0x01)
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Option: (50) Requested IP Address (172.16.1.1)
Length: 4
Requested IP Address: 172.16.1.1
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 576
Option: (55) Parameter Request List
Length: 7
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (3) Router
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (12) Host Name
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (28) Broadcast Address
Parameter Request List Item: (42) Network Time Protocol Servers
Option: (60) Vendor class identifier
Length: 12
Vendor class identifier: udhcp 1.32.1
Option: (255) End
Option End: 255
Padding: 0000000000000000
Option: (50) Requested IP Address (172.16.1.1)
→ 通知されたIPアドレス情報の割り当てをリクエストしています。
DHCPリレーエージェント → DHCPサーバー
Dynamic Host Configuration Protocol (Request)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x10142107
Seconds elapsed: 2
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Request)
Length: 1
DHCP: Request (3)
Option: (61) Client identifier
Length: 7
Hardware type: Ethernet (0x01)
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Option: (50) Requested IP Address (172.16.1.1)
Length: 4
Requested IP Address: 172.16.1.1
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 576
Option: (55) Parameter Request List
Length: 7
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (3) Router
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (12) Host Name
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (28) Broadcast Address
Parameter Request List Item: (42) Network Time Protocol Servers
Option: (60) Vendor class identifier
Length: 12
Vendor class identifier: udhcp 1.32.1
Option: (255) End
Option End: 255
Padding: 0000000000000000
Hops: 1
→ DHCPパケットがリレーエージェントを経由するとカウントアップされます。
Relay agent IP address: 172.16.1.254
→ DHCPリレーエージェントのIPアドレスが入ります。
※上記以外の情報は、DHCPクライアントからの DHCP Request と同じ内容です。
DHCPサーバー → DHCPリレーエージェント
Dynamic Host Configuration Protocol (ACK)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x10142107
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
Length: 1
DHCP: ACK (5)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (86400s) 1 day
Option: (58) Renewal Time Value
Length: 4
Renewal Time Value: (43200s) 12 hours
Option: (59) Rebinding Time Value
Length: 4
Rebinding Time Value: (75600s) 21 hours
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000
Option: (53) DHCP Message Type (ACK)
→ メッセージタイプ以外は、DHCP Offer と同じ情報を再送信し、ネットワーク情報の割り当てを完了します。
DHCPリレーエージェント → DHCPクライアント
Dynamic Host Configuration Protocol (ACK)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x10142107
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
Length: 1
DHCP: ACK (5)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (86400s) 1 day
Option: (58) Renewal Time Value
Length: 4
Renewal Time Value: (43200s) 12 hours
Option: (59) Rebinding Time Value
Length: 4
Rebinding Time Value: (75600s) 21 hours
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000
DHCPサーバー → DHCPリレーエージェントへの通信と同じ内容です。
デバッグ確認
Router1のデバッグログで、DHCP通信の詳細が確認できます。
02:09:08.709: DHCPD: Sending notification of DISCOVER:
02:09:08.709: DHCPD: htype 1 chaddr 5254.000f.2c5a
02:09:08.710: DHCPD: remote id 020a0000c0a801fd00000000
02:09:08.710: DHCPD: circuit id 00000000
02:09:08.710: DHCPD: DHCPDISCOVER received from client 0152.5400.0f2c.5a through relay 172.16.1.254.
02:09:08.710: DHCPD: Option 125 not present in the msg.
02:09:08.710: DHCPD: Seeing if there is an internally specified pool class:
02:09:08.710: DHCPD: htype 1 chaddr 5254.000f.2c5a
02:09:08.710: DHCPD: remote id 020a0000c0a801fd00000000
02:09:08.711: DHCPD: circuit id 00000000
02:09:08.711: DHCPD: Allocate an address without class information (172.16.1.0)
02:09:08.711: DHCPD: Allocated binding E806D78
02:09:08.712: DHCPD: Adding binding to radix tree (172.16.1.1)
02:09:08.712: DHCPD: Adding binding to hash tree
02:09:08.712: DHCPD: assigned IP address 172.16.1.1 to client 0152.5400.0f2c.5a.
02:09:08.713: DHCPD: Saving workspace (ID=0x4F000019)
02:09:10.714: DHCPD: Reprocessing saved workspace (ID=0x4F000019)
02:09:10.714: DHCPD: Option 125 not present in the msg.
02:09:10.714: DHCPD: Sending notification of DISCOVER:
02:09:10.715: DHCPD: htype 1 chaddr 5254.000f.2c5a
02:09:10.715: DHCPD: remote id 020a0000c0a801fd00000000
02:09:10.715: DHCPD: circuit id 00000000
02:09:10.716: DHCPD: DHCPDISCOVER received from client 0152.5400.0f2c.5a through relay 172.16.1.254.
02:09:10.717: DHCPD: Option 125 not present in the msg.
02:09:10.717: DHCPD: Seeing if there is an internally specified pool class:
02:09:10.717: DHCPD: htype 1 chaddr 5254.000f.2c5a
02:09:10.719: DHCPD: remote id 020a0000c0a801fd00000000
02:09:10.719: DHCPD: circuit id 00000000
02:09:10.719: DHCPD: Sending DHCPOFFER to client 0152.5400.0f2c.5a (172.16.1.1).DHCPD: Setting only requested parameters
02:09:10.719: DHCPD: Option 125 not present in the msg.
02:09:10.719: DHCPD: no option 125
02:09:10.720: DHCPD: unicasting BOOTREPLY for client 5254.000f.2c5a to relay 172.16.1.254.
02:09:10.751: DHCPD: New packet workspace 0xEE83C80 (ID=0xDB00001A)
02:09:10.751: DHCPD: client's VPN is .
02:09:10.752: DHCPD: No option 125
02:09:10.752: DHCPD: DHCPREQUEST received from client 0152.5400.0f2c.5a.
02:09:10.753: DHCPD: Option 125 not present in the msg.
02:09:10.753: DHCPD: Sending notification of ASSIGNMENT:
02:09:10.754: DHCPD: address 172.16.1.1 mask 255.255.255.0
02:09:10.754: DHCPD: htype 1 chaddr 5254.000f.2c5a
02:09:10.755: DHCPD: lease time remaining (secs) = 86400
02:09:10.755: DHCPD: Can't find any hostname to update
02:09:10.755: DHCPD: Sending DHCPACK to client 0152.5400.0f2c.5a (172.16.1.1).DHCPD: Setting only requested parameters
【パターン2】DHCPクライアント:Ciscoルーター、DHCPサーバー:Ciscoルーター
パターン2の場合の通信の詳細は下記のとおりです。DHCPリレーエージェントからDHCPクライアントへの通信は、ブロードキャスト通信が使用されています。
パケットキャプチャ確認
通信の全体の流れは下記のとおりです。DHCP Discover を受信したDHCPサーバーは、割り当て予定のIPアドレスにPing(ICMP)エコーリクエストを送信し、応答が無いことを確認した上で DHCP Offer を送信しています。また、DHCPリレーエージェントからDHCPサーバーへの通信は、送信元がDHCPクライアント側のIPアドレス(172.16.1.254)となります。
DHCPクライアント → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x00001e55
Seconds elapsed: 3
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 1200
Option: (61) Client identifier
Length: 27
Type: 0
Client Identifier: cisco-5254.0017.89b3-Gi0/0
Option: (12) Host Name
Length: 7
Host Name: Router1
Option: (55) Parameter Request List
Length: 8
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (3) Router
Parameter Request List Item: (33) Static Route
Parameter Request List Item: (150) TFTP Server Address
Parameter Request List Item: (43) Vendor-Specific Information
Option: (60) Vendor class identifier
Length: 8
Vendor class identifier: ciscopnp
Option: (255) End
Option End: 255
1… …. …. …. = Broadcast flag: Broadcast
→ この部分のフラグがセットされている場合、DHCPサーバーからの通信はブロードキャストとなります。
Option: (55) Parameter Request List
→ この部分でDHCPにより要求するネットワーク情報を提示しています。
DHCPリレーエージェント → DHCPサーバー
Dynamic Host Configuration Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x00001e55
Seconds elapsed: 3
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 1200
Option: (61) Client identifier
Length: 27
Type: 0
Client Identifier: cisco-5254.0017.89b3-Gi0/0
Option: (12) Host Name
Length: 7
Host Name: Router1
Option: (55) Parameter Request List
Length: 8
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (3) Router
Parameter Request List Item: (33) Static Route
Parameter Request List Item: (150) TFTP Server Address
Parameter Request List Item: (43) Vendor-Specific Information
Option: (60) Vendor class identifier
Length: 8
Vendor class identifier: ciscopnp
Option: (255) End
Option End: 255
Hops: 1
→ DHCPパケットがリレーエージェントを経由するとカウントアップされます。
Relay agent IP address: 172.16.1.254
→ DHCPリレーエージェントのIPアドレスが入ります。DHCPサーバーはこのアドレスをもとに割り当てるサブネットを判断します。
※上記以外の情報は、DHCPクライアントからの DHCP Discover と同じ内容です。
DHCPサーバー → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Offer)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x00001e55
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Offer)
Length: 1
DHCP: Offer (2)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (86400s) 1 day
Option: (58) Renewal Time Value
Length: 4
Renewal Time Value: (43200s) 12 hours
Option: (59) Rebinding Time Value
Length: 4
Rebinding Time Value: (75600s) 21 hours
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000
Your (client) IP address: 172.16.1.1
→ 割り当て予定のIPアドレスを通知しています。
Option: (XX)
→ その他のオプションとして割り当てる情報を通知しています。
DHCPリレーエージェント → DHCPクライアント
Dynamic Host Configuration Protocol (Offer)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x00001e55
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Offer)
Length: 1
DHCP: Offer (2)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (86400s) 1 day
Option: (58) Renewal Time Value
Length: 4
Renewal Time Value: (43200s) 12 hours
Option: (59) Rebinding Time Value
Length: 4
Rebinding Time Value: (75600s) 21 hours
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000
DHCPサーバー → DHCPリレーエージェントへの通信と同じ内容です。
DHCPクライアント → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Request)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x00001e55
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Request)
Length: 1
DHCP: Request (3)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 1200
Option: (61) Client identifier
Length: 27
Type: 0
Client Identifier: cisco-5254.0017.89b3-Gi0/0
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (50) Requested IP Address (172.16.1.1)
Length: 4
Requested IP Address: 172.16.1.1
Option: (12) Host Name
Length: 7
Host Name: Router1
Option: (55) Parameter Request List
Length: 8
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (3) Router
Parameter Request List Item: (33) Static Route
Parameter Request List Item: (150) TFTP Server Address
Parameter Request List Item: (43) Vendor-Specific Information
Option: (60) Vendor class identifier
Length: 8
Vendor class identifier: ciscopnp
Option: (255) End
Option End: 255
Option: (50) Requested IP Address (172.16.1.1)
→ 通知されたIPアドレス情報の割り当てをリクエストしています。
DHCPリレーエージェント → DHCPサーバー
Dynamic Host Configuration Protocol (Request)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x00001e55
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Request)
Length: 1
DHCP: Request (3)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 1200
Option: (61) Client identifier
Length: 27
Type: 0
Client Identifier: cisco-5254.0017.89b3-Gi0/0
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (50) Requested IP Address (172.16.1.1)
Length: 4
Requested IP Address: 172.16.1.1
Option: (12) Host Name
Length: 7
Host Name: Router1
Option: (55) Parameter Request List
Length: 8
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (3) Router
Parameter Request List Item: (33) Static Route
Parameter Request List Item: (150) TFTP Server Address
Parameter Request List Item: (43) Vendor-Specific Information
Option: (60) Vendor class identifier
Length: 8
Vendor class identifier: ciscopnp
Option: (255) End
Option End: 255
Hops: 1
→ DHCPパケットがリレーエージェントを経由するとカウントアップされます。
Relay agent IP address: 172.16.1.254
→ DHCPリレーエージェントのIPアドレスが入ります。
※上記以外の情報は、DHCPクライアントからの DHCP Request と同じ内容です。
DHCPサーバー → DHCPリレーエージェント
Dynamic Host Configuration Protocol (ACK)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x00001e55
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
Length: 1
DHCP: ACK (5)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (86400s) 1 day
Option: (58) Renewal Time Value
Length: 4
Renewal Time Value: (43200s) 12 hours
Option: (59) Rebinding Time Value
Length: 4
Rebinding Time Value: (75600s) 21 hours
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000
Option: (53) DHCP Message Type (ACK)
→ メッセージタイプ以外は、DHCP Offer と同じ情報を再送信し、ネットワーク情報の割り当てを完了します。
DHCPリレーエージェント → DHCPクライアント
Dynamic Host Configuration Protocol (ACK)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x00001e55
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
Length: 1
DHCP: ACK (5)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (86400s) 1 day
Option: (58) Renewal Time Value
Length: 4
Renewal Time Value: (43200s) 12 hours
Option: (59) Rebinding Time Value
Length: 4
Rebinding Time Value: (75600s) 21 hours
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000
DHCPサーバー → DHCPリレーエージェントへの通信と同じ内容です。
デバッグ確認
Router1のデバッグログで、DHCP通信の詳細が確認できます。
19 07:37:46.508: DHCPD: Sending notification of DISCOVER:
19 07:37:46.509: DHCPD: htype 1 chaddr 5254.0017.89b3
19 07:37:46.509: DHCPD: remote id 020a0000c0a801fd00000000
19 07:37:46.509: DHCPD: circuit id 00000000
19 07:37:46.510: DHCPD: DHCPDISCOVER received from client 0063.6973.636f.2d35.3235.342e.3030.3137.2e38.3962.332d.4769.302f.30 through relay 172.16.1.254.
19 07:37:46.510: DHCPD: Option 125 not present in the msg.
19 07:37:46.510: DHCPD: Seeing if there is an internally specified pool class:
19 07:37:46.511: DHCPD: htype 1 chaddr 5254.0017.89b3
19 07:37:46.511: DHCPD: remote id 020a0000c0a801fd00000000
19 07:37:46.512: DHCPD: circuit id 00000000
19 07:37:46.512: DHCPD: Allocate an address without class information (172.16.1.0)
19 07:37:46.514: DHCPD: Allocated binding EEBA248
19 07:37:46.514: DHCPD: Adding binding to radix tree (172.16.1.1)
19 07:37:46.514: DHCPD: Adding binding to hash tree
19 07:37:46.514: DHCPD: assigned IP address 172.16.1.1 to client 0063.6973.636f.2d35.3235.342e.3030.3137.2e38.3962.332d.4769.302f.30.
19 07:37:46.514: DHCPD: Saving workspace (ID=0x6D000022)
19 07:37:48.515: DHCPD: Reprocessing saved workspace (ID=0x6D000022)
19 07:37:48.516: DHCPD: Option 125 not present in the msg.
19 07:37:48.516: DHCPD: Sending notification of DISCOVER:
19 07:37:48.517: DHCPD: htype 1 chaddr 5254.0017.89b3
19 07:37:48.517: DHCPD: remote id 020a0000c0a801fd00000000
19 07:37:48.518: DHCPD: circuit id 00000000
19 07:37:48.518: DHCPD: DHCPDISCOVER received from client 0063.6973.636f.2d35.3235.342e.3030.3137.2e38.3962.332d.4769.302f.30 through relay 172.16.1.254.
19 07:37:48.519: DHCPD: Option 125 not present in the msg.
19 07:37:48.519: DHCPD: Seeing if there is an internally specified pool class:
19 07:37:48.519: DHCPD: htype 1 chaddr 5254.0017.89b3
19 07:37:48.519: DHCPD: remote id 020a0000c0a801fd00000000
19 07:37:48.519: DHCPD: circuit id 00000000
19 07:37:48.519: DHCPD: Sending DHCPOFFER to client 0063.6973.636f.2d35.3235.342e.3030.3137.2e38.3962.332d.4769.302f.30 (172.16.1.1).DHCPD: Setting only requested parameters
19 07:37:48.521: DHCPD: Option 125 not present in the msg.
19 07:37:48.522: DHCPD: no option 125
19 07:37:48.522: DHCPD: unicasting BOOTREPLY for client 5254.0017.89b3 to relay 172.16.1.254.
19 07:37:48.539: DHCPD: New packet workspace 0xEE83C80 (ID=0x5000023)
19 07:37:48.540: DHCPD: client's VPN is .
19 07:37:48.540: DHCPD: No option 125
19 07:37:48.540: DHCPD: DHCPREQUEST received from client 0063.6973.636f.2d35.3235.342e.3030.3137.2e38.3962.332d.4769.302f.30.
19 07:37:48.540: DHCPD: Option 125 not present in the msg.
19 07:37:48.540: DHCPD: Sending notification of ASSIGNMENT:
19 07:37:48.540: DHCPD: address 172.16.1.1 mask 255.255.255.0
19 07:37:48.540: DHCPD: htype 1 chaddr 5254.0017.89b3
19 07:37:48.540: DHCPD: lease time remaining (secs) = 86400
19 07:37:48.542: DHCPD: No default domain to append - abort update
19 07:37:48.542: DHCPD: Sending DHCPACK to client 0063.6973.636f.2d35.3235.342e.3030.3137.2e38.3962.332d.4769.302f.30 (172.16.1.1).DHCPD: Setting only requested parameters
【パターン3】DHCPクライアント:Desktop(Linux)、DHCPサーバー:Ubuntuサーバー
パターン3の場合の通信の詳細は下記のとおりです。DHCPリレーエージェントからDHCPクライアントへの通信は、ユニキャスト通信が使用されています。
パケットキャプチャ確認
通信の全体の流れは下記のとおりです。DHCP Discover を受信したDHCPサーバーは、割り当て予定のIPアドレスにPing(ICMP)エコーリクエストを送信し、応答が無いことを確認した上で DHCP Offer を送信しています。また、DHCPリレーエージェントからDHCPサーバーへの通信は、送信元がDHCPクライアント側のIPアドレス(172.16.1.254)となります。
DHCPクライアント → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x74fbb017
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (61) Client identifier
Length: 7
Hardware type: Ethernet (0x01)
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 576
Option: (55) Parameter Request List
Length: 7
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (3) Router
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (12) Host Name
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (28) Broadcast Address
Parameter Request List Item: (42) Network Time Protocol Servers
Option: (60) Vendor class identifier
Length: 12
Vendor class identifier: udhcp 1.32.1
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000000000000000
0… …. …. …. = Broadcast flag: Unicast
→ この部分のフラグがセットされていない場合、DHCPサーバーからの通信はユニキャストとなります。
Option: (55) Parameter Request List
→ この部分でDHCPにより要求するネットワーク情報を提示しています。
DHCPリレーエージェント → DHCPサーバー
Dynamic Host Configuration Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x74fbb017
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (61) Client identifier
Length: 7
Hardware type: Ethernet (0x01)
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 576
Option: (55) Parameter Request List
Length: 7
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (3) Router
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (12) Host Name
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (28) Broadcast Address
Parameter Request List Item: (42) Network Time Protocol Servers
Option: (60) Vendor class identifier
Length: 12
Vendor class identifier: udhcp 1.32.1
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000000000000000
Hops: 1
→ DHCPパケットがリレーエージェントを経由するとカウントアップされます。
Relay agent IP address: 172.16.1.254
→ DHCPリレーエージェントのIPアドレスが入ります。DHCPサーバーはこのアドレスをもとに割り当てるサブネットを判断します。
※上記以外の情報は、DHCPクライアントからの DHCP Discover と同じ内容です。
DHCPサーバー → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Offer)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x74fbb017
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 192.168.1.253
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Offer)
Length: 1
DHCP: Offer (2)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (600s) 10 minutes
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (15) Domain Name
Length: 11
Domain Name: example.org
Option: (255) End
Option End: 255
Padding: 00000000000000000000000000
Your (client) IP address: 172.16.1.1
→ 割り当て予定のIPアドレスを通知しています。
Option: (XX)
→ その他のオプションとして割り当てる情報を通知しています。
DHCPリレーエージェント → DHCPクライアント
Dynamic Host Configuration Protocol (Offer)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x74fbb017
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 192.168.1.253
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Offer)
Length: 1
DHCP: Offer (2)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (600s) 10 minutes
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (15) Domain Name
Length: 11
Domain Name: example.org
Option: (255) End
Option End: 255
Padding: 00000000000000000000000000
DHCPサーバー → DHCPリレーエージェントへの通信と同じ内容です。
DHCPクライアント → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Request)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x74fbb017
Seconds elapsed: 1
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Request)
Length: 1
DHCP: Request (3)
Option: (61) Client identifier
Length: 7
Hardware type: Ethernet (0x01)
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Option: (50) Requested IP Address (172.16.1.1)
Length: 4
Requested IP Address: 172.16.1.1
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 576
Option: (55) Parameter Request List
Length: 7
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (3) Router
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (12) Host Name
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (28) Broadcast Address
Parameter Request List Item: (42) Network Time Protocol Servers
Option: (60) Vendor class identifier
Length: 12
Vendor class identifier: udhcp 1.32.1
Option: (255) End
Option End: 255
Padding: 0000000000000000
Option: (50) Requested IP Address (172.16.1.1)
→ 通知されたIPアドレス情報の割り当てをリクエストしています。
DHCPリレーエージェント → DHCPサーバー
Dynamic Host Configuration Protocol (Request)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x74fbb017
Seconds elapsed: 1
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Request)
Length: 1
DHCP: Request (3)
Option: (61) Client identifier
Length: 7
Hardware type: Ethernet (0x01)
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Option: (50) Requested IP Address (172.16.1.1)
Length: 4
Requested IP Address: 172.16.1.1
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 576
Option: (55) Parameter Request List
Length: 7
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (3) Router
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (12) Host Name
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (28) Broadcast Address
Parameter Request List Item: (42) Network Time Protocol Servers
Option: (60) Vendor class identifier
Length: 12
Vendor class identifier: udhcp 1.32.1
Option: (255) End
Option End: 255
Padding: 0000000000000000
Hops: 1
→ DHCPパケットがリレーエージェントを経由するとカウントアップされます。
Relay agent IP address: 172.16.1.254
→ DHCPリレーエージェントのIPアドレスが入ります。
※上記以外の情報は、DHCPクライアントからの DHCP Request と同じ内容です。
DHCPサーバー → DHCPリレーエージェント
Dynamic Host Configuration Protocol (ACK)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x74fbb017
Seconds elapsed: 1
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 192.168.1.253
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
Length: 1
DHCP: ACK (5)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (600s) 10 minutes
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (15) Domain Name
Length: 11
Domain Name: example.org
Option: (255) End
Option End: 255
Padding: 00000000000000000000000000
Option: (53) DHCP Message Type (ACK)
→ メッセージタイプ以外は、DHCP Offer と同じ情報を再送信し、ネットワーク情報の割り当てを完了します。
DHCPリレーエージェント → DHCPクライアント
Dynamic Host Configuration Protocol (ACK)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x74fbb017
Seconds elapsed: 1
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 192.168.1.253
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_0f:2c:5a (52:54:00:0f:2c:5a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
Length: 1
DHCP: ACK (5)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (600s) 10 minutes
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (15) Domain Name
Length: 11
Domain Name: example.org
Option: (255) End
Option End: 255
Padding: 00000000000000000000000000
DHCPサーバー → DHCPリレーエージェントへの通信と同じ内容です。
【パターン4】DHCPクライアント:Ciscoルーター、DHCPサーバー:Ubuntuサーバー
パターン4の場合の通信の詳細は下記のとおりです。DHCPリレーエージェントからDHCPクライアントへの通信は、ブロードキャスト通信が使用されています。
パケットキャプチャ確認
通信の全体の流れは下記のとおりです。DHCP Discover を受信したDHCPサーバーは、割り当て予定のIPアドレスにPing(ICMP)エコーリクエストを送信し、応答が無いことを確認した上で DHCP Offer を送信しています。また、DHCPリレーエージェントからDHCPサーバーへの通信は、送信元がDHCPクライアント側のIPアドレス(172.16.1.254)となります。
DHCPクライアント → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x0000245d
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 1200
Option: (61) Client identifier
Length: 27
Type: 0
Client Identifier: cisco-5254.0017.89b3-Gi0/0
Option: (12) Host Name
Length: 7
Host Name: Router1
Option: (55) Parameter Request List
Length: 8
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (3) Router
Parameter Request List Item: (33) Static Route
Parameter Request List Item: (150) TFTP Server Address
Parameter Request List Item: (43) Vendor-Specific Information
Option: (60) Vendor class identifier
Length: 8
Vendor class identifier: ciscopnp
Option: (255) End
Option End: 255
1… …. …. …. = Broadcast flag: Broadcast
→ この部分のフラグがセットされている場合、DHCPサーバーからの通信はブロードキャストとなります。
Option: (55) Parameter Request List
→ この部分でDHCPにより要求するネットワーク情報を提示しています。
DHCPリレーエージェント → DHCPサーバー
Dynamic Host Configuration Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x0000245d
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 1200
Option: (61) Client identifier
Length: 27
Type: 0
Client Identifier: cisco-5254.0017.89b3-Gi0/0
Option: (12) Host Name
Length: 7
Host Name: Router1
Option: (55) Parameter Request List
Length: 8
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (3) Router
Parameter Request List Item: (33) Static Route
Parameter Request List Item: (150) TFTP Server Address
Parameter Request List Item: (43) Vendor-Specific Information
Option: (60) Vendor class identifier
Length: 8
Vendor class identifier: ciscopnp
Option: (255) End
Option End: 255
Hops: 1
→ DHCPパケットがリレーエージェントを経由するとカウントアップされます。
Relay agent IP address: 172.16.1.254
→ DHCPリレーエージェントのIPアドレスが入ります。DHCPサーバーはこのアドレスをもとに割り当てるサブネットを判断します。
※上記以外の情報は、DHCPクライアントからの DHCP Discover と同じ内容です。
DHCPサーバー → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Offer)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x0000245d
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 192.168.1.253
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Offer)
Length: 1
DHCP: Offer (2)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (600s) 10 minutes
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (15) Domain Name
Length: 11
Domain Name: example.org
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (255) End
Option End: 255
Padding: 00000000000000000000000000
Your (client) IP address: 172.16.1.1
→ 割り当て予定のIPアドレスを通知しています。
Option: (XX)
→ その他のオプションとして割り当てる情報を通知しています。
DHCPリレーエージェント → DHCPクライアント
Dynamic Host Configuration Protocol (Offer)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x0000245d
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 192.168.1.253
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Offer)
Length: 1
DHCP: Offer (2)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (600s) 10 minutes
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (15) Domain Name
Length: 11
Domain Name: example.org
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (255) End
Option End: 255
Padding: 00000000000000000000000000
DHCPサーバー → DHCPリレーエージェントへの通信と同じ内容です。
DHCPクライアント → DHCPリレーエージェント
Dynamic Host Configuration Protocol (Request)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x0000245d
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Request)
Length: 1
DHCP: Request (3)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 1200
Option: (61) Client identifier
Length: 27
Type: 0
Client Identifier: cisco-5254.0017.89b3-Gi0/0
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (50) Requested IP Address (172.16.1.1)
Length: 4
Requested IP Address: 172.16.1.1
Option: (12) Host Name
Length: 7
Host Name: Router1
Option: (55) Parameter Request List
Length: 8
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (3) Router
Parameter Request List Item: (33) Static Route
Parameter Request List Item: (150) TFTP Server Address
Parameter Request List Item: (43) Vendor-Specific Information
Option: (60) Vendor class identifier
Length: 8
Vendor class identifier: ciscopnp
Option: (255) End
Option End: 255
Option: (50) Requested IP Address (172.16.1.1)
→ 通知されたIPアドレス情報の割り当てをリクエストしています。
DHCPリレーエージェント → DHCPサーバー
Dynamic Host Configuration Protocol (Request)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x0000245d
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Request)
Length: 1
DHCP: Request (3)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 1200
Option: (61) Client identifier
Length: 27
Type: 0
Client Identifier: cisco-5254.0017.89b3-Gi0/0
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (50) Requested IP Address (172.16.1.1)
Length: 4
Requested IP Address: 172.16.1.1
Option: (12) Host Name
Length: 7
Host Name: Router1
Option: (55) Parameter Request List
Length: 8
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (3) Router
Parameter Request List Item: (33) Static Route
Parameter Request List Item: (150) TFTP Server Address
Parameter Request List Item: (43) Vendor-Specific Information
Option: (60) Vendor class identifier
Length: 8
Vendor class identifier: ciscopnp
Option: (255) End
Option End: 255
Hops: 1
→ DHCPパケットがリレーエージェントを経由するとカウントアップされます。
Relay agent IP address: 172.16.1.254
→ DHCPリレーエージェントのIPアドレスが入ります。
※上記以外の情報は、DHCPクライアントからの DHCP Request と同じ内容です。
DHCPサーバー → DHCPリレーエージェント
Dynamic Host Configuration Protocol (ACK)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x0000245d
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 192.168.1.253
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
Length: 1
DHCP: ACK (5)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (600s) 10 minutes
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (15) Domain Name
Length: 11
Domain Name: example.org
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (255) End
Option End: 255
Padding: 00000000000000000000000000
Option: (53) DHCP Message Type (ACK)
→ メッセージタイプ以外は、DHCP Offer と同じ情報を再送信し、ネットワーク情報の割り当てを完了します。
DHCPリレーエージェント → DHCPクライアント
Dynamic Host Configuration Protocol (ACK)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 1
Transaction ID: 0x0000245d
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
1... .... .... .... = Broadcast flag: Broadcast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0
Your (client) IP address: 172.16.1.1
Next server IP address: 192.168.1.253
Relay agent IP address: 172.16.1.254
Client MAC address: RealtekU_17:89:b3 (52:54:00:17:89:b3)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
Length: 1
DHCP: ACK (5)
Option: (54) DHCP Server Identifier (192.168.1.253)
Length: 4
DHCP Server Identifier: 192.168.1.253
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (600s) 10 minutes
Option: (1) Subnet Mask (255.255.255.0)
Length: 4
Subnet Mask: 255.255.255.0
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 8.8.8.8
Option: (15) Domain Name
Length: 11
Domain Name: example.org
Option: (3) Router
Length: 4
Router: 172.16.1.254
Option: (255) End
Option End: 255
Padding: 00000000000000000000000000
DHCPサーバー → DHCPリレーエージェントへの通信と同じ内容です。
以上で、DHCP通信の詳細 – リレーエージェントあり (パケットキャプチャ・デバッグ)の説明は完了です!
DHCPリレーエージェントを経由しない場合のDHCP通信の詳細は、下記を参照してください。