Skip to contentSkip to conversation

relocating packets

DISCUSSION Mark Oden 3 participants 3 messages Oct 13, 2005

lore
Share & tools
lore

Mark Oden

author
#0 lore raw

Assuming I had two NICs in my machine that happen to be on the same network, is there a way to force packets of certain ports to use only one NIC or IP?

Thanks,

~Mark

#1 lore raw
Quoted 3 lines · Mark Oden

Assuming I had two NICs in my machine that happen to be on the same network, is there a way to force packets of certain ports to use only one NIC or IP?

I believe this scenario is covered by the LARTC HOWTO. In brief: use "-j MARK --set-mark 0xff" in mangle. Use dual routing tables, and a rule to put "fwmark 0xff" traffic in the alternate table. The mark can be anything from 0x0 to 0xffff.

http://lartc.org/howto/

Signature · 2 lines
    mail to this address is discarded unless "/dev/rob0"
    or "not-spam" is in Subject: header
#2 lore raw
In reply to Mark Oden
Quoted 1 line · Mark Oden

Assuming I had two NICs in my machine that happen to be on the same network, is there a way to force packets of certain ports to use only one NIC or IP?

If you have multiple NICs in the same Ethernet broadcast segment then I would recommend you to enable "arp_ignore".

echo 1 >/proc/sys/net/ipv4/conf/all/arp_ignore

If not things will get very confusing with traffic "randomly" coming in on either interface.

Once this is done you can firewall each NIC separately as you please, policy routing, marking etc to control how the interfaces are used.

Regards
Henrik