Routing call from localhost to external ip to locahost - networking

On localhost a program is calling an external IP in a specific port. I'm monitoring this via wireshark. Standard TCP connection.
What's the easiest way to route the traffic to the external IP back to localhost on a specific port?
Thanks

Configure your network card to have a second IP address - the external one.
When the IP packet gets routed, it turns out that it needs to be delivered locally.
If you listen locally to any address, you'll pick it up.
Alternatively you can listen locally to the specific IP address.

Related

How can a client search for server IP and port on same network using port scanning and IP scanning?

I am making an application which will start a HTTP server on a hard-coded port (assume the port is 32654)
There can be multiple clients on the same network which will try to search for this HTTP server. Since they don't know the server IP address, they will need to parallelly scan on each IP address from xxx.xxx.xxx.1 to xxx.xxx.xxx.254 at port 32654. (assume the subnet mask is 255.255.255.0)
Question-1) If the server finds that 32654 port is already taken by another application, it will need to start on other port. How should I re-design my IP address & port scanning logic in my client to efficiently search the new server port and IP address..
Question-2) If it is a large network and the subnet mask for the network is 255.255.0.0, is there an efficient way to search the correct IP address across this vast new search space?

Source vs Destination Port

For example, if i want to rdp to a remote server from my local computer etc
what would be the source port and destination ports to open for network firewall?
can anyone also give more scenarios on the source and destination ports to open for network firewall? are they always the same?
On firewall you would open destination port (for RDP by default it 3389)
Source ports are randomly generated from the unregistered port range.
The source/destination port works similar to your IP. The port you
send from, is the port the service will reply too. For instance; a
website is simply a server listening for connections on port 80 (or
443).

Port and IP address - what does bind mean?

I read on Ports WIKI page that "Ports are logical constructs which identifies a service or process", what service or process means here? It means protocol like HTTP, FTP etc. or software applications which are configured to listen on that port?
When it is said that application is listening on so and so... then does it listen for request to an IP address or a port, or listens on a combination of port and IP address? Application listen for a specific IP address and one or more ports are bound to it OR it listens for a combination of IP and port?
For example, I can have application configured for 7001 for HTTP requests and 7002 for HTTPS requests. So, would be listening on 7001 or what?
Applications/services such as a HTTP web server or an FTP server are assigned a port to use/listen on, usually in the config of the application. and they often use a standard port. HTTP for example usually uses port 80.
If an app/service is listening it listens to a port and has no relation to a specific IP address. This is because the IP address it is listening on is the IP address of the computer that the app/service it is running on.

How Can I Access Locally Hosted IIS WebSite from Remote Computer By My IP Address?

How Can I Access My Locally Hosted IIS WebSite from Remote Computer By My IP Address ?
You have to check you ip here, make sure that you are forwarding port 80 (especially if you're in a locale home network), and then you could access your server by http://<server_ip> e.g. http://192.168.0.6
Note that as long as you don't have a fixed (static) ip, your ip address might change, and you'll have to recheck it.
Another note- The default HTTP port is 80, and by using port 80 you could access your server via browsers without writing the port number. If for any reason you like to switch port, make sure your forward that port number and access your site by http://<server_ip>:<port_number> , e.g. http://192.168.0.6:8080
if you are using some other port. then you can go with http://<ip_address>:<port_no>

Asp.Net IIS hosting

I have an asp.net web application hosted iis on LAN. When i type in my local ip address in the URL box, i can access it. My question is, if i want to access it from outside the LAN, would i have to port forward it to port 80? And intead of typing my local ip address in the URL box, i would now have to type the routers ip adress??
Use your internet and LAN address.and put a net forwarding in firewall or port 80 for your internet address.and yes you need to make changes in your firewall as well.
Yes. If your internet address is 7.7.7.7 and your LAN address is 10.10.10.10 -- you'll need to put a NAT/Port-forwarding entry in your router/firewall to send traffic on TCP Port 80 destined for 7.7.7.7 TO 10.10.10.10. On most home routers this is a pretty simple task.

Resources