Simply spoken, if you don't use DHCP there must be a configurationfile somewhere in your system where the gateway is specified. For example in Slackware there is a /etc/rc.d/rc.inet1.conf with a line:
where I can insert my gateway (if I didn't use DHCP).
Markus