Problem getting DHCP for second Ethernet card

Problem getting DHCP for second Ethernet card

Post by Grahame Coope » Sat, 08 Sep 2001 23:59:18



Hi,

I have a set up with two ethernet cards. One (eth0) has a static IP
address (192.168.0.1) and links to a LAN and the other (eth1) has a
dynamic IP address (DHCP) and links to the internet via a cable modem. I
am using ip forwarding, and eth1 is masqueraded using iptables. I am
running Mandrake Linux v8 (kernel 2.4).

My problem is this. During start-up, eth0 is brought up first, then eth1
is brought up. However, when eth1 is brought up, its DHCP requests are
routed through eth0 over the LAN rather than to the ISP's DHCP server
through eth1.

If I then shut down eth0, and try to restart eth1, the eth1 DHCP
requests now go through eth1 as required, but with a source address
192.168.0.1, so the DHCP still won't respond.

The only way I can get it to work is by disabling eth0, rebooting (at
which point eth1 starts up OK and gets its DHCP info), then start up
eth0 manually. (I then have to manually start up my local DHCP and DNS
for the LAN because they could not start up on the disabled eth0 during
the boot.)

I know I could swap over the ethernet interfaces so the eth0 becomes the
cable connection and eth1 becomes the lan connection, but before I do
that I just wondered if there is a way to force eth1 to make its DHCP
queries through itself using IP address 0.0.0.0 rather than through
eth0.

I'm sure I'm missing something that should be fairly obvious, but I just
can't see it.

Cheers, Grahame.

PS Thanks to Gerard Paul Java for his great iptraf program, which
allowed me to see what was going on!

 
 
 

Problem getting DHCP for second Ethernet card

Post by Cedric Blanche » Sun, 09 Sep 2001 00:16:02



Quote:> My problem is this. During start-up, eth0 is brought up first, then eth1
> is brought up. However, when eth1 is brought up, its DHCP requests are
> routed through eth0 over the LAN rather than to the ISP's DHCP server
> through eth1.

How do you issue your dhcp request ?
man dhcpcd :
[...]
SYNOPSIS
        dhcpcd     [-dknrBCDHRT]     [-t timeout]     [-c filename]
                [-h hostname]   [-i vendroClassID]    [-I clientID]
                [-l leasetime]     [-s [ipaddr]]    [-w windowsize]
                [interface]
[...]
        interface
                Specifies  the  network interface name (eth0, eth1,
                etc.).  dhcpcd  uses  the  network  interface  eth0
                unless an explicit name is specified.

Quote:> I'm sure I'm missing something that should be fairly obvious, but I just
> can't see it.

If you use pump, have a look at config file.

--
 Je vote [OUI] a la cration de fr.rec.chasse.newbies
 -+- AT in: Guide du Cabaliste Usenet - Bien configurer son newbie -+-

 
 
 

Problem getting DHCP for second Ethernet card

Post by Grahame Coope » Sun, 09 Sep 2001 02:11:57


Cedric,

Thanks for responding

I am using pump, and it has a command line option -i for specifying the
interface to be set up. I have examined the ifup script and the script does
indeed use this option, with the appropriate interface name, when it calls
pump. However, the DHCP call is still going out via eth0 instead of eth1.

As a temporary fix, I will append the manual startup things to the end of the
rc.local file and then keep searching for the correct answer.

Thanks for the help anyway. It is much appreciated.

Cheers,

Grahame



> > My problem is this. During start-up, eth0 is brought up first, then eth1
> > is brought up. However, when eth1 is brought up, its DHCP requests are
> > routed through eth0 over the LAN rather than to the ISP's DHCP server
> > through eth1.

> How do you issue your dhcp request ?
> man dhcpcd :
> [...]
> SYNOPSIS
>         dhcpcd     [-dknrBCDHRT]     [-t timeout]     [-c filename]
>                 [-h hostname]   [-i vendroClassID]    [-I clientID]
>                 [-l leasetime]     [-s [ipaddr]]    [-w windowsize]
>                 [interface]
> [...]
>         interface
>                 Specifies  the  network interface name (eth0, eth1,
>                 etc.).  dhcpcd  uses  the  network  interface  eth0
>                 unless an explicit name is specified.

