LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-08-2013, 01:05 PM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,674

Rep: Reputation: 47
Is it better to set the default gateway in network-scripts or network


Other than having to set the variable in each ifcfg file in /etc/sysconfig/network-scripts VS. just setting it in /etc/sysconfig/network, is there an advantages/disadvantages of where to actually set it? or is one spot more a "best practice" than the other? Or do you need to put it in both spots? I've seen articles online where it has you add it in both locations, or some just in the network file.
 
Old 03-08-2013, 01:51 PM   #2
becatini
LQ Newbie
 
Registered: Mar 2013
Posts: 1

Rep: Reputation: Disabled
Hi.

I use only /etc/sysconfig/network to configure the gateway and I have had no problems.
 
Old 03-08-2013, 02:08 PM   #3
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,674

Original Poster
Rep: Reputation: 47
I have it set in every which way between those two areas and can't really say i've ever had problems either. I just wonder if one way is the "right" or "ideal" way?
 
Old 03-08-2013, 09:35 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 11,677
Blog Entries: 12

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
I think that, if you are using static IP, you should set it in the network configuration of the computer or the computer can't find the router.

With DHCP, the computer will get it via DHCP.

I didn't check the docs, but that's what I remember from experience.
 
Old 03-08-2013, 11:29 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
From my experience, it doesn't really matter, but I usually set it in /etc/sysconfig/network. Note that the file layout you mentioned is specific to Red Hat derivatives. Debian based systems (and others) use totally different files by default for defining network configuration.
 
Old 03-09-2013, 07:30 AM   #6
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,674

Original Poster
Rep: Reputation: 47
Thanks guys. I've always set it in both spots in RHEL just because I wasn't sure if not setting it in either would cause a problem later down the road haha.
 
  


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
How to set ip, netmask,gateway for a network interface ghoshdastidar1980 Linux - Newbie 2 10-03-2012 02:22 AM
gateway setting ./network-scripts/ifcfg-eth1 and ./network joshfields Linux - Networking 1 04-29-2012 05:27 AM
Network problem with DNS and default gateway ip on VM cprusty Linux - Networking 5 09-21-2011 10:58 AM
Help to set up Linux Box As a network gateway pbhat Linux - Networking 3 05-17-2009 03:41 AM
How to add default gateway in /etc/sysconfig/network-scripts/* zamri Linux - Networking 2 09-06-2005 11:32 AM


All times are GMT -5. The time now is 10:09 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration