Red Hat / CentOS Linux Setting a Default Gateway

Posted on in Categories , , , last updated November 19, 2007

Q. How do I setup up a default Gateway for all interfaces (eth0 and eth1) under CentOS Linux 5?

A.There are different ways to setup TCP/IP hosts so that you can reach to remote destinations. The simplest one is to setup default gateway by modifying the /etc/sysconfig/network

Setup a default Gateway

Open /etc/sysconfig/network file:
# vi /etc/sysconfig/network
Setup GATEWAY={Router-IP}, if router IP is, type:
Save and close the file. Here is my complete file:

You need to restart networking service:
# /etc/init.d/networking restart