LinuxQuestions.org
Review your favorite Linux distribution.
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 01-16-2008, 10:02 AM   #1
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Rep: Reputation: 35
Two network interfaces - how do I change the primary one?


I am running Centos 5.1 on a box with two network cards each connected to different networks. After booting, the wrong network card (eth1) is the primary interface (the last one to be activated, presumably). How do I get Centos to choose the other one?

Adding a couple of lines to /etc/rc.local works:

ifdown eth0
ifup eth0

... but that just does not seem like the proper way to do this.

Oh, and I'm not looking for "why don't you just switch the network cables?" ... that would work, but I've got reasons for not wanting to do that. I want eth0 to be the primary interface.

Please help.

Thanks,
Apollo
 
Old 01-16-2008, 10:13 AM   #2
wildcat22
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu
Posts: 102

Rep: Reputation: 15
I guess I'm curious as to what you need from a "primary" interface.

From a routing point of view, your primary interface is the one that your default route will go out, and your secondary interface will support other routes that might be faster, and those routes are set specifically.

I should point out that it's a bit of a no-no for a host to have two live interfaces (see "multihoming"). However, in your case, I'm assuming that one network is the open world, and the other is some closed link (logically or physically...).

After all that babbling, I would play around with the routing table.
 
Old 01-16-2008, 11:26 AM   #3
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Original Poster
Rep: Reputation: 35
eth0 is the WAN (open world). eth1 is a local network. I can access the box from both sides just fine. However, DNS requests, for example, are being sent via eth1. I want them to go out on eth0.
 
Old 01-16-2008, 12:36 PM   #4
wildcat22
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu
Posts: 102

Rep: Reputation: 15
You can just set your default route to go out that interface.

Any other services you use on your local side (mail for instance) you can set up specific routes for.

I found these links pretty easily, rather than remembering them off the top of my head:

http://www.linuxquestions.org/questi...or-eth1-95114/
http://www.cyberciti.biz/faq/linux-s...route-command/
 
Old 01-16-2008, 12:41 PM   #5
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Original Poster
Rep: Reputation: 35
haha. Well, after saying i didn't want to hear "why don't you just switch the network cables?" ... that's exactly what I did. I won't give the details, but it meant I had a few other minor hoops to jump through on my particular setup, but it all took about 10 minutes. Problem solved. Now I simply have the WAN on eth1.
 
  


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 do I change a user's primary group? Akhran Linux - Newbie 4 03-19-2010 08:54 PM
Cannot change gateway on two different interfaces? Risc91 AIX 4 07-03-2007 03:14 PM
Possible to use two network interfaces (one primary, one for backup)? massysett Linux - Networking 2 01-12-2006 09:01 PM
Change my primary soundcard Zero007 Linux - Hardware 2 09-13-2004 10:52 PM
How to change primary boot option BW~Merlin Linux - Newbie 6 07-23-2004 06:46 AM

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

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