How do I get the internal IP address and port of the local machine in a cross-platform way? Not internal within the LAN, but the ISP, so that other users of the ISP can connect? Is connecting to a VPS with a public IP enough to get the external IP and port outside the ISP? How to get the ISP subnet mask to know when another internal IP is within the NAT?
edit: Probably don't need this. NAT punch through is enough. Am I right that router's don't have the same traversal rules as ISP's?
A NAT's public IP address is its external IP address. I don't understand what you mean by internal IP address. By internal address usually is meant a device's local address.
All the users of an ISP is in local LAN if the ISP has only one NAT under which all the private IP address is assigned. Some ISPs has nested NATs. In that case users under different NATs are in different network.
You can get your NAT's external IP:Port by sending a stun request to a stun server. From the server's reply you can get your NAT's external/public IP:Port. If the users of an ISP are not in local LAN but under different NATs then using their external IP:port they can communicate.
Related
Hello Everyone!
I want to know that is there any way to access a photocopier machine which is connected to a computer through Ethernet wire and that computer is connected to my WiFi network?
P.S: What if I don't know the IP assigned to that Photocopier machine?
If the wireless network is part of the wired network you should have any problem reaching the photocopier.
If you don't know the IP address, you can reach it by host name if the DHCP and DNS are working properly. If you are on an Active Directory infrastructure and DHCP and DNS are integrated it should be transparent.
If you are on your home with a "home" router they usually do the hostname to IP resolve (DNS).
You can nslookup hostname in your machine to see if your dns is resolving the ip address. you can also ping hostname or ping ip address to test that you can reach the desired host. Some hosts block ping (ICMP) requests, please note that ping is ping does not respond is not a definitive solution.
Please note that in your home router you should use your router or default gateway to be the DNS also, and then add the google public DNS or your ISP.
Also when connecting the access point to an existing network you may have 2 DHCP servers providing IP addresses to hosts, you should disable DHCP on the Access Point and connect the AP to the network using the switch port and not the WAN port (the WAN port will try to do NAT and assign a different set of IP addresses).
I am facing a very strange problem. I have a task to establish a TCP connection to a server who has a trusted IP. And I have to run the code in a host with private IP address. The trusted IP is 10.10.10.15, which is also a private IP. And the question arises that the IP address of my host and the trusted IP is not on the same network. To be specific, my IP address is 10.0.35.1/24. Please let me know if there is any solution to this problem
Presumably these subnets, i.e. 10.10.10.0/24 (?) and 10.0.35.0/24, are part of your local network. You will need a Layer 3 device to perform inter-VLAN routing.
This will be a router with Layer 3 VLAN interfaces, in the Cisco world they would be SVIs, that would be acting as the default gateway of the subnets in your network. What happens is all traffic that needs to go between two hosts between different networks, has to go through their default gateway and it will be routed to the destination network/VLAN.
As long as the network devices between the two clients are able to route packets between these networks, the hosts will be able to reach each other. In your code, you simply need to specify that these packets need to go to the private IP address of the other host.
I've some doubts about a VPN.
I've been given a Cisco VPN client to connect to the LAN of my society. I use this to connect to a local server. I don't understand how the VPN is working.
I'm at home now. In the VPN Client I see an IP. If I go to http://www.whatismyip.com/ I see another IP, which is the IP I've when I'm also without the VPN Client, while I expected to see the IP of the VPN Client. If I use $_SERVER['REMOTE_ADDR'] I see another (third!) IP, while I expected the IP I see in the VPN Client.
Can you clarify please?
I need this to know if I'm identifies always from the same IP from the local server.
If I'm not mistaken, this should be correct. Please correct me if I'm wrong.
By default you have 2 IP addresses.
Local IP: IP address used to identify yourself within your LAN.
Global IP: A public IP used to gain access to the internet. At home it will most likley be a public IP NATTED* by your ISP.
Because you're also using a VPN connection, you'll receive a third IP.
Local IP for VPN: IP address used to identify yourself on the other end of the VPN.
*NAT = Network Address Translation
Working on Cisco ASA 5510 device I tried to use the broadcast IP address of a Public Network for NAT Static configuration and IOS allowed me to do it, but from outside it didn't work. After a while I changed the broadcast IP to an usable IP and it started to work.
I understand that on a physical interface we can't configured a broadcast IP address, but for NAT we have to do it, otherwise we loose many Public IP addresses from networks with /29 prefix.
I understand you need to squeeze one more IP address for you to use, however most routers don't support forwarding broadcast traffic, for a simple fact, if that is allowed, anyone can send a ping to someone's broadcast address and every host in that subnet has to reply, that is not acceptable.
Other Internet routers may not tell that IP address is broadcast or not, but think about your ISP router for your access circuit, it has to know that IP address is a broadcast, it has to know your ip range in order to set it up. And when someone send you a ping, the router will say: hey, that is a broadcast address on my client's interface, first thing I know as a router, I must not forward a broadcast, thus drop it.
Hope it helps.
Ignoring other possiblities such as Request.ServerVariables["HTTP_X_FORWARDED_FOR"], does Request.ServerVariables["REMOTE_ADDR"] gives me the "principal" IP of the client?
I'm talking about the IP that made the actual TCP connection.
Will ServerVariables["REMOTE_ADDR"] always be the "real" IP address of the remote endpoint?
Just to clarify: Even if it's a proxy who made the real TCP connection I'd like have its IP, and not a forwarded one.
Yes, except if its been through a NAT firewall. A NAT firewalled address would be masquerading many 192.168.x.x or any other private subnet behind a public IP address. So you'd be looking at the IP address of the NAT firewall (i.e. a Linksys Router or what have you).
Be warned that many cell phone carriers have HUGE NAT networks so they always look like they are coming from one or two public IP addresses.
The REMOTE_ADDR variable will be the IP of the system that directly connected to your web server to request the URL; so it would be the forward-most proxy server, if there is a proxy server.