How to make my default gateway permanent in CentOS? So that after a reboot it does not get lost

If i've read your question right, i think you want to add

GATEWAY=192.168.2.3

into /etc/sysconfig/network then reboot or do service network restart to test it.

Although i'm not entirely sure from your question that you do actually want a default gateway at all. I think you may just want to make a static route permanent ?


If anyone is running CentOS with multiple NICs, only 1 is connected to the Internet and you want to make that particular interface to take all the Internet traffic, then add following line in to your /etc/sysconfig/network file:

GATEWAYDEV=network_interface
GATEWAY=default_gateway_ip

Save and restart your network services. This worked for me and nothing else was working.