Friday, December 13, 2013

Some thoughts about DHCP testing.

Writing test cases and even use cases against DHCP servers are not so easy. That is becasue most testers don't have proper networking knowledge or experience and likewise, most network guys don't know about test plans and use cases.

This is an old report I had created few years ago, but I think it still has some useful words.


DHCP Server
Suggested use cases for test cases

Functional test:
Suggested Tools:
·         In Linux Ubuntu: dhcpdump+ dhcping link
·         In Windows: Wireshark + ipconfig / dhcpcheck.exe from ks-soft.net link

Description (windows steps)
Expected Results
Comments
Verify the DHCP is enabled and active
1- In Windows (client) open cmd panel.
2- Type: ipconfig /all
3- Look for the adapter connection related to the test subject
DHCP Enabled -> Yes

Assign a new IP address automatically
1- record your client current ip address
2- In windows cmd, type:
ipconfig /release
3- Type command:
Ipconfig /renew
4- Check if new ip is assigned. (Use Wireshark to capture and read packets if no response received)

Make sure no firewall or static ip is active for the client.
To have better results, reduce the ip expiration config in dhcp server.
Request for a new valid ip address.
1- Download dhcpcheck.exe from
2- Use cmd as administrator:
dhcpcheck.exe –host:dhcp host –clientIP:valid ip address
3- Check if the new ip is assigned. (Use Wireshark to capture and read packets if no response received)


Request for invalid ip address

1- Use cmd as administrator:
dhcpcheck.exe –host:dhcp host –clientIP:invalid ip address
2- Check if the expected response from server is received. . (Use Wireshark to capture and read packets if no response received)
3- Repeat the test with invalid IPs, special IPs, random string, null


Request for Duplicated ip address.
1- Use cmd as administrator:
dhcpcheck.exe –host:dhcp host –clientIP:duplicated ip address
2- Check if the expected response from server is received. (Use Wireshark to capture and read packets if no response received)


Change hardware address field to invalid values
1- Use cmd as administrator:
dhcpcheck.exe –host:dhcp host –clientIP:valid ip address –clientMAC: invalid MAC
2- Check if the expected response from server is received. (Use Wireshark to capture and read packets if no response received)


Sending request to an invalid host
1- Use cmd as administrator:
dhcpcheck.exe –host:invalid dhcp host –clientIP: valid ip address
2- Check if the expected response from server is received. . (Use Wireshark to capture and read packets if no response received)
3- Repeat the test with invalid IPs, special IPs, random string, null


Send a request with invalid timeout, min timeout, max time out.
1- Use cmd as administrator:
dhcpcheck.exe –host:valid dhcp host –timeout:1
2- Check if the expected response from server is received. . (Use Wireshark to capture and read packets if no response received)
3- Repeat the test with valid minimum timeout (based on server configuration and requirement)



Manipulate packet of requests.

This test needs more creativity. You’ll need to download Bit-Twist link
1- Capture a packet of a valid DHCP request with Wireshark.
2- Modify the packet carefully using Bit-Twist
3- Send the packet with Bit-Twist
4- Check if the expected response from server is received. (Use Wireshark to capture and read packets if no response received)

This test is checking the security and vulnerability aspects of the DHCP server and might need advance approval.

Performance Test:
Suggested Tools:
·         In Linux Ubuntu: dhcperf+ dhcpdump
·         In Windows: IXIA (if available - Recommended)
Performance Metrics
To determine the performance of a DHCP server, several performance metrics will be used in a test plan. The following terms are defined and suggested to use in the test plan and test report:
·         Connection – A single TCP connection between two end hosts, using connection establishment (3-way handshake).
·         Transaction – A single request for an object from a client to server. A transaction is made within an established Connection.
·         Connections-per-second – The rate at which new TCP connections are initiated per second.
·         Transaction Response Time – The amount of time elapsed between the time a client sends a request and the time an acceptable response to it is received.
·         Complete Transaction Response Time – The amount of time elapsed between the time a client sends the first request and the time the last acceptable response is received successfully from subsequent requests.
·         Client Capacity – Number of clients that a server can support. The maximum client capacity of a server is the threshold beyond which the server can no longer support any additional clients.
·         Success Rate – The ratio of successful transactions calculated over the total attempted transactions.


To do tests using IXIA: Follow this LINK
To do test using dhcperf: Follow this Link

Use Case 1, Max client Capacity:
To support the growing requirements of a DHCP server to handle various load conditions, it is critical to characterize its peak capabilities.
This test will help determine the maximum steady-state DHCP requests/transactions handling capability of the server. The maximum client capacity is reached when no additional clients can be realized. At this operating limit, the server will sustain a steady flow of DHCP requests, and then drop or not process any additional packets, achieving a 100% success rate.



Use Case 2, Max Transaction Rate:
This test will help determine the maximum transaction rate that the DHCP can sustain without any errors or packet losses (100% success rate). The maximum transaction rate will include all transactions for a new DHCP client to request and obtain its network configuration information from the DHCP server.

Use Case 3: Optimal Client Response Time:
This test will help determine the optimal client response time by verifying an acceptable level of performance for the DHCP server. The maximum client capacity and the maximum transaction rates will be used to help determine the upper limits of the DHCP server.
To achieve the maximum client capacity, the rate of arrival of DHCP requests at the server may be reduced to allow the server to service more requests. Therefore, to highest client capacity may require a reduced rate of arrival (transaction-rate) of DHCP requests.