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

Re: Multiple IP addresses on one machine, and routing.



On Fri, Jun 29, 2001 at 02:36:48PM -0500, Lavender, Ben wrote:
> I am having some headaches getting more than one IP address to work properly
> on a machine.  I can make it work with neither multiple nics or aliased
> interfaces.

For the sake of simplifying my ascii-art below, lets assume a set of
physically independent ethernets.

> In both cases, connectivity to the same subnet works just fine.   I do not
> have any connectivity to other subnets, however.
> 
> Symptoms:
> eth0 is on one subnet, and  eth1 is on another.
> When I ping either interface from their respective subnets, all is well.
> When I send a ping to eth0 from another subnet, all is well.  The default
> gateway is located on the same subnet as eth0.
> When I send a ping to eth1 from another subnet, I get no response.  

Does the host that sends the ping know where to send it to?  It might be
sending the packets to the default gateway.  Sometimes you may get lucky,
and the default gateway happens to know where to send the packets to
(your box) anyway, but you should not count on this.  As a rule, such
packets would be lost on the wrong side of the default gateway`.

> When I send a packet from eth0 to another subnet while sniffing, it leaves
> eth0 and gets a response, and all is well.
> When I send a packet from eth1 to another subnet while sniffing, it leaves
> -eth0- and recieves a response on eth1.  It does not seem to get the
> recieved packet internally, however.

It is not entirely clear to me what you are describing here precisely.

Do I understand correctly that you have a situation like this:

       gateway
          |               your box
  net0 ---+----+----------+      +----------+------ net1
               |         eth0   eth1        |
             host0                        host1


your box should have:
  ifconfig eth0 ipA netmask nmA
  ifconfig eth1 ipB netmask nmB
  route add default gw gateway
  echo 1 > /proc/.../ip_forwarding

host0 should have:
  ifconfig ethX ipX netmask nmA
  route add -net net1 netmask nmB gw ipA
  route add default gw gateway

host1 should have:
  ifconfig ethY ipY netmask nmB
  route add default gw ipB

Can you verify this?

Cheers,


Joost



Reply to: