Linux Netfilter discussions
 help / color / mirror / Atom feed
* RE: Two NICS with same IP and same client IP
@ 2005-02-02 16:26 Hudson Delbert J Contr 61 CS/SCBN
  2005-02-02 16:49 ` Tom Eastep
  0 siblings, 1 reply; 21+ messages in thread
From: Hudson Delbert J Contr 61 CS/SCBN @ 2005-02-02 16:26 UTC (permalink / raw)
  To: Tom Eastep; +Cc: netfilter

tom,

why ?

to what end, this topology ?

please enlightenment as to the value added ?

v/r,
~piranha

-----Original Message-----
From: netfilter-bounces@lists.netfilter.org
[mailto:netfilter-bounces@lists.netfilter.org]On Behalf Of Tom Eastep
Sent: Wednesday, February 02, 2005 8:22 AM
Cc: netfilter@lists.netfilter.org
Subject: Re: Two NICS with same IP and same client IP


Raphael Jacquot wrote:
> Hervé wrote:
> 
>> Hello,
>>
>> I have a weird setup I would like to make work: I have two identical
>> subnets connected to one machine via two different NICs, like this:
>>
>> Server             |         | Client 1
>> eth0:192.168.100.1 |---------| 192.168.100.2
>>                    |                              | Client 2
>> eth1:192.168.100.1 |------------------------------| 192.168.100.2
> 
> 
> having 2 interfaces on the same box with the same IP address
> 
> repeat after me :
> 
> WILL NOT WORK

Having two interfaces with the same IP address and netmask doesn't work
well. Having the same IP address with different netmasks can be useful.

From my firewall:

gateway:/usr/src/linux-2.6.10/net/ipv4/netfilter# ip addr ls
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:a0:cc:db:31:c4 brd ff:ff:ff:ff:ff:ff
    inet 206.124.146.176/32 scope global eth0
    inet6 fe80::2a0:ccff:fedb:31c4/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc htb qlen 1000
    link/ether 00:02:e3:08:55:fa brd ff:ff:ff:ff:ff:ff
    inet 206.124.146.176/24 brd 206.124.146.255 scope global eth1
    inet 206.124.146.178/24 brd 206.124.146.255 scope global secondary
eth1:0
    inet 206.124.146.180/24 brd 206.124.146.255 scope global secondary
eth1:1
    inet6 fe80::202:e3ff:fe08:55fa/64 scope link
       valid_lft forever preferred_lft forever
4: eth2: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:08:c7:c0:e2:15 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.254/24 brd 192.168.1.255 scope global eth2
    inet6 fe80::208:c7ff:fec0:e215/64 scope link
       valid_lft forever preferred_lft forever
5: sit0: <NOARP> mtu 1480 qdisc noop
    link/sit 0.0.0.0 brd 0.0.0.0
gateway:/usr/src/linux-2.6.10/net/ipv4/netfilter#

Note Interfaces eth0 and eth1 -- both have IP address 206.124.146.176.

eth0 interfaces to my DMZ where there is a single server
(206.124.146.177) using Proxy ARP.

-Tom
-- 
Tom Eastep    \ Nothing is foolproof to a sufficiently talented fool
Shoreline,     \ http://shorewall.net
Washington USA  \ teastep@shorewall.net
PGP Public Key   \ https://lists.shorewall.net/teastep.pgp.key



^ permalink raw reply	[flat|nested] 21+ messages in thread
* RE: Two NICS with same IP and same client IP
@ 2005-02-02 22:22 Hudson Delbert J Contr 61 CS/SCBN
  2005-02-02 22:29 ` Jason Opperisano
  0 siblings, 1 reply; 21+ messages in thread
From: Hudson Delbert J Contr 61 CS/SCBN @ 2005-02-02 22:22 UTC (permalink / raw)
  To: Jason Opperisano, netfilter

jason,

sorry, but your gonna' hear this anyway...but its not negative..
i just wanna know why?

okay...here is what i'm sure will think is a dumb question.

why not make life simple for all concerned [servers, clients and routers, too...]

re-numbering the subnets...or just one and --- voila! problem gone   !!!!

