“UNIX is UNIX isn’t it?” How many times have I heard that said? Well, no it isn’t actually, as most vendors have their own ways of configuring things like networking on their now highly evolved individual flavours of UNIX. Even Linux differs between distro.
Here’s a quick reference to where the default gateway is set. Don’t forget to restart networking. For more advanced routing, configure static routes (link at bottom of post).
AIX
smitty mktcpip
HPUX
set_parms addl_network
Solaris
Edit the /etc/defaultrouter file
Red Hat Linux
Edit the /etc/sysconfig/network file
Add line GATEWAY=192.168.0.1
Debian/Ubuntu
Edit the /etc/network/interfaces file
Add line gateway 192.168.0.1
Restart Networking
You’ll need to restart networking to make these changes take effect. This can generally be achieved with the
AIX: Performed within smitty mktcpip
HPUX: /etc/init.d/net restart
Solaris: svcadm restart physical
RedHat: /etc/init.d/network restart or service network restart
Debian/Ubuntu: /etc/init.d/networking restart
Configuring Static Routes in multi-homed systems.
For more advanced networking with systems containing multiple NICs connecting to multiple VLANs and subnetworks, you’ll need to configure static routes to effectively send the data destined for a machine in such-and-such a network out through the correct NIC. More can be found on this here…