To get the IP address on a ubuntu machine we use the command:
$ ifconfig
To get the gateway details, we use the command:
$ route -n
To change the gatway, we use the following commands
$ sudo route del default
$ sudo route add default gw <new-gateway-address>
Cheers.