Hello @James Higgins Maybe the below response is helpful, which was posted a few months ago.? but the below post only talks about the MAC address, I have to check on the gateway details.
May be this SO post help: https://stackoverflow.com/questions/29249665/how-to-get-gateway-ip-and-nameserver-ip-using-ioctl-in-linux?noredirect=1&lq=1