Re: Two interfaces




"Pascal Hambourg" <boite-a-spam@xxxxxxxxxxxxxxx> wrote in message
news:4905ad53$0$894$ba4acef3@xxxxxxxxxxxxxxxxx
Hello,

Jozza a écrit :

I have two interfaces eth0 and eth1. The default interface is eth1. I am
having problems routing the voice traffic to eth0
eth0 10.58.16.28 gw: 10.58.0.1 mask:255.255.0.0.
eth1 192.168.1.110 gw:192.168.1.254: mask 255.255.255.0

I want all outgoing traffic designated to 10.xx.xx.xx to go out through
eth0 and also to go through gw 10.58.0.1 when the destination is not in
the mask of eth0's mask, otherwise not.

What i've done so far is:
$iptables -t mangle -A OUTPUT -d 10.0.0.0/8 -j MARK --set-mark 2 #mark
outgoing traffic for 10....with 2
$iptables -t nat -A POSTROUTING -m mark --mark 2 -j SNAT --to 10.58.16.28
#change source address with mark 2 to 10....

$iproute rule add fwmark 2 table tm1 # send all traffic with mark 2 to
table tm1
$iproute route add default via 10.58.0.1 dev eth0 table tm1 #use eth0 and
this default gateway in table tm1

Just being curious... Why didn't you just add a route to 10.0.0.0/8 via
10.58.0.1 in the main routing table, instead of using advanced routing and
NAT ?

But i see a lot of these in tcpdump on eth0
arp who-has 10.58.0.1 tell 10.58.16.28
arp reply 10.58.0.1 is-at xx:xx:xx:xx:xx:xx

What's wrong with it ?

All addresses 192..., 10.58...., 10.22... are pingable

Really, even addresses in 10.58.0.0/16 ? IMHO your advanced routing does
not meet your requirement : "I want all outgoing traffic designated to
10.xx.xx.xx to go out through eth0 and also to go through gw 10.58.0.1
when the destination is not in the mask of eth0's mask, otherwise not".
With the above rules, all 10.0.0.0/8 should be routed via 10.58.0.1,
including 10.58.0.0/16.

You're right,

but i did it now without iptables
i just added a static route:
ip route add 10.22.0.0/16 via 10.58.0.1 dev eth0
- which was the initial problem, i couldnt get it to go through eth0 and to
use gateway 10.58.0.1
so i tried all the garbage with marking the packets ... but the solution is
so simple :)

So another question arises:
How does the router know that when a packet is sent to 10.22.xx.xx it should
set the source ip to 10.58.16.28? Which it clearly does when i ping
10.22.xx.xx. Is it because it figures out that i want to use the gateway
that is already set for a specific interface? In that case, it shouldn't be
required to add the dev eth0 to the above route, right?

J.







.



Relevant Pages

  • Re: Two interfaces
    ... I want all outgoing traffic designated to 10.xx.xx.xx to go out through eth0 and also to go through gw 10.58.0.1 when the destination is not in the mask of eth0's mask, ... this default gateway in table tm1 ... in the main routing table, instead of using advanced routing and NAT? ...
    (comp.os.linux.networking)
  • Re: HELP my last chance to keep my job HELP
    ... > Form out side I can trace/ping to both the ppp connection and the eth0 ... > my routing table looks like this at present: ... You also loop all other 203.88.230.0/24 network traffic back to your own ... IP for any non-local network (WAN route that goes through another router, ...
    (comp.os.linux.networking)
  • Routing problem
    ... I have a slightly unusual routing issue that I'd appreciate some help ... I have a machine with 2 interfaces, eth0 connected to the ... lan, and eth1 connected to an adsl router. ... via eth0 through its default route of eth1 -> adsl. ...
    (alt.os.linux)
  • Re: Question on Routing
    ... I assume 192.168.1.1 is your gateway. ... In which case - your routing table ... go via "eth0" and use 192.168.1.1 as the ... If you dont want/need the 169.254.X.X route, ...
    (comp.os.linux.networking)
  • Re: Routing
    ... I can ping hosts on the 192.168.3.0/24 network, ... Subject: Routing ...
    (Debian-User)