theoretically it should be possible to set a default gateway with ifconfig

ifconfig [-a] [-s] [--help] [--version] {interface} [address] [netmask{address}] [gateway{address}] [tftpserver{address} ] [[up] | [down]]

Set a fixed ip, activate network card and add default gateway

this will:

1. set a fixed ip

2. define a default gateway

3. define the default gateway as dns

ifconfig eth0 192.168.1.123 netmask 255.255.255.0 up; # set fixed ip for eth0 and activate the device
route add default gw 192.168.1.1; # set default gateway
cat "nameserver 192.168.1.1" >> /etc/resolv.conf; # default gateway is usually dns server

with dns you do not have to up down the interface… it works directly after you have modified the file.

Links:

http://www.tecmint.com/ifconfig-command-examples/

admin