netdev
[Top] [All Lists]

Re: How to determine source ip address

To: Gigi Sullivan <sullivan@xxxxxxxxxxxxx>
Subject: Re: How to determine source ip address
From: "Christopher Friesen" <cfriesen@xxxxxxxxxxxxxxxxxx>
Date: Tue, 11 Sep 2001 16:44:17 -0400
Cc: Padraig Brady <padraig@xxxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, netdev@xxxxxxxxxxx
References: <Pine.LNX.4.33.0109102359080.1850-100000@u.domain.uli> <3B9E4E1B.9060006@antefacto.com> <20010911215036.B205@armageddon.tin.it>
Sender: owner-netdev@xxxxxxxxxxx
Gigi Sullivan wrote:

>    So, what you have to do is just this;
>    look at destination IP address, use the kernel routing table to
>    get the outgoing interface, retrieve the IP address associated with
>    it.

Minor problem with this: what if you're routing based on source addresses?  If
the outgoing address that you pick influences which route/interface you use,
this won't work.

By far the simplest method is to either a) use the default outgoing route to
that destination and let the kernel fill it in, or b) have the admin specify a
source address via a config file or commandline parm.

Anything else is guesswork and likely a pathological case can be invented for
which it will be wrong.

Chris

-- 
Chris Friesen                    | MailStop: 043/33/F10  
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@xxxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>