Re: Two interfaces
- From: "Jozza" <hmm@xxxxxxx>
- Date: Mon, 27 Oct 2008 16:19:42 +0100
"Pascal Hambourg" <boite-a-spam@xxxxxxxxxxxxxxx> wrote in message
news:4905d6f5$0$847$ba4acef3@xxxxxxxxxxxxxxxxx
Jozza a écrit :
i just added a static route:
ip route add 10.22.0.0/16 via 10.58.0.1 dev eth0
This route covers only 10.22.0.0/16, not 10.0.0.0/8. But if it is what you
need, it is fine.
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?
First it looks whether the route covering the destination contains an
explicit source address. "ip route" will show which routes contain an
explicit source address. If not, if the route contains a gateway then it
looks for a source address in the route to the gateway. If not, it uses an
address of the output interface. If the interface has no address, then it
uses a suitable address of another interface.
In your case the route to 10.22.0.0/16 has a gateway, 10.58.0.1, and it is
likely that the route to 10.58.0.0/16 containing this address has the
source address 10.58.16.28.
In that case, it shouldn't be required to add the dev eth0 to the above
route, right?
Indeed "dev eth0" should not be required and will be added automatically,
because the system already knows that the gateway address is reachable on
eth0.
Thanks alot for clarifications
J.
.
- References:
- Two interfaces
- From: Jozza
- Re: Two interfaces
- From: Pascal Hambourg
- Re: Two interfaces
- From: Jozza
- Re: Two interfaces
- From: Pascal Hambourg
- Two interfaces
- Prev by Date: Re: can I rsync on UDP?
- Next by Date: Re: Overall networking issue...
- Previous by thread: Re: Two interfaces
- Next by thread: Two adapters, routing problems
- Index(es):
Relevant Pages
|