> > I'm sure I'm missing something that should be fairly obvious, but I just
> > can't see it.

> If you use pump, have a look at config file.

> --
>  Je vote [OUI] a la cration de fr.rec.chasse.newbies
>  -+- AT in: Guide du Cabaliste Usenet - Bien configurer son newbie -+-

 
 
 

Problem getting DHCP for second Ethernet card

Post by Tauno Voipi » Sun, 09 Sep 2001 02:28:12



Quote:> Hi,

> I have a set up with two ethernet cards. One (eth0) has a static IP
> address (192.168.0.1) and links to a LAN and the other (eth1) has a
> dynamic IP address (DHCP) and links to the internet via a cable modem. I
> am using ip forwarding, and eth1 is masqueraded using iptables. I am
> running Mandrake Linux v8 (kernel 2.4).

> My problem is this. During start-up, eth0 is brought up first, then eth1
> is brought up. However, when eth1 is brought up, its DHCP requests are
> routed through eth0 over the LAN rather than to the ISP's DHCP server
> through eth1.

> If I then shut down eth0, and try to restart eth1, the eth1 DHCP
> requests now go through eth1 as required, but with a source address
> 192.168.0.1, so the DHCP still won't respond.

> The only way I can get it to work is by disabling eth0, rebooting (at
> which point eth1 starts up OK and gets its DHCP info), then start up
> eth0 manually. (I then have to manually start up my local DHCP and DNS
> for the LAN because they could not start up on the disabled eth0 during
> the boot.)

> I know I could swap over the ethernet interfaces so the eth0 becomes the
> cable connection and eth1 becomes the lan connection, but before I do
> that I just wondered if there is a way to force eth1 to make its DHCP
> queries through itself using IP address 0.0.0.0 rather than through
> eth0.

> I'm sure I'm missing something that should be fairly obvious, but I just
> can't see it.

This is a known problem - it seems to be a bug in the IP stack that it sets
the sender IP address to some other interface's IP address if the interface
is not configured yet. The error persists even if the other interface is
brought down for the time of the DHCP.

The only solution I have found is to bring the DHCP interface up first after
boot.

Byt the way - this error seems to prevent having more than one
DHCP -configured interface in a computer.

Tauno Voipio

 
 
 

Problem getting DHCP for second Ethernet card

Post by Bodo Egger » Sun, 09 Sep 2001 06:13:00



> My problem is this. During start-up, eth0 is brought up first, then eth1
> is brought up. However, when eth1 is brought up, its DHCP requests are
> routed through eth0 over the LAN rather than to the ISP's DHCP server
> through eth1.

http://sdb.suse.de/en/sdb/html/ashley_dhcp-2nics.html
--
I know what I'm doing... can you please teach me?
 
 
 

Problem getting DHCP for second Ethernet card

Post by root » Sun, 09 Sep 2001 06:35:02


Thanks to all respondents. Now I know that I'm not quite as ignorant as
I thought I was on the subject.

The Suse support looks great, too. I hadn't seen that before.

Cheers,

Grahame

 
 
 

Problem getting DHCP for second Ethernet card

Post by Oscar Manuel Gómez Senovill » Sun, 09 Sep 2001 07:31:16



> I have a set up with two ethernet cards. One (eth0) has a static IP
> address (192.168.0.1) and links to a LAN and the other (eth1) has a
> dynamic IP address (DHCP) and links to the internet via a cable modem. I
> am using ip forwarding, and eth1 is masqueraded using iptables. I am
> running Mandrake Linux v8 (kernel 2.4).

> My problem is this. During start-up, eth0 is brought up first, then eth1
> is brought up. However, when eth1 is brought up, its DHCP requests are
> routed through eth0 over the LAN rather than to the ISP's DHCP server
> through eth1.

You can try two things:

1) Temporarily disable ip_forwarding. Then, if it works, you can disable
it by default and enable it later, for example, a "sleep x" after
bringing up the interfaces.

2) Unless both cards use the same module (I think the nic support is not
built in the kernel), make an alias to eth0 the module that now is eth1
and alias eth1 to the actual eth0. You can do this without rebooting,
but you will have to manually unload the modules. If the support is
built in the kernel, you can try to diagnose if what happens is that
they're switched, so you can try switch the wires and see what happens.
I don't like this option very much but it could, just temporarily, work,
waiting for the kernel rebuild.

