|
|
|
|
|
|
| Author |
Message |
Nils O. Selåsdal *nix forums Guru Wannabe
Joined: 09 Mar 2005
Posts: 199
|
Posted: Thu Oct 13, 2005 12:50 pm Post subject:
Re: finding the IP address of the local machine.
|
|
|
David Schwartz wrote:
| Quote: | kironv@gmail.com> wrote in message
news:1129122488.343468.236090@g49g2000cwa.googlegroups.com...
You need this info for protocols like SDP ( for ex: invite in SIP )
where you want to send the IP address of your machine and the other
machine will connect to it...
Why wouldn't it just connect to the machine it received the information
from using the address that was used to send the information to it?
What if it should connect to another machine ? |
A common scenario is when the SIP signalling travels through
proxy servers, but you want audio to go directly between the peers.
Another scenario is when all call control processing is done one a
call server, and the media paths to be opened are between two media
gateways. |
|
| Back to top |
|
 |
Michael Wojcik *nix forums Guru
Joined: 10 Apr 2005
Posts: 336
|
Posted: Thu Oct 13, 2005 9:02 pm Post subject:
Re: finding the IP address of the local machine.
|
|
|
In article <dijm5i$mc5$1@nntp.webmaster.com>, "David Schwartz" <davids@webmaster.com> writes:
| Quote: |
kironv@gmail.com> wrote in message
news:1129122488.343468.236090@g49g2000cwa.googlegroups.com...
You need this info for protocols like SDP ( for ex: invite in SIP )
where you want to send the IP address of your machine and the other
machine will connect to it...
Why wouldn't it just connect to the machine it received the information
from using the address that was used to send the information to it?
|
Because if NAT is being used, the source address of the packets the
host receives will not be an actual IP address of the peer. Replies
back to that address and source port will work, because the NAT
system will route them; but arbitrary SYNs to that address probably
will not, because the NAT system won't have any reason to direct them
to the (interface on the) system that originated the first
conversation.
Some NAT systems use heuristics to route incoming SYNs - for example,
if machine A is behind a NAT and it opens a conversation to machine
B, and no other system behind the NAT opens a conversation to machine
B, and machine B sends a SYN to the NAT address within a certain
time, some NATs will automatically route it to machine A. I had a
3Com ISDN modem with NAT that could be configured to do that. But
it's not foolproof, universally implemented, or always desirable.
--
Michael Wojcik michael.wojcik@microfocus.com
Please enjoy the stereo action fully that will surprise you. -- Pizzicato Five |
|
| Back to top |
|
 |
David Schwartz *nix forums Guru
Joined: 26 Feb 2005
Posts: 914
|
Posted: Thu Oct 13, 2005 9:48 pm Post subject:
Re: finding the IP address of the local machine.
|
|
|
"Michael Wojcik" <mwojcik@newsguy.com> wrote in message
news:dimi0q0200c@news4.newsguy.com...
| Quote: | In article <dijm5i$mc5$1@nntp.webmaster.com>, "David Schwartz"
davids@webmaster.com> writes:
kironv@gmail.com> wrote in message
news:1129122488.343468.236090@g49g2000cwa.googlegroups.com...
You need this info for protocols like SDP ( for ex: invite in SIP )
where you want to send the IP address of your machine and the other
machine will connect to it...
Why wouldn't it just connect to the machine it received the
information
from using the address that was used to send the information to it?
Because if NAT is being used, the source address of the packets the
host receives will not be an actual IP address of the peer.
|
Right, but it will be a more useful address than the actual IP address
of the peer.
| Quote: | Replies
back to that address and source port will work, because the NAT
system will route them; but arbitrary SYNs to that address probably
will not, because the NAT system won't have any reason to direct them
to the (interface on the) system that originated the first
conversation.
|
If the host is behind NAT, SYNs to the real IP address *definitely*
won't work. So this argument actually supports my position that you should
use the address you got the packets from, not the address the other machine
sent them from.
| Quote: | Some NAT systems use heuristics to route incoming SYNs - for example,
if machine A is behind a NAT and it opens a conversation to machine
B, and no other system behind the NAT opens a conversation to machine
B, and machine B sends a SYN to the NAT address within a certain
time, some NATs will automatically route it to machine A. I had a
3Com ISDN modem with NAT that could be configured to do that. But
it's not foolproof, universally implemented, or always desirable.
|
I agree. However, this still doesn't argue against my point that you
should want an address for the peer that is globally unique and routable
over the network, and that will be the source address of the data you
received, not the address the other end sent them from.
DS |
|
| Back to top |
|
 |
