FANDOM


DHCP initialisation and usageEdit

I've found very little documentation here or on the web about how to migrate from a Static IP design to a DHCP design. I suggest we insert a code clipping something like this:

	netif_add(&netif_eth0, NULL, NULL, NULL, NULL, ethernetif_init, ip_input);
 	netif_set_default(&netif_eth0);
 
 #if 0
 	// Static address
 	struct ip_addr my_ipaddr;
 	struct ip_addr my_netmask;
 	struct ip_addr my_gw;
 
 	IP4_ADDR(&my_ipaddr,  192, 168, 0, 2);
 	IP4_ADDR(&my_netmask, 255, 255, 0, 0);
 	IP4_ADDR(&my_gw,      192, 168, 0, 1);
 	
 	netif_set_addr(&netif_eth0, &my_ipaddr, &my_netmask, &my_gw);
 	netif_set_up(&netif_eth0);
 #else
 	// Dynamic address
 	dhcp_start(&netif_eth0);
 #endif
 
 

PS: Is the example above Best Practice? --Mischief 11:02, 3 January 2008 (CST)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.