10 years, 9 months ago.

how to print netmask and gateway?

how do you print the "NETMASK" and "Gateway" in EthernetInterface?

printing IP is relatively

printf("IP Address is %s\n", eth.getIPAddress());

but for netmask and gateway?

1 Answer

10 years, 7 months ago.

EthernetInterface can be enhanced to allow this.

Looking at the implementation for EthernetInterface.getIPAddress(), leads to netif_status_callback() which fills in the IP address when DHCP completes from the netif structure. Similarly, you can extract the netmask and gw from the same structure, store in locals, and implement getGateway() and getNetmask() so you can retrieve them.