LinuxQuestions.org
Review your favorite Linux distribution.
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-05-2008, 12:45 PM   #1
Hosferatu
Member
 
Registered: Sep 2007
Posts: 32

Rep: Reputation: 15
"ip route add" doesn't keep changes on network restart


I have 2 adapters, one on a private ip, and one on a public ip. Every time my machine reboots or I restart the network adapters, the default route goes back to my private network. I have to manually set it to use the adapter on the public network with

ip route add default via [gateway ip] dev eth0

as soon as i restart anything, it is gone again. How can i make these changes permanent? I put the above line in rc.local to fix it for now but that seems like a silly way to do it, it also makes ntpdate wait forever to time out on startup. Am i missing a step to make it save the changes?

thanks
 
Old 06-05-2008, 01:19 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you've not said what distro you are using, but you'd want to formally set a default gateway in /etc/sysconfig/networks in fedora / redhat etc... that's if you have completely static IP addressing. DHCP should take care of this normally.
 
Old 06-09-2008, 03:54 PM   #3
Hosferatu
Member
 
Registered: Sep 2007
Posts: 32

Original Poster
Rep: Reputation: 15
Oh, yes i am using redhat.

do i just add a line like
GATEWAY=IP
or is there someplace where i can get a list of variables i can set in the network file?
 
Old 06-10-2008, 03:27 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
That'd be the right format AFAIR. but that would normally be automatically entered by using a gui tool e.g. system-config-network. personally i'd just go direct to the file though...
 
Old 06-11-2008, 12:52 AM   #5
Hosferatu
Member
 
Registered: Sep 2007
Posts: 32

Original Poster
Rep: Reputation: 15
Thanks, that seems to have fixed the issue.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
counter part of "service network restart" b0nd Slackware 5 10-10-2005 06:47 AM
"route add default gw" - trouble Vijayasarathy Linux - Networking 2 03-23-2005 07:54 AM
Route to subnet exists but I get "Network unreachable" when adding default route fciuffani Linux - Networking 4 08-18-2004 02:11 PM
"route add" gets reset at reboot trees Linux - Networking 5 01-21-2004 04:18 PM
Permanently set "route add" -host and default gw sacants Linux - Newbie 1 07-18-2003 04:04 AM

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

All times are GMT -5. The time now is 05:01 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