Dear friends, is it mandatory to provide GATEWAY in the ethernet settings of orduino board along with mac address ,subnetmask,ip address? What to do if my gateway is dynamic and changing ie. not fixed?


The gateway parameter is only required if you need to use the subnet parameter. From

Ethernet.begin(mac, ip);
Ethernet.begin(mac, ip, dns);
Ethernet.begin(mac, ip, dns, gateway);
Ethernet.begin(mac, ip, dns, gateway, subnet);

So those are your options of which parameters you can use.

If you do not use a gateway parameter in the begin call, it will use your IP with the last octet set to 1 as the default. So if you use an IP of, the begin call sets your gateway to

If your gateway changes, maybe you should consider using DHCP to get your network settings.