LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-27-2007, 11:23 PM   #1
combilli
Member
 
Registered: Oct 2006
Posts: 75

Rep: Reputation: 15
how to save modified routing table


There was a server with 1 LAN card hosting 2 IPs.

In the setup stage, I've assigned 1 IP set.
(e.g 192.168.1.10/24, Gateway = 192.168.1.1)

After finished, I set the lan card hosting another IP set. (using internet IP)

Now, I got the problem is when I use route check the routing table, there is 2 gateway, 1 with the orignal internal gateway, another is the real IP gateway..

The server now go to internet using the internal gateway.
I don't want this, so I use the command:

ip route show then use ip route delete the internal gateway.

It's ok, I use traceroute see that now server go to internet using the real IP gateway.

But this routing does not save after reboot.(Bad luck today got a power failure, so after server restart , I have to remove the route again.)

How can the route be saved? So that if server is restarted, I don't need to remove a route again.(Too bad power guy will come to check power issue and need to cut the power on Saturday again ...)
 
Old 06-28-2007, 02:04 AM   #2
combilli
Member
 
Registered: Oct 2006
Posts: 75

Original Poster
Rep: Reputation: 15
Modified the network file

I found there is a file "network" in /etc/sysconfig

There is a Gateway setting there. And the ip was internal ip that I don't want it.

I've changed to another IP which I want that to be the internet gateway. I think I need to restart the server to see if it take effects. But I'm didn't have the chance to do it yet..

If I'm wrong plz someone told me.
 
Old 06-28-2007, 02:28 AM   #3
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
I don't know if that is the right file, but if you have local access to that computer (i.e. you are not remotely ssh'ing into it) I doubt you would hurt anything by trying.

In the future, it would be useful if you mentioned what distro you are using. Different distros use different config files for this.

From the file you mentioned, I wonder if you are running RH. If so, if changing the file you mentioned doesn't work, look in the /etc/sysconfig/network-scripts directory for any filename that starts with ifcfg- and see if there is anything the looks useful in it.
 
Old 06-28-2007, 04:29 AM   #4
combilli
Member
 
Registered: Oct 2006
Posts: 75

Original Poster
Rep: Reputation: 15
I'm using CentOS

Yea.. I'm using RH class linux. CentOS 4

I've tried on modifing /etc/sysconfig/network-script/ifcfg-eth0

I use 1 lan card host 2 IP..

with 2 files ifcfg-eth0 and ifcfg-eth0:1


with ifcfg-eth0:1

It was orignally have a gateway setting.
I've used the "#" to comment that line. But after reboot, I type route, that gateways is still there. I have to use ip route delete that gateway to prevent the server access internet from the wrong router.
 
Old 06-29-2007, 01:03 AM   #5
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by combilli
I've used the "#" to comment that line. But after reboot, I type route, that gateways is still there. I have to use ip route delete that gateway to prevent the server access internet from the wrong router.
You could try actually changing that line to the correct value and see if it helps. You could also look for the graphical tool to set this (not my favorite solution!). If you are not running X Window, you could bring it up temporarily to look for this tool. You could then use the find command to see what file(s) changed for futute refernece.

There's another really cheap hack you could use. I am almost embarrassed to suggest it, but it might get you up and running until you find the real solution. You could put the ip command that corrects your default route in your rc.local file. That will probably get you running at boot. But if for some reason you network service is to go down and come back up, you'll likely have the wrong route again.
 
Old 07-02-2007, 10:38 PM   #6
combilli
Member
 
Registered: Oct 2006
Posts: 75

Original Poster
Rep: Reputation: 15
I've tried set gateway the same in both ifcfg-eth0 / ifcfg-eth0:1

then restart and the gateway I don't want disappear.. it's ok now.
 
Old 07-02-2007, 10:52 PM   #7
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by combilli
I've tried set gateway the same in both ifcfg-eth0 / ifcfg-eth0:1

then restart and the gateway I don't want disappear.. it's ok now.
Good show! I'll try to file this new info away in my cobweb filled brain.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to save routing table entries? drgowans Linux - Networking 7 02-26-2019 06:16 PM
routing table selie Linux - Networking 2 05-04-2007 09:12 AM
How do i save my routing table? Titanas25 Linux - Newbie 2 04-19-2006 03:08 AM
Save last modified to a variable twantrd Programming 2 03-31-2004 03:57 AM
vi won't save modified file. mimsmall Linux - General 1 03-26-2004 10:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration