LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   setting the default GW permanently (https://www.linuxquestions.org/questions/linux-networking-3/setting-the-default-gw-permanently-363320/)

hcclnoodles 09-14-2005 11:20 AM

setting the default GW permanently
 
Hi there

When setting up my Fedora Core 3 system I accidentally set my default gateway to the wrong address, so the first thing i did when i booted up was to delete the old gateway

"route del -net 0.0.0.0"

and then set a new one .......

"route add default gw 87.x.x.129 netmask 0.0.0.0 eth0"


however, when I reboot, the original (wrong) gateway address comes back again ??

does anybody know which file I edit to set this permanetly ????

any help woul;d be greatly appreciated

Gary

Snowbat 09-14-2005 11:49 AM

Assuming it's the same as Mandriva, look in /etc/sysconfig/network

hcclnoodles 09-14-2005 11:59 AM

ok as far as im aware it should indeed be in etc/sysconfig/networking/devices but that directory is empty !!

Somebody said on another forum said create a file called ifcfg-eth0 (as eth0 is one of my nic id's) and in that file create a line

GATEWAY=x.x.x.x

but....a) this doesnt work and b) Id like to know where the existing information is stored ....it must be somewhere !!!!!!!!!

Snowbat 09-14-2005 02:04 PM

Google indicates /etc/sysconfig/static-routes is another possibility.

Or use grep to find the file - replace IP address below with your wrong gateway:
grep -r '192.168.1.1' /etc/sysconfig

linuxmanju 09-15-2005 04:39 AM

Well if its not a great solution but this should work. U can put a executable shell script which should read some thing like this
route del default
route add default gw X.X.X.X
and put that file in init.d/ and add that file name along with the path in rc.local
make sure that u make it executable ( The file) run chmod a+x routingfile

linuxmanju 09-15-2005 04:58 AM

ok as far as im aware it should indeed be in etc/sysconfig/networking/devices but that directory is empty !!
--------------------------------------------------------
By the way isnt it /etc/sysconfig/network-scripts/ifcfg-ethX
where u should look at
:)

abhijeetudas 09-15-2005 09:38 AM

Best thing is


make sure that ..

/etc/sysconfig/network-scripts/ifcfg-ethX

of all the files only one of these files have a
GATEWAY=x.y.z.a



and no other file has that keyword in it.

that should about do it.


All times are GMT -5. The time now is 04:42 PM.