[En-Nut-Discussion] Setting the gateway

Ulrich Hertlein ulrich.hertlein at artcom.de
Wed May 10 13:53:48 CEST 2006


scostas wrote:
> I'm setting manually the parameters of the network each time I boot the
> ethernut, using NutNetIfConfig. But now I need to set a gateway. How can
> I set it?

I do it like this:
puts_P(PSTR("Configure eth0..."));
u_char mac[6] = MY_MAC;
u_long addr = inet_addr(MY_IPADDR);
u_long mask = inet_addr(MY_NETMASK);
u_long gateway = inet_addr(MY_GATEWAY);
NutNetIfConfig2("eth0", mac, addr, mask, gateway);
puts_P(PSTR("OK"));

-- 
Ulrich Hertlein | Software Development

ART+COM AG
Kleiststr. 23-26 | 10787 Berlin | Germany

phone: +49.30.21001-433
fax: +49.30.21001-555
http://www.artcom.de



More information about the En-Nut-Discussion mailing list