maxim.yegorushkin@gmail.c *nix forums Guru Wannabe
Joined: 27 Jul 2005
Posts: 182
|
Posted: Fri Oct 14, 2005 6:51 am Post subject:
Re: finding the IP address of the local machine.
|
|
|
Michael Wojcik wrote:
| Quote: | In article <dijm5i$mc5$1@nntp.webmaster.com>, "David Schwartz" <davids@webmaster.com> writes:
kironv@gmail.com> wrote in message
news:1129122488.343468.236090@g49g2000cwa.googlegroups.com...
You need this info for protocols like SDP ( for ex: invite in SIP )
where you want to send the IP address of your machine and the other
machine will connect to it...
Why wouldn't it just connect to the machine it received the information
from using the address that was used to send the information to it?
Because if NAT is being used, the source address of the packets the
host receives will not be an actual IP address of the peer. Replies
back to that address and source port will work, because the NAT
system will route them; but arbitrary SYNs to that address probably
will not, because the NAT system won't have any reason to direct them
to the (interface on the) system that originated the first
conversation.
|
I don't see how these SYN/NAT concerns apply here. The IP addresses
stated in SDP are used for video/audio streams which are delivered via
RTP, which is a UDP based protocol. For traversing NATs with UDP they
use techniques like UDP hole punching. A good paper on the subject is
referred here http://en.wikipedia.org/wiki/UDP_hole_punching. |
|
| Back to top |
|
 |
Michael Wojcik *nix forums Guru
Joined: 10 Apr 2005
Posts: 336
|
Posted: Fri Oct 14, 2005 4:13 pm Post subject:
Re: finding the IP address of the local machine.
|
|
|
In article <dimkmc$o8a$1@nntp.webmaster.com>, "David Schwartz" <davids@webmaster.com> writes:
| Quote: | "Michael Wojcik" <mwojcik@newsguy.com> wrote in message
news:dimi0q0200c@news4.newsguy.com...
In article <dijm5i$mc5$1@nntp.webmaster.com>, "David Schwartz"
davids@webmaster.com> writes:
kironv@gmail.com> wrote in message
news:1129122488.343468.236090@g49g2000cwa.googlegroups.com...
You need this info for protocols like SDP ( for ex: invite in SIP )
where you want to send the IP address of your machine and the other
machine will connect to it...
Why wouldn't it just connect to the machine it received the
information
from using the address that was used to send the information to it?
Because if NAT is being used, the source address of the packets the
host receives will not be an actual IP address of the peer.
[...]
I agree. However, this still doesn't argue against my point that you
should want an address for the peer that is globally unique and routable
over the network, and that will be the source address of the data you
received, not the address the other end sent them from.
|
Ah, I see your point. I thought you were asking, in effect, "why
wouldn't the source address always work (as a callback address)?",
not pointing out that the peer's actual (possibly unreachable) IP
address was even less useful.
In reality, neither may be useful, but (as in the case of the 3Com
ISDN modem I mentioned) there are some situations where the source
address might be more useful than the peer's actual address. I
agree with you there.
--
Michael Wojcik michael.wojcik@microfocus.com |
|
| Back to top |
|
 |
Pascal Bourguignon *nix forums addict
Joined: 08 Mar 2005
Posts: 62
|
Posted: Wed Jun 28, 2006 1:51 pm Post subject:
Re: finding the IP address of the local machine.
|
|
|
"vineeth" <nvineeth@gmail.com> writes:
| Quote: | hello,
Can anyone please tell me the way to find out the IP address of the
machine.
currently i am using gethostent(), but this always returns 127.0.0.1
pls share your ideas.
|
Yes. That's because computers don't get IP addresses on an IP network.
Only interfaces get IP addresses.
So you must first get the list of interfaces to this computer, then
the list of IP adresses to each interface.
Try:
ifconfig(1) ifconfig -a
On linux:
ip( ip addr show
netdevice(7)
--
__Pascal Bourguignon__ http://www.informatimago.com/
CAUTION: The mass of this product contains the energy equivalent of
85 million tons of TNT per net ounce of weight. |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Tue Dec 02, 2008 5:45 am | All times are GMT
|
|
Xbox Mod Chip | Internet Advertising | Auto Loans | Loans | Best Credit Cards
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|