LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 12-31-2008, 02:07 PM   #1
huntkey
LQ Newbie
 
Registered: Dec 2008
Posts: 19

Rep: Reputation: 1
Where should I configure the default gateway, "ifcfg-eth0" or "network"?


Got a (maybe) silly question here...

It seems that you can configure default gateway by putting a line "GATEWAY=X.X.X.X" in both /etc/sysconfig/network-scripts/ifcfg-eth0 and /etc/sysconfig/network files. What is the difference between these two types of setups (in case there are more than 1 ethernet cards)? Do they have to be both configured? Thanks!
 
Old 01-01-2009, 07:44 AM   #2
uks
Member
 
Registered: Jul 2007
Posts: 68

Rep: Reputation: 16
One possible difference that I see is that when you have this in the /etc/sysconfig/network it is not tied to an interface. but it is when you do it in the file /etc/sysconfig/network-scripts/ifcfg-eth0

--Ukesh Upendran

Last edited by uks; 01-01-2009 at 07:46 AM.
 
Old 01-02-2009, 06:50 AM   #3
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Rep: Reputation: 32
When you have multiple interface and traffic is routed though a different gateway for that very interface, the GATEWAY=x.x.x.x entry enables that. We can have different gateway for different interface this way.

GATEWAY=x.x.x.x entry in the /etc/sysconfig/network file configures the 'default' gateway. 'default gateway' is used route traffic though it, when it is not defined to go through a particular interface.
 
Old 01-02-2009, 11:30 PM   #4
huntkey
LQ Newbie
 
Registered: Dec 2008
Posts: 19

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by avijitp View Post
When you have multiple interface and traffic is routed though a different gateway for that very interface, the GATEWAY=x.x.x.x entry enables that. We can have different gateway for different interface this way.

GATEWAY=x.x.x.x entry in the /etc/sysconfig/network file configures the 'default' gateway. 'default gateway' is used route traffic though it, when it is not defined to go through a particular interface.
Thank you avijitp for your reply! But if it has multiple interfaces, how can the server know which one to use to route the packets? If I use the server as a proxy server and all internal networks are connected to one interface and another interface is connected to the Internet, should I just configure the default gateway under the ifcfg-eth0? Thanks!
 
Old 01-03-2009, 12:45 AM   #5
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Rep: Reputation: 32
It depends upon your configuration in the network side. How the cabling has been done. If you know that your traffic toward internet will be passing through the default gateway , then configuring the 'default gateway' in /etc/sysconfig/network will do. There is no need to configure gateway though the ifcfg-ethX files.

If traffic will be going through a different gateway which is connected to a particular ethX (say.. eth1), then you should set that Gateway in that interface ifcfg-eth1 file. The Internal packet routing is then handled by kernel. In this case other interface (say eth0) can be connected to internal network(s).
 
Old 01-05-2009, 09:41 AM   #6
huntkey
LQ Newbie
 
Registered: Dec 2008
Posts: 19

Original Poster
Rep: Reputation: 1
I see... Thank you guys!
 
  


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
net working eth0 eth1 wlan0 "no connection" "no LAN" "no wi-fi" Cayitano Linux - Newbie 5 12-09-2007 07:11 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
what is "/etc/sysconfig/network-scripts/ifcfg-eth0" its counterpart in slackware b0nd Slackware 2 10-06-2005 12:50 AM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 02:32 PM
"ifcfg-ethx" and "network-functions" files peok Linux - Networking 12 08-13-2003 06:06 PM


All times are GMT -5. The time now is 09:29 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration