Skip to content

Commit 7afbc49

Browse files
pfalcondpgeorge
authored andcommitted
zephyr/prj_base.conf: Enable DHCP and group static IPs together.
Add CONFIG_NET_DHCPV4, which, after zephyrproject-rtos/zephyr#5750 works as follows: static addresses are configured after boot, and DHCP requests are sent at the same time. If valid DHCP reply is received, it overrides static addresses. This setup works out of the box for both direct connection to a workstation (DHCP server usually is not available) and for connection to a router (DHCP is available and required).
1 parent 0e52ee9 commit 7afbc49

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

ports/zephyr/prj_base.conf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,22 @@ CONFIG_NET_APP_SETTINGS=y
3232
CONFIG_NET_APP_INIT_TIMEOUT=3
3333
CONFIG_NET_APP_NEED_IPV6=y
3434
CONFIG_NET_APP_NEED_IPV4=y
35-
CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1"
36-
CONFIG_NET_APP_MY_IPV4_ADDR="192.0.2.1"
37-
CONFIG_NET_APP_MY_IPV4_GW="192.0.2.2"
3835

3936
# DNS
4037
CONFIG_DNS_RESOLVER=y
4138
CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2
4239
CONFIG_DNS_SERVER_IP_ADDRESSES=y
40+
41+
# Static IP addresses
42+
CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1"
43+
CONFIG_NET_APP_MY_IPV4_ADDR="192.0.2.1"
44+
CONFIG_NET_APP_MY_IPV4_GW="192.0.2.2"
4345
CONFIG_DNS_SERVER1="192.0.2.2"
4446

47+
# DHCP configuration. Until DHCP address is assigned,
48+
# static configuration above is used instead.
49+
CONFIG_NET_DHCPV4=y
50+
4551
# Diagnostics and debugging
4652

4753
# Required for zephyr.stack_analyze()

0 commit comments

Comments
 (0)