Re: Packets go to the wrong interface (no source address checking?)
- From: "Barclay, Daniel" <daniel@xxxxxxx>
- Date: Thu, 26 Feb 2009 13:47:31 -0500
Sjors Gielen wrote:
...
So I wanted two IP's in the machine; I have Hamachi running two times
and I have two interfaces now, ham0 and ham1. There are also two routes:
Destination Gateway Genmask Flags Metric Ref Use Iface
5.0.0.0 * 255.0.0.0 U 0 0 0 ham0
5.0.0.0 * 255.0.0.0 U 0 0 0 ham1
When I ping the ham0 IP, I get a response, everything is OK. However,
when I ping ham1, I get no response. I think this is because the kernel
wants to reply to me, 5.187.x.y, and sees the first route for ham0 in
the route list; but then the driver (or tun/tap) sees the source address
is wrong and refuses to send the packet.
Is this diagnosis true? How would I solve something like this? ...
"Normal" routing does not select routes based on the source address in
outgoing packets. You need "advancing routing" for that. See the
"ip rule" option of the "ip" command.
Here's _part_ of an /etc/ppp/ip-up.d/ script I use to send certain packets
out one interface (ppp0) even though the default route goes out a different
interface (eth0):
ppp_addr="$4"
ppp_peer="$5"
# add rule to match source address, send to new table
ip rule add from "${ppp_addr}" pref 100 table 100
# in new table, send out second interface
ip route add default table 100 proto static via "${ppp_peer}" dev ppp0
(The table number is arbitrary, as long as it doesn't conflict with an
existing table. I used the same number for table number and the "pref" number
to indicate that the table and the rule are associated.)
Daniel
--
(Plain text sometimes corrupted to HTML "courtesy" of Microsoft Exchange.) [F]
- References:
- Packets go to the wrong interface (no source address checking?)
- From: Sjors Gielen
- Packets go to the wrong interface (no source address checking?)
- Prev by Date: Re: [OT, embarrassing] trouble understanding ping output
- Next by Date: Re: [OT I think] Which Distro?
- Previous by thread: Packets go to the wrong interface (no source address checking?)
- Index(es):
Relevant Pages
|