In this post, a FRDM-K64F board is used. Many networking sample codes support this board. Create an empty project, run menuconfig, select:
- NETWORKING
- NET_IPV4, NET_ARP, NET_TCP, NET_UDP
- NET_DHCPV4
- NET_MGMT, NET_MGMT_EVENT,
- LOG, NET_LOG, and
- INIT_STACKS
You can deselect NET_IPV6 if you do not need it. If you know the CONFIG_ keyword, search feature of the menuconfig would be very handy. Type / (slash) and enter keywords.

Copy sample main.c from (Zephyr_Root)/samples/net/dhcpv4_client and build it. You should be able to see the dhcp client is working.
1 [00:00:00.005,549] <inf> net_dhcpv4_client_sample: Run dhcpv4 client 2 [00:00:06.027,746] <inf> net_dhcpv4: Received: 10.1.1.38 3 [00:00:06.027,785] <inf> net_dhcpv4_client_sample: Your address: 10.1.1.38 4 [00:00:06.027,787] <inf> net_dhcpv4_client_sample: Lease time: 43200 seconds 5 [00:00:06.027,801] <inf> net_dhcpv4_client_sample: Subnet: 255.255.255.0 6 [00:00:06.027,817] <inf> net_dhcpv4_client_sample: Router: 10.1.1.1
Zephyr has a concept of subsystem, which runs in parallel with the main thread. Shell is a subsystem, something akin to Unix shell. When used with networking, it provides very convenient ways to test and debugging.
To activates the networking shell, choose NET_SHELL. Rebuild and flash it. You will notice that now UART connection works as a shell.

For example, enter command net iface, you will get

Unfortunately this shell is not as reliable as you may wish as of this writing. I have seen some strange things, which might be related to logging features or mate terminals. It certainly will be a valuable tool for debugging in the future.
