Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
selecting a different device for eth0
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
MBMarduk
Tux's lil' helper
Tux's lil' helper


Joined: 04 Jan 2003
Posts: 80
Location: NL

PostPosted: Wed Apr 28, 2004 12:29 am    Post subject: selecting a different device for eth0 Reply with quote

Hey peeps!
I've tried to switch 'eth0' and 'eth1' in my /etc/conf.d/net config file but this doesn't work; I can't ping anything or resolve anything.
I'm trying to make a different NIC act as eth0 (my main IFace to the internet), eth1 is my internal network (192.168.0.xxx)

What can I do?
Back to top
View user's profile Send private message
EliasP
Guru
Guru


Joined: 06 Dec 2002
Posts: 318
Location: South-West Germany

PostPosted: Wed Apr 28, 2004 6:29 am    Post subject: Reply with quote

Have you set your gateway??

Greetings

Elias P.
Back to top
View user's profile Send private message
JudgeNik
Tux's lil' helper
Tux's lil' helper


Joined: 02 Mar 2004
Posts: 86
Location: Bolzano, Italy

PostPosted: Wed Apr 28, 2004 7:15 am    Post subject: card config Reply with quote

What is the current setup?

eth0 is a NIC that connects to a network that has the internet?

eth1 is a NIC that connects to your home network?

What do you want it to be?

Pinging not working could be you haven't set up your connections properly. DNS not resolving either means not connected to a network with the DNS server you have got specified in /etc/resolv.conf or that you haven't specified one.
_________________
See the famous Niko Roberts at http://www.nikoroberts.com
Back to top
View user's profile Send private message
jtravs
n00b
n00b


Joined: 26 Apr 2004
Posts: 7
Location: London

PostPosted: Wed Apr 28, 2004 7:27 am    Post subject: Hmm Reply with quote

Hi, I once tried to do this and came to the conclusion that you couldn't (unless maybe you force the kernel to load modules in a specific order). Why can't you just make eth1 the internet interface and eth0 your home interface as other than the name there is no difference (of course you have to swap the names in any pre-configured firewall scripts, or just use the lovely smoothwall...)

J
Back to top
View user's profile Send private message
MBMarduk
Tux's lil' helper
Tux's lil' helper


Joined: 04 Jan 2003
Posts: 80
Location: NL

PostPosted: Wed Apr 28, 2004 12:41 pm    Post subject: Reply with quote

JTravs nearly got it right:
I DONOT want to change the NUMBERS in eth0, eth1, eth2 etc...
I want to change WHICH PIECE OF HARDWARE gets to "be" eth0

In my case I have an on-board SiS900 controller and a PCI 3Com card.
The SiS900 ALWAYS becomes eth0 and therefore the 3Com ALWAYS becomes eth1. WHY?

I want the fancy 3Com card to handle my internet as eth0 and I want the CPU-hogging SiS900 to handle my internal network as eth1.

Quote:

blackheart / # lspci
0000:00:00.0 Host bridge: Silicon Integrated Systems [SiS] 735 Host (rev 01)
0000:00:01.0 PCI bridge: Silicon Integrated Systems [SiS] Virtual PCI-to-PCI bridge (AGP)
0000:00:02.0 ISA bridge: Silicon Integrated Systems [SiS] SiS85C503/5513 (LPC Bridge)
0000:00:02.2 USB Controller: Silicon Integrated Systems [SiS] USB 1.0 Controller (rev 07)
0000:00:02.3 USB Controller: Silicon Integrated Systems [SiS] USB 1.0 Controller (rev 07)
0000:00:02.5 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE] (rev d0)
0000:00:03.0 Ethernet controller: Silicon Integrated Systems [SiS] SiS900 PCI Fast Ethernet (rev 90)
0000:00:0b.0 Ethernet controller: 3Com Corporation 3c905B 100BaseTX [Cyclone] (rev 34)

0000:00:0d.0 Multimedia audio controller: Ensoniq 5880 AudioPCI (rev 02)
0000:01:00.0 VGA compatible controller: nVidia Corporation NV5 [RIVA TNT2/TNT2 Pro] (rev 11)
blackheart / #


**************************************************************************************

Either this OR I would like to atleast properly use ANY other eth-number (like eth1) for internet access.
Back to top
View user's profile Send private message
MBMarduk
Tux's lil' helper
Tux's lil' helper


Joined: 04 Jan 2003
Posts: 80
Location: NL

PostPosted: Sun May 02, 2004 11:45 pm    Post subject: Reply with quote

Anyone?

It's really very simple:
BEFORE:
SiS900 = eth0
3Com = eth1

AFTER:
SiS900 = eth1
3Com = eth0

...so I can switch the cat5 cable.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 434
Location: Woonsocket, RI

PostPosted: Mon May 03, 2004 1:21 pm    Post subject: Reply with quote

Some suggestions:


  • Don't get hung up on Ethernet device names. There's no reason that eth0 has to be the device that's connected to the Internet. Swap the cables and then adjust the configurations in /etc/conf.d/net so that eth1 takes on the Internet address and eth0 takes on the local address.
  • If having eth1 as the Internet interface really offends you for some reason, try rebuilding your kernel with the 3Com driver built in and the SiS 900 driver built as a module. When the system boots, the in-kernel driver should register itself and grab the eth0 address, leaving eth1 for the SiS 900 driver when you load that module.
  • Adjusting aliases in /etc/modules.conf (or whatever /etc/modules.d file specifies them, really) should do the trick. It's that file, not /etc/conf.d/net, that sets the names of the Ethernet interfaces.
Back to top
View user's profile Send private message
neysx
Retired Dev
Retired Dev


Joined: 27 Jan 2003
Posts: 795

PostPosted: Mon May 03, 2004 1:48 pm    Post subject: Reply with quote

To put it simply, your nics will be named eth0,1... in sequence as they are discovered, well before the etc/init.d/net script is called.

If you compile them all in your kernel, you have no control over the sequence, live with it.

If you compile one into the kernel and one as a module, it is likely that the former will be eth0 and the latter eth1. I have never tried this way because it looks messy to have ethx loaded differently.

If you compile both as modules, eth0 will be assigned to the NIC whose module is loaded first. Edit /etc/modules.autoload.d/kernel-2.6 (or 2.4) to load the modules in the sequence you want.
Back to top
View user's profile Send private message
MBMarduk
Tux's lil' helper
Tux's lil' helper


Joined: 04 Jan 2003
Posts: 80
Location: NL

PostPosted: Mon May 03, 2004 2:59 pm    Post subject: Reply with quote

I thought that was what happened...

Anyhow I also tried just switching the cable and the "ethx" pieces in /etc/conf.d/net but I can't ping or resolve anything then. What am I missing?
Back to top
View user's profile Send private message
yottabit
Guru
Guru


Joined: 11 Nov 2002
Posts: 313
Location: Columbus, Ohio, US

PostPosted: Sun Nov 05, 2006 11:50 pm    Post subject: Reply with quote

Just saw this post while searching around to control which NIC is assigned as eth0 v. eth1. My problem is that it seems to me that of my two built-in NICs in my server, it seems fairly random which one gets assigned as eth0 and eth1...

There *must* be a way to assign the eth? number by MAC, right??? This server will be placed in a co-lo 1,100 miles away from me, and initially only one NIC will be connected, so I can't afford to have eth0 spontaneously become eth1, and vice-versa...

J
_________________
Play The Hitchhiker's Guide to the Galaxy!
Back to top
View user's profile Send private message
pingu
Retired Dev
Retired Dev


Joined: 06 Nov 2006
Posts: 11

PostPosted: Mon Nov 06, 2006 5:27 am    Post subject: Reply with quote

You can do what you're asking with udev rules, assuming you have a recent 2.6 kernel. You should be able to modify this to suit your needs: http://www.reactivated.net/writing_udev_rules.html#example-netif
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum