Hack Forums
Port Forwarding - Q & A's (Part-4) - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45)
+--- Forum: Grayhat • Purple Team • Hybrid Security (https://hackforums.net/forumdisplay.php?fid=449)
+---- Forum: Website Hacking (https://hackforums.net/forumdisplay.php?fid=43)
+---- Thread: Port Forwarding - Q & A's (Part-4) (/showthread.php?tid=41528)



Port Forwarding - Q & A's (Part-4) - ʇsıʎqqoɥ - Dec 27, 2008

Part One: https://hackforums.net/showthread.php?tid=39070
Part Two: https://hackforums.net/showthread.php?tid=40287
Part Three: https://hackforums.net/showthread.php?tid=41526

Part 4 is talking about general concepts that lays behind port forwarding & similar stuff!


Q: I got a router. 3 Pc's behind the router. Every PC has unique private IP such as 192.168.0.100, 192.168.0.103, etc. However, external IP for all PC's are the same! how come? every pc should have unique external IP. Otherwise, how packets that are coming from outside world, will know on which PC it should arrive?


A: one internet connection = one external ip address. Your internal ip's are different because each computer is assigned an address by your router/modem dhcp. Your external ip address is given by your internet service provider. In other words, each computer should have an individual internal IP address, and one single external IP address. Your router/modem gets the incoming packet & knows what internal ip to send the packet to. All packets are tagged so they are routed correctly in the internal lan.

=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

Q: Can firewall block connections?

A: Firewall cannot block connection, it can only block incoming traffic and some can block outgoing traffic.

=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

Q: Why My Client Can Not Connect To Its Server Externally?! client can connect to the server in LAN, but when i make my server in LAN & client in completely different LAN, my client can not get in touch with the server. Assume server listens on port 4443...


A: You need to forward port 4443 on your router to the machine running the server, since the firwall in routers usually block incoming connections except if you tell the router to accept any outside connection that wants to connect to the internal PC on port 4443. You can do this by doing port forwaring in your router configuration page.

In your router setup you need to setup port forwarding to forward all requests for the port to a specific local PC you want. This is a setup that you must configure for the router to know where to forward the request too. If you don't the router doesn't no where to route the request to.

=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

Q: What is port forwarding?

A: Port Forwarding simply tells the router which computer on the local area network to send the data to. When you have port forwarding rules set up, your router takes the data off of the external ip address:port number and sends that data to an internal ip address:port number. Port Forwarding rules are created per port. So a rule set up for port 53 will only work for port 53.

resources:
http://portforward.com/help/portforwarding.htm
http://www.youtube.com/watch?v=UZCVq60EPkE

=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

Q: Can I Do Port Forwarding on 5643 to Two Of My Home PC's Behind a Router?

For example, i configure my router to port forward this port

5643 on IP 192.168.0.101
5643 on IP 192.168.0.102

Note: assume each application on each PC differs than each other...

1.Is this possible?

2. If yes, then how come my router will know which PC the client want to connect to?

3. If no, then how come every pc listens on port 80 to receive webpages from webserver? Aren't most PC's listen on port 80!

4. What if each of these two pc's has same application that listens on port 5643, will this work?, will both pc's will respond to the calling client?


A: 1. No

2. That's why it isn't

3. REMEMBER Web SERVERS listen on port 80. Clients connect to web server on port 80. In other words, PC connect to web server on port 80, not vice versa.

4. Since the port can only be forwarded to one computer, only the one it is forwarded to will recieve the request. Note: two internal PCs can listen to the same port, but you cannot forward from an external internet source to both PCs.

When connecting from the internet, the external client only knows the IP address of your router. It is then the router's job to realise which machine that signal is to go to. In the case of most requests the router just says no to the request. If you've set up a port forwarding, it uses the port number to realise which machine to talk to and forward this information to. If the server accepts your connection, you set up a channel and no longer need the port number of the other end. The two machines can then talk to each other freely without needing to worry about IPs and Ports any more because the connection is already made. Imagine it like a mobile phone where you call someone and can then talk to them as long as you like without typing their telephone number in again between words.

=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

Q: Ok, is there a way i can make port forwarding with same port to two internal PC's?

A: if you have two machines on your network that need to set up a server, you'll have to put them on two different WAN ports. I.e. the client outside your internet has to ask for port x even if the server on your network is port y. Most routers let you do this. Say you have two machines on port 5643 .. you can set one routing from outside to go from 5643 to 5643 on 192.168.0.101 and another to go from 5644 to 5643 on 192.168.0.102. The outside port doesn't have to match the inside port, but they all have to be different on the outside because once port 5643 is used up, another connection cannot be made and the router cannot decide which internal IP address to forward to. As i have mentioned above, two PCs can listen to the same port, but you cannot forward from an external internet source to both PCs.

=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

Q: Ok assume i coded a RAT. When i create the server & send it to the victim. The server will be listening on port e.g. 4352. However, the victims' router will prevent any incoming connection that wants to connect on 4352, unless victim configure his firewall - port forward this port 4352 to his PC, so i will not be able to connect to a victim who is behind a router - LAN. Is there a solution for this?


A: Yes, you have to make you Remote Access Tool has reverse connection facility.

=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

Q: What is a reverse connection?

A: Typically, a client connects to a server through the server's open (listening) port, but in the case of a reverse connection, the client opens the port that the server connects to.

Further more, in reverse connection the client opens the port that the server connects to. Thus, simply i just do the bind() & listen() in clients' source code, and do connect() in the server's source code.
So the client keeps listening lets say on port 5563, and once a user clicks the server.exe on his/her machine, client gets a notification message that a server got connected to it, then you can make the client send orders & requests to the server & server responses with results to client. If user disconnect the internet, the server gets disconnected from the client & the client gets message that server is disconnected....

=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

Keep your eye for coming stuff! 🤩

😁




- JappaR - Dec 27, 2008

Nice tut =)