2011年12月28日水曜日

DHCP relay

DHCPメッセージが relay agent を経由した場合、どのように変わるか確認

1.relay agent - client間

DHCP Discover: 0.0.0.0 → 255.255.255.255
DHCP Offer: 192.168.2.254 → 255.255.255.255
DHCP Request: 0.0.0.0 → 255.255.255.255
DHCP ACK: 192.168.2.254 → 255.255.255.255
IP重複確認?のためclientからGARP

※relay agent ip addressは0.0.0.0

R2#debug ip dhcp server packet
R2#
*Mar 1 00:03:11.219: DHCPD: setting giaddr to 192.168.2.254.
*Mar 1 00:03:11.227: DHCPD: BOOTREQUEST from 0063.6973.636f.2d63.3230.322e.3339.3063.2e30.3030.302d.4661.302f.30 forwarded to 192.168.12.1.
R2#
*Mar 1 00:03:14.279: DHCPD: setting giaddr to 192.168.2.254.
*Mar 1 00:03:14.283: DHCPD: BOOTREQUEST from 0063.6973.636f.2d63.3230.322e.3339.3063.2e30.3030.302d.4661.302f.30 forwarded to 192.168.12.1.
R2#
*Mar 1 00:03:16.431: DHCPD: forwarding BOOTREPLY to client c202.390c.0000.
*Mar 1 00:03:16.435: DHCPD: broadcasting BOOTREPLY to client c202.390c.0000.
*Mar 1 00:03:16.535: DHCPD: Finding a relay for client 0063.6973.636f.2d63.3230.322e.3339.3063.2e30.3030.302d.4661.302f.30 on interface FastEthernet0/0.
*Mar 1 00:03:16.539: DHCPD: setting giaddr to 192.168.2.254.
*Mar 1 00:03:16.543: DHCPD: BOOTREQUEST from 0063.6973.636f.2d63.3230.322e.3339.3063.2e30.3030.302d.4661.302f.30 forwarded to 192.168.12.1.
*Mar 1 00:03:16.631: DHCPD: forwarding BOOTREPLY to client c202.390c.0000.
*Mar 1 00:03:16.631: DHCPD: broadcasting BOOTREPLY to client c202.390c.0000.


2.server - relay agent間

DHCP Discover: 192.168.2.254 → 192.168.12.1
DHCP Offer: 192.168.12.1 → 192.168.2.254
DHCP Request: 192.168.2.254 → 192.168.12.1
DHCP ACK: 192.168.12.1 → 192.168.2.254

※relay agent ip addressに192.168.2.254がセットされている


R1#debug ip dhcp server packet
R1#
*Mar 1 00:09:52.043: DHCPD: DHCPDISCOVER received from client 0063.6973.636f.2d63.3230.322e.3339.3063.2e30.3030.302d.4661.302f.30 through relay 192.168.2.254.
*Mar 1 00:09:52.047: DHCPD: Allocate an address without class information (192.168.2.0)
R1#
*Mar 1 00:09:54.051: DHCPD: Sending DHCPOFFER to client 0063.6973.636f.2d63.3230.322e.3339.3063.2e30.3030.302d.4661.302f.30 (192.168.2.2).
*Mar 1 00:09:54.055: DHCPD: unicasting BOOTREPLY for client c202.390c.0000 to relay 192.168.2.254.
*Mar 1 00:09:54.235: DHCPD: DHCPREQUEST received from client 0063.6973.636f.2d63.3230.322e.3339.3063.2e30.3030.302d.4661.302f.30.
*Mar 1 00:09:54.239: DHCPD: No default domain to append - abort update
*Mar 1 00:09:54.243: DHCPD: Sending DHCPACK to client 0063.6973.636f.2d63.3230.322e.3339.3063.2e30.3030.302d.4661.302f.30 (192.168.2.2).
*Mar 1 00:09:54.247: DHCPD: unicasting BOOTREPLY for client c202.390c.0000 to relay 192.168.2.254.
R1#

★注意事項
relay agent ip は ip helper-addressを設定したインタフェースのIPとなる
→DHCPサーバ側にrelay agent ip へのルートが確保されている必要がある