<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>settings of 7002 static ip problem.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/122448/settings-of-7002-static-ip-problem</link><description>hi support team, 
 may i ask how to set static ip address for 7002? 
 1. i set these configs: 
 CONFIG_NET_CONFIG_SETTINGS =y 
 CONFIG_NET_CONFIG_NEED_IPV4 =y 
 
 CONFIG_NET_DHCPV4 =n 
 CONFIG_NET_CONFIG_MY_IPV4_ADDR = &amp;quot;192.168.50.90&amp;quot; 
 CONFIG_NET_CONFIG_MY_IPV4_NETMASK</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Jun 2025 10:21:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/122448/settings-of-7002-static-ip-problem" /><item><title>RE: settings of 7002 static ip problem.</title><link>https://devzone.nordicsemi.com/thread/540175?ContentTypeID=1</link><pubDate>Mon, 23 Jun 2025 10:21:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48eb4bd9-efd2-4f4d-ac0e-d16c9da2b71a</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]there will be error in log: that is 30 seconds gaps and shows error, also it will not connect to router.[/quote]
&lt;p&gt;Try setting:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NET_CONFIG_INIT_TIMEOUT=0&lt;/pre&gt;&lt;/p&gt;
[quote user=""]&lt;div&gt;2. and if i set CONFIG_NET_DHCPV4=y&lt;/div&gt;
&lt;div&gt;&lt;span&gt;the static ip address setting will be overwrite by dhcp:&lt;/span&gt;&lt;/div&gt;[/quote]
&lt;p&gt;This is expected when DHCP client is enabled.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To set static ip, you can use wifi/sta as an example.&lt;/p&gt;
&lt;p&gt;You will need to change the dhcp function in main.c to something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void print_dhcp_ip(struct net_mgmt_event_callback *cb)
{
#if defined(CONFIG_NET_DHCPV4)
	/* Get DHCP info from struct net_if_dhcpv4 and print */
	const struct net_if_dhcpv4 *dhcpv4 = cb-&amp;gt;info;
	const struct in_addr *addr = &amp;amp;dhcpv4-&amp;gt;requested_ip;
	char dhcp_info[128];

	net_addr_ntop(AF_INET, addr, dhcp_info, sizeof(dhcp_info));

	LOG_INF(&amp;quot;DHCP IP address: %s&amp;quot;, dhcp_info);
#endif
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And in prj.conf, you explicitly disable dhcp:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NET_DHCPV4=n&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And set your wanted IP address on the network that you&amp;#39;re connecting to:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_WIFI_CREDENTIALS_STATIC_SSID=&amp;quot;MY_SSID&amp;quot;
CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD=&amp;quot;MY_PASSWORD&amp;quot;

CONFIG_NET_CONFIG_MY_IPV4_GW=&amp;quot;192.168.32.1&amp;quot;
CONFIG_NET_CONFIG_MY_IPV4_ADDR=&amp;quot;192.168.32.9&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;My network is on 192.168.32.xxx&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;On a test-laptop, connected to the same network, I can then ping 192.168.32.9:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ ping 192.168.32.9
PING 192.68.32.9 (192.168.32.9): 56 bytes
64 bytes from 192.168.32.9: icmp_sec=1 ttl=64 time=53.068 ms&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>