this might be too simplistic for this list (he! he! he!) but lets say...
 
eth0@server = 192.168.100.0/24 
eth0@client = 192.168.100.1/24

eth1@server = 172.16.1.0/24 
eth1@client = 162.16.1.1/24

or whatever...whats the problem?

i think also the statement below may be have some validity
if this is as easy as i think it is.

where's the difficiulty.

complex is bad.
simple is good.


-----Original Message-----
From: netfilter-bounces@lists.netfilter.org
[mailto:netfilter-bounces@lists.netfilter.org]On Behalf Of Jason
Opperisano
Sent: Wednesday, February 02, 2005 12:56 PM
To: netfilter@lists.netfilter.org
Subject: Re: Two NICS with same IP and same client IP


On Wed, Feb 02, 2005 at 09:35:31AM -0000, Hervé wrote:
> Hello,
> 
> I have a weird setup I would like to make work: I have two identical
> subnets connected to one machine via two different NICs, like this:
> 
> Server             |         | Client 1
> eth0:192.168.100.1 |---------| 192.168.100.2
>                    |                              | Client 2
> eth1:192.168.100.1 |------------------------------| 192.168.100.2
> 
> These two machines only access an NFS share on the server, but I assume
> this is irrelevant: the problem is to route the packets back through the
> interface the request came from (I am not trying to access the boxes
> _from_ the server).

aight--this comes with no warranty expressed nor implied, and no
guarantee that it won't burn down your house or that it will even work
at all...  this is off the top of my head, and other than typing the
commands on a test machine to validate the syntax, i have not tested
this one iota...  i also don't believe that you *_have_* to do this--i
think you secretly just want to do this, because you think you should be
able to...  ;-)

here goes--it obviously requires iproute2, and the CONNMARK patch from
POM:

---BEGIN STUFF I DON'T WANNA HEAR COMMENTS ABOUT---

# start fresh
ip addr flush dev eth0
ip addr flush dev eth1

	# add the same IP to each NIC
ip addr add 192.168.100.1/24 brd + dev eth0
	
	# why not assign the diff subnets addy's here ?
ip addr add 172.16.1.1/24 brd + dev eth

..or..

ip addr add 172.16.1.1/24 brd + dev eth1
 
ip addr add 192.168.100.1/24 brd + dev eth1
	# and here also...?

# add two new route tables to hold our local network routes
#   (this only needs to be done once)

echo 200 zero >> /etc/iproute2/rt_tables
echo 201 one >> /etc/iproute2/rt_tables

# start fresh
for t in mangle nat filter; do
  iptables -t $t -F
  iptables -t $t -X
  iptables -t $t -Z
done

# restore the connmark on each packet as it comes in off the wire
iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark

# if a packet isn't marked, mark it based off the inbound NIC
iptables -t mangle -A PREROUTING -i eth0 -m connmark --mark 0 -j CONNMARK --set-mark 1
iptables -t mangle -A PREROUTING -i eth1 -m connmark --mark 0 -j CONNMARK --set-mark 2

# restore the mark on locally-generated reply packets before the outbound route lookup

iptables -t mangle -A OUTPUT -j CONNMARK --restore-mark 
	# add local network route for each NIC in its routing table

ip route add 192.168.100.0/24 dev eth0 src 192.168.100.1 table zero

	# here's another chance to NOT do the shenanigans
ip route add 172.16.100.0/24 dev eth1 src 172.16.100.1 table one # or here...

# ip route add 192.168.100.0/24 dev eth1 src 192.168.100.1 table one

# add rules to lookup routes based on the netfilter mark
ip rule add fwmark 1 table zero
ip rule add fwmark 2 table one

# disable reverse path filtering on the duplicate NICs
sysctl -w net.ipv4.conf.eth0.rp_filter=0
sysctl -w net.ipv4.conf.eth1.rp_filter=0

# start clean
ip route flush cache

---END STUFF I DON'T WANNA HEAR COMMENTS ABOUT---

just a thought--hope it doesn't lead you too astray.

i feel so dirty

...and rightly so...just kiddin...ceeyal8tr...

v/r,
~piranha

--
"You couldn't fool your mother on the foolingest day of your life if
 you had an electrified fooling machine."
        --The Simpsons



