[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Switching between two network cards



Karl E. Jorgensen wrote:

On Thu, Oct 07, 2004 at 10:54:35PM +0200, Andrei Badea wrote:

...
I've got two network cards: one integrated on my motherboard (uses the sk98lin driver) and a PCI card (fealnx driver). Both drivers are compiled as modules and upon startup I'm loading only fealnx via /etc/modules (I'm not loading sk98lin at all). The network runs fine.

After my system starts, I want to switch to the other network card (the sk98lin one), but I only want its module loaded, so I do:

ifdown eth0
rmmod fealnx
modprobe sk98lin
ifup eth0

Why not load *both* modules all the time (i.e. put them both in
/etc/modules), and then simply use:
    ifdown eth0
    ifup eth1
and
    ifdown eth1
    ifup eth0
to switch?

The order in /etc/modules then dictates which one becomes eth0 and which
one becomes eth1.

This works fine, however, I wanted to have only one module in memory since I'm only needing one. More about this at the end of my reply.

It sounds like the two drivers are dissagreeing with being unloaded, but
there isn't much to go on.  Do you get anything in dmesg (~
/var/log/kern.log) when you load/unload the modules?  Is it different if
you boot with the "other" module loaded?

Whoops, dmesg shows this when unloading sk98lin:

Badness in remove_proc_entry at fs/proc/generic.c:692
 [<c01726c3>] remove_proc_entry+0xfa/0x137
 [<e08df2e1>] skge_cleanup_module+0xcd/0x1db [sk98lin]
 [<c0127aee>] sys_delete_module+0x143/0x17b
 [<c013cd4c>] do_munmap+0x142/0x17f
 [<c010590f>] syscall_call+0x7/0xb

This would mean that sk98lin doesn't like to be unloaded, so I can't boot with sk98lin, then unload it and load fealnx and expect it to work. However, I could at least expect the opposite order (boot with fealnx, unload it and load sk98lin) to work, but it doesn't either. Fealnx doesn't give any error messages, even when I load it with debug=1.

To conclude, loading both modules on startup and then switching their loading order causes both eth0 and eth1 to stop working.

Messages in dmesg say the network is up and running. But it isn't, it seems I can't ping nor make net connections. However, when I (for example) run a ping and look at the LEDs on the card, I see them bliking in the "ping" way. I can also see the echo request and reply packets in tcpdump. But ping doesn't get them and reports 100% loss.

!? If this is tcpdump on the same machine, then I'm thoroughly
confused..

Yep, this is tcpdump on the same machine. It behaves a litte strangely though. About 20 seconds after I run it, it doesn't show any packets, though I have a ping running in another terminal. It doesn't respond to Ctrl+C in these 20 secs.

If this is tcpdump on another box on the same network (more likely I
hope), then the firewalling rules should be eyeballed.

and which maching is doing the pinging?

My machine.

If I unload sk98lin and reload fealnx, the net works fine. Now comes the interesting part: if I put sk98lin in /etc/modules instead of fealnx and restart, the net comes up. Only this time I can't switch to fealnx. This shows both the cards are working.

Have you ever had both working at the same time?

I loaded both modules and switch from eth0 to eth1 and backwards using ifup/ifdown. This works.

I thought this was caused by iptables settings, so after loading the other module I rerun the script which setups my firewall rules. Didn't help.

Assuming that you use the same firewalling rules all the time, that
indicates that the firewalling rules are not the problem here.

But you can make your firewalling rules generic by specifying "eth+"
rather than "eth0" (i.e. it will match all interfaces starting with
"eth").

I don't specify the interface in any of my firewall rules.

To completely eliminate the possiblity of bad firewalling rules, you
could try clearing them
    /etc/init.d/iptables clear
and try again. I'm not 100% sure that the firewalling rules can be
eliminated as the cause.

A related question: How do you reload the firewalling rules? Are they
being cleared down first? i.e. is there an "accumulative" effect going
on here?

I have a Bash script containing iptables calls. Its first commands are:

iptables -F
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

Not that is it important, as my net is running with any of the cards if I restart, I'm just curious. However, I'd like to point out that I don't want both modules to be loaded. I want to be able to unload the running one and load another without having to restart.

But why insist on unloading the "other" module? Why isn't "ifdown"
sufficient?
I assume that there is a reason (surely it cannot be because you don't
want an eth1, is it?), but it is not clear from your post.
There may be different ways of solving your original problem

PS: Why put an extra network card in the box if you only want to use one
    network at any given time?

This is not a problem actually. I had a PCI card in my machine and I recently bought a mainboard which contains an integrated NIC. Having the module for the PCI card (fealnx) loaded, I wanted to test the integrated NIC. My first idea was: unload fealnx, load sk98lin, ifup eth0, it should work. It didn't, and because I like solving mysteries and I also want to learn as much as possible about Linux, I wanted to find out why. That's all. It's not a problem, since I can get my network to work, and I'll take the old PCI card out of my computer soon.

Thank you for help anyway!

Andrei

--
andrei.badea@movzx.net # http://movzx.net # ICQ: 52641547

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: