Re: At a loss figuring out if an IP is on LAN or INET



On 2006-04-28, Terry Olsen <tolsen64@xxxxxxxxxxx> wrote:
I'm writing an app that communicates with computers both inside and outside
my router. So I need to determine by the remote host's IP address if I need
to send them my LAN IP or my Internet IP. Someone suggested AND'ing the IP
and my Subnet Mask but I come up with this:

My IP: 192.168.0.14
Mask: 255.255.255.0

Result: 192.168.0.0

Should I just compare the first two octets? Or are there situations where
this would provide incorrect results?

I'm curious, why do you need to do this? The remote host should already
know how to respond to you. If you're sending an IP to a third host
that distributes the IP (like many P2P networks), then using the IP
address to determine local vs. remote isn't going to help you, because
you'll have conflicts with identical addresses.

.



Relevant Pages

  • [REVS] Analysis of Remote Active Operating System Fingerprinting Tools
    ... Many of today's tools are used for remote active operating system ... Tools like Nmap and Xprobe2 take the responses and form a ... techniques based on stack querying came about. ... actively send packets to the network stack on the remote host and analyze ...
    (Securiteam)
  • Re: reverse SSH / SSH over NAT traversal
    ... The remote host is behind a NAT/firewall and it's not possible to ask the admin to tunnel a port. ... can the remote user type in some command in their terminal to connect (SSH?) to my network - and thereby allow me to get a terminal on the remote machine. ... I think this is possible with a reverse SSH tunnel - but I don't really want to allow the remote user any access to my system. ...
    (Fedora)
  • Re: reverse SSH / SSH over NAT traversal
    ... The remote host is behind a NAT/firewall and it's not possible to ask the admin to tunnel a port. ... can the remote user type in some command in their terminal to connect (SSH?) to my network - and thereby allow me to get a terminal on the remote machine. ...
    (Fedora)
  • SCP via SSH tunnel works, then not, then works again
    ... I am using SSH to perform local port forwarding from my local machine ... to a remote machine behind a firewall at a remote site ... back to remote host RA, ...
    (comp.security.ssh)
  • PLEASE HELP Trying to use SSH programmatically to run program on remote host
    ... open a SSH connection to a remote host and eventually run a program on ... if I can get into the remote machine and type in 'hostname ...
    (comp.lang.c)

Loading