How to set the Default gateway

ifconfig is not the correct command to do that.

You can use route like in route add default gw 192.168.0.254 for example.

And if route is not present, but ip is, you can use it like this: ip route add default via 192.168.0.254 dev eth0, assuming that 192.168.0.254 is the ip of your gateway


ifconfig is deprecated on Linux and furthermore, it's the wrong tool for the job. To set the default gateway on Linux use the ip command as follows:

ip route add default via <host> dev <dev>

# e.g.
ip route add default via 192.168.0.101 dev eth0

For remove gateway in Linux Command : route delete default gw 192.168.1.1 eth1

For add gateway in Linux Command : route add default gw 192.168.1.250 eth1