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).
Related
I have IIS 7.5 installed on my computer.
I have one site configured on it.
It has binding on port 80 with IP all unassigned.
I want to reach that site from a remote computer i.e. not inside the LAN.
I also configured port forwarding to my LAN IP but I still can't reach it.
Is there something else I need to do in order to achieve it?
telnet from computer to port 80 succeed but from a remote it doesn't succeed.
These are the configurations in my router:
10.0.0.2
External Port Start
1
External Port End
65000
Internal Port Start
80
Internal Port End
80
Ok - it was a problem with my router configurations:
I set port 80 for both external and internal and no I reached my computer
I have implement a Client-Server application in java. The server can serve multiple clients, and I want to test that, but my knowledges on Networking is poor, and I need a way to test my application on my home.
I have a rooter, which are connected both of my computers. My "server" class in java uses as host the local host (127.0.0.1) on a given port.
How can I test my program if
The Server.java is running on the Computer A
Server.java is running on 127.0.0.1 on 3943 port
1st Client.java is running on the Computer A
1st Client.java is connected to 3943 port
2nd Client.java is running on the Computer B
2nd Client.java is connected to 3943 port
Any ideas?
Use unique ports for the clients and servers running on the same machine. In addition 127.0.0.1 is localhost (internal to that machine). Computer B cannot communicate with 127.0.0.1 on Computer A. Use 127.0.0.1 if all applications or on the same machine. Use the computers actual IP address if you want external machines to be able to communicate with the server.
When client and server, are on the same computer, what you are doing must be already working.
To connect from a different computer, you need to find the "real" ip address of your server.
If you are on Windows, open a command shell on your computer A, and run ipconfig. On unix/linux/mac, run ifconfig.
Look for a string, looking like an ip address, but not 127.0.0.1, there has to be another one if you are connected to a network, probably looks like 10.0.0. or 192.168.<0 or 1> ..
Use this address everywhere instead of 127.0.0.1
A full TCP connection consists of two different endpoints. The server side of the connection is one endpoint (it will be do a listen on that endpoint). When a client creates it's side of the connection (the client socket), it will do a connect to the server ip:port combo and get a number assigned from a range of so-called "ephemeral" ports.
The fact that both sides of the connection have the same IP address doesn't matter - the full connection is defined by two distinct elements (address:port combinations).
FirstClient's connection to the server will be ServerIP:ServerPort<->Client1_IP:Client1_Port, and SecondClient's connection will be ServerIP:ServerPort<->Client2_IP:Client2_Port. The network layer can differentiate between these (they are two different connection streams) and route traffic to the appropriate sender/receiver for that stream.
If you run the server bound to IP 127.0.0.1 you are not opening it to the network, only your own computer will be able to connect to it, acessing 127.0.0.1 (loopback IP address).
To open this server to the network, you must do one of the two things:
Bind it to the IP 0.0.0.0 so it will be acessible from all networks;
Bind it to a specific network IP address so that it will be available to that network only.
Its common practice to just bind it to 0.0.0.0, its easier.
Once its done, you will be able to connect from other computers to the server running on computer A, however, not through IP 127.0.0.1. Thats the loopback address and can only be used by a computer to connect to itself.
Computer A can use the IP 127.0.0.1 to connect to the server since the server is running on it, but other network computers will have to specify computer A's network IP address.
You can find your IP address on the network adapter details, or running the command ipconfig /all on a command prompt (Windows) or ifconfig (Linux).
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.
I am new to TCP/IP and trying hard to learn basics. Well, I really wonder about inbound rules and outbound rules of Firewall and concept of source adress:port, destination adress:port.
For example I am investigating port 80. I know that http uses port 80. But when I try to listen the traffic I see that my browser doesn't use 80. As you see from the image only destination port 80 is used and "destination" should be the server that hosts web pages not my computer. And also there is no used port 80 on source port, "source" should be my computer.
My browser uses some other ports as source and goes to server port 80. From that, I understand that port 80 of my computer is not used for http, only server computers that host the web pages used port 80 but if I close port 80 or my computer from outbound rules the internet dooesn't work. But as I understood before from the image, port 80 is not used on my computer.
Really confused. Can anybody clarify it for me?
You are right : the communication goes from your computer (source port chosen "randomly") to a web server (destination port 80). And from a web server (source port 80) to your computer (destination port xxxxx) for the server's responses.
If you close port 80 in outbound rules, your computer will not be able to access any web server because this rule means that your firewall drops any packets which are send from your computer to a destination on port 80.
EDIT
Actually, the packets you send contains parameters such as :
Your_IP, Server_IP, Source_port (xxxxx), Destination port (80)
When your firewall sees that kind of packet, it applies the outbound rules (the one concerning the communication FROM your computer TO a web server). If your outbound rule is to close port 80 (which means to drop any packets whose destination port is 80) it is normal to see the packets you try to send to a web server getting dropped.
closing port 80 in outbound rules doesn't mean you close your computer's port 80. It means your firewall drops packets whose destination port is 80.
I want to estabilish TCP connection over the internet between 2 computers which are in different local networks(wifi).
I have looked for description of TCP protocol, esspecially the structure of TCP header: http://en.wikipedia.org/wiki/Transmission_Control_Protocol#Checksum_computation
I assumed from that data that only: Source address(global ip), Destination address(global ip), Source port, Destination port are needed.
But how router in recipient's local network will know which computer in this network is recpient without MAC address or local ip address?
So the question: Is MAC address is needed to estabilish connection?
No, MAC addresses are not needed for that.
What you´re asking is called port forwarding:
The router of the server side must be configured that way
that incoming connections on port x are connected to local PC y.
(This could maybe be automated with UPNP, depends on the router etc.)
At the client side, after the client send something to the server,
the router "remembers" where to forward the incoming answer