^ permalink raw reply	[flat|nested] 21+ messages in thread
* RE: Two NICS with same IP and same client IP
@ 2005-02-02 16:47 Gary W. Smith
  2005-02-02 16:51 ` Raphael Jacquot
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Gary W. Smith @ 2005-02-02 16:47 UTC (permalink / raw)
  To: Hervé, netfilter

But if you giving eth0 IP addresses on two different subnets then you could just plug everything that's on eth1 onto the same network as eth0.

Just because it's Linux doesn't mean you can redefine IP routing and expect it to work.


-----Original Message-----
From: netfilter-bounces@lists.netfilter.org [mailto:netfilter-bounces@lists.netfilter.org] On Behalf Of Hervé
Sent: Wednesday, February 02, 2005 8:41 AM
To: netfilter 
Subject: Re: Two NICS with same IP and same client IP

> Hervé wrote:
>>
>> In my case, the point is to help the routing by modifying the source
>> address. For example, you give eth0 two addresses: 192.168.100.1 and
>> 192.168.101.1, and eth1: 192.168.100.1 (yes, the same) and
>> 192.168.102.1.
>
> what's the point ???
>
I have two identical test benches, in which one box has a fixed IP
address, hence I can't change the subnets.
What is more, this box always accesses the same IP address for the server.

Yeah, not so easy, but hey, it's Linux, so it's possible!

Cheers,
Hervé.



^ permalink raw reply	[flat|nested] 21+ messages in thread
* Two NICS with same IP and same client IP
@ 2005-02-02  9:35 Hervé
  2005-02-02  9:48 ` Raphael Jacquot
  2005-02-02 20:56 ` Jason Opperisano
  0 siblings, 2 replies; 21+ messages in thread
From: Hervé @ 2005-02-02  9:35 UTC (permalink / raw)
  To: netfilter

Hello,

I have a weird setup I would like to make work: I have two identical
subnets connected to one machine via two different NICs, like this:

Server             |         | Client 1
eth0:192.168.100.1 |---------| 192.168.100.2
                   |                              | Client 2
eth1:192.168.100.1 |------------------------------| 192.168.100.2

These two machines only access an NFS share on the server, but I assume
this is irrelevant: the problem is to route the packets back through the
interface the request came from (I am not trying to access the boxes
_from_ the server).

My first idea was to modify the source address as the request come in, and
then route and put the original address back in the outgoing packet, but I
haven't found a way to do that.

Anybody got any idea?

Thanks in advance,
Hervé.


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2005-02-02 22:29 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-02 16:26 Two NICS with same IP and same client IP Hudson Delbert J Contr 61 CS/SCBN
2005-02-02 16:49 ` Tom Eastep
  -- strict thread matches above, loose matches on Subject: below --
2005-02-02 22:22 Hudson Delbert J Contr 61 CS/SCBN
2005-02-02 22:29 ` Jason Opperisano
2005-02-02 16:47 Gary W. Smith
2005-02-02 16:51 ` Raphael Jacquot
     [not found] ` <27594E8BA9D5CA458F5EF87D88B6B48F019948@pxtvjoexd01.pxt.primeexalia.co m>
2005-02-02 16:57   ` Hervé
2005-02-02 16:57   ` Hervé
     [not found] ` <18348031.1107363459685.JavaMail.rct@kale>
2005-02-02 18:41   ` Bob Tellefson
2005-02-02 20:47     ` Hervé
2005-02-02  9:35 Hervé
2005-02-02  9:48 ` Raphael Jacquot
     [not found]   ` <5172.57.66.65.39.1107338261.squirrel@57.66.65.39>
2005-02-02 10:28     ` Raphael Jacquot
2005-02-02 14:12       ` Jason Opperisano
2005-02-02 14:32         ` Hervé
2005-02-02 14:41           ` Jason Opperisano
2005-02-02 16:53             ` Hervé
2005-02-02 14:44           ` Raphael Jacquot
2005-02-02 16:40             ` Hervé
2005-02-02 16:22   ` Tom Eastep
2005-02-02 20:56 ` Jason Opperisano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox