To set a default gateway on a Debian or Ubuntu Linux system, you can use the route command.
ip a command to list all the network interfaces:ip a
The output will list the names of the network interfaces, along with their status and IP address information.
route command to add the default gateway:sudo route add default gw GATEWAY_IP_ADDRESS DEVICE_NAME
Replace GATEWAY_IP_ADDRESS with the IP address of the default gateway and DEVICE_NAME with the name of the network interface that you want to set the default gateway for.
For example, to set the default gateway to 192.168.1.1 for the eth0 interface, you would run:
sudo route add default gw 192.168.1.1 eth0
/etc/network/interfaces file. For example, to set the default gateway for the eth0 interface:auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
Save the file and exit. The default gateway will now be set automatically on boot.