Good luck.

--
|----------------------------------------------------------------------|
| http://counter.li.org info: Linux user: 92390 - Linux machine: 39301 |

|----------------------------------------------------------------------|

 
 
 

Problem getting DHCP for second Ethernet card

Post by Olivier Baudro » Mon, 10 Sep 2001 04:00:02



> I know I could swap over the ethernet interfaces so the eth0 becomes the
> cable connection and eth1 becomes the lan connection, but before I do
> that I just wondered if there is a way to force eth1 to make its DHCP
> queries through itself using IP address 0.0.0.0 rather than through
> eth0.

> I'm sure I'm missing something that should be fairly obvious, but I just
> can't see it.

It's not that obvious...
The problem with pump is that it binds an udp socket to the adress 0.0.0.0.
Unfortunatly this adress is also defined as INADDR_ANY, which means that it
lets the kernel choose whatever it wants. And since another interface is
already up an running, the kernel choose the source adress from there.
You can see http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=23052 for a
discussion on this bug in pump.
From my point of view, the best solution is to use dhcpcd. Contrary to pump,
dhcpcd uses raw sockets. It means that it builds its own ip packets with its
own headers. Therefore, in the dhcp packets, the source adress is really set
to 0.0.0.0.

Olivier.

 
 
 

Problem getting DHCP for second Ethernet card

Post by Grahame Coope » Mon, 10 Sep 2001 06:54:00




> > I know I could swap over the ethernet interfaces so the eth0 becomes the
> > cable connection and eth1 becomes the lan connection, but before I do
> > that I just wondered if there is a way to force eth1 to make its DHCP
> > queries through itself using IP address 0.0.0.0 rather than through
> > eth0.

> > I'm sure I'm missing something that should be fairly obvious, but I just
> > can't see it.

> It's not that obvious...
> The problem with pump is that it binds an udp socket to the adress 0.0.0.0.
> Unfortunatly this adress is also defined as INADDR_ANY, which means that it
> lets the kernel choose whatever it wants. And since another interface is
> already up an running, the kernel choose the source adress from there.
> You can see http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=23052 for a
> discussion on this bug in pump.
> From my point of view, the best solution is to use dhcpcd. Contrary to pump,
> dhcpcd uses raw sockets. It means that it builds its own ip packets with its
> own headers. Therefore, in the dhcp packets, the source adress is really set
> to 0.0.0.0.

Thanks for the explanation, and the solution. I will try switching to
dhcpd when I get the chance.

I can't help feeling the the solution of using raw sockets is an
unfortunate concequence of what is probably a bug in the Kernel (a
matter of opinion I guess). But then who am I to judge? :)

Cheers,

Grahame

 
 
 

1. Problem getting my second ethernet card working...

I'm trying to add a second PCI ne2000 ethernet card so
I can start using IP Masquerading. I'm running Redhat 4.2.

Here are the things I've done:
1) I did a cat /proc/pci to find the address and IRQ. (0x6100, IRQ 9)
2) I used netcfg to add the second card
3) I ran kernelcfg to add an eth1 module.
4) I then added append="ether=9,0x6100,eth1", to my lilo.conf

Anyway, it's not working yet. When I boot, I see my eth0 card
initialize, just like always. But after that it says:

Delaying eth1 initialization.

This message is written by the ifup network script after
it does an ifconfig on eth1. Apparently it doesn't find eth1...

Any idea why?
Am I forgeting something?
I thought RedHat came with support for mulitple cards compiled in?
I also know the new card works, because I made it eth0,
and am using my old card for eth1.

Any help would be appreciated.

Thanks...

-Stephen

2. ATA/100 and Linux

3. DHCP server for Linux having two ethernet cards

4. Ibill scripts (URGENT)

5. DHCP Server with Two Ethernet Cards

6. Diald problem

7. dhcp on second ethernet card

8. Creating & exporting environment variables in C

9. getting second linksys ethernet card to work

10. Help: getting second PCI DE435 ethernet card recognised

11. Getting two PCI ethernet cards working on the same machine.

12. Two Ethernet cards, two networks, now what?

13. Two modems 1 ethernet card and two routes need help!