Re: Switching between two network cards

2004-10-09 Thread Andrei Badea
Jason Rennie wrote:
On Thu, Oct 07, 2004 at 10:54:35PM +0200, Andrei Badea wrote:
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
I'm no expert in networking.  Might be totally off base here.  But,
could it be that fealnx gets eth0 and sk98lin gets eth1?  i.e. might
this work?
ifdown eth0
modprobe sk98lin
ifup eth1
This works. But I have to keep fealnx loaded, which is exactly what I 
don't want. If I unload fealnx before modprobing sk98lin, then sk98lin 
gets eth0 and it doesn't work.

Andrei
--
[EMAIL PROTECTED] # http://movzx.net # ICQ: 52641547


signature.asc
Description: OpenPGP digital signature


Re: Switching between two network cards

2004-10-09 Thread Andrei Badea
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
 [] remove_proc_entry+0xfa/0x137
 [] skge_cleanup_module+0xcd/0x1db [sk98lin]
 [] sys_delete_module+0x143/0x17b
 [] do_munmap+0x142/0x17f
 [] 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

Re: Switching between two network cards

2004-10-08 Thread Karl E. Jorgensen
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.

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?

Some modules can be enticed into giving more verbose information... I
don't have those modules available, but 
modinfo fealnx
modinfo sk98lin
should give information about the module-specific options. In either
case, the kernel docs for those modules should be handy...

> 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..

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?

> 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 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").

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?

> 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?

Hope this helps

-- 
Karl E. Jørgensen
[EMAIL PROTECTED]   http://karl.jorgensen.com
 Today's fortune:
When you say that you agree to a thing in principle, you mean that
you have not the slightest intention of carrying it out in practice.
-- Otto Von Bismarck


signature.asc
Description: Digital signature


Re: Switching between two network cards

2004-10-08 Thread Jason Rennie
On Thu, Oct 07, 2004 at 10:54:35PM +0200, Andrei Badea wrote:
> 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

I'm no expert in networking.  Might be totally off base here.  But,
could it be that fealnx gets eth0 and sk98lin gets eth1?  i.e. might
this work?

ifdown eth0
modprobe sk98lin
ifup eth1

I have a vaguely similar situation w/ my laptop...  When undocked, the
PCMCIA card gets eth0, when docked, the dock station ethernet gets
eth0 and PCMCIA card gets eth1.  I use the check-mac-address.sh script
to make sure that only the PCMCIA card gets networking.  Something
similar might work for you if you don't want fealnx to come up at all.

Jason


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Switching between two network cards

2004-10-07 Thread Andrei Badea
Steven Jones wrote:
I dont quite understand why you need to switch, you could just run everything off eth1, but anyway,
I don't need to switch. It's just that it's not doing what I think it 
should do and I want to know why.

I would suggest looking in your bios and either disabling the onboard NIC, or changing 
the PCI probe order eg if its says first-last change it to last-first or what ever 
syntax your bios uses.
However Its most likely that the onboard can simply be disabled in the bios.
I don't want to disable the onboard card. I have two different NICs in my 
computer using two different drivers and I want to load only _one_ of the 
drivers at a time and be able to switch among them:

load driver A (on startup)
... work
unload A, load B
... work
unload B, load A
... work
and so on. Again I have to mention it's rather an academic question - I 
don't really need it, I just want to know why it's not doing what I 
supposed it would do.

Best regards,
Andrei
--
[EMAIL PROTECTED] # http://movzx.net # ICQ: 52641547


signature.asc
Description: OpenPGP digital signature


RE: Switching between two network cards

2004-10-07 Thread Steven Jones
I dont quite understand why you need to switch, you could just run everything off 
eth1, but anyway,

I would suggest looking in your bios and either disabling the onboard NIC, or changing 
the PCI probe order eg if its says first-last change it to last-first or what ever 
syntax your bios uses.

However Its most likely that the onboard can simply be disabled in the bios.

regards

Steven

-Original Message-
From: Andrei Badea [mailto:[EMAIL PROTECTED]
Sent: Friday, 8 October 2004 9:55 a.m.
To: Debian User List
Subject: Switching between two network cards


Hello all,

this is not quite a Debian related problem (except that I'm running sid), 
but anyway... 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

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 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.

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.

I'm running Debian sid with self-compiled kernel 2.6.7.

Any ideas why this is happening? 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.

Thanks in advance!

Best regards,
Andrei

-- 
[EMAIL PROTECTED] # http://movzx.net # ICQ: 52641547