What are STUN servers & what is their purpose?

128 views

Having a hard time understanding STUN servers with web definitions. Could someone please explain in layman terms?

In: 5

2 Answers

Anonymous 0 Comments

In simple terms, a STUN server helps a device behind a NAT firewall to communicate with devices on the internet by allowing it to find out its own public IP address and port. This is especially useful when you want to use real-time communication protocols like VoIP, Video call and others.

Anonymous 0 Comments

You want to achieve browser to browser communication. The issue is, most personal computers (which run the browser) have no public internet address at all. So there’s nowhere to send your packet to if you were to start a conversation.

Normal internet access works because you first send a request to a public address and along the way you are given a temporary return address, remembered by your gateway. The response is addressed to that gateway with some additional data, and that data enables the gateway to forward the response back to your machine.

BTW This is so complicated because IPv4 simply does not have enough addresses for all the machines currently in use which was not foreseen, and it was easier to create workarounds like NAT that could use old hardware we already had and achieve basically the same thing as having more address space.

So back to STUN, or Session Traversal over UDP through NAT. You bypass the limitation of not having a public address by first sending a request to the (public) STUN server from at least one side. This means someone else can now send you a message. The other side of the communication does exactly that, establishing a return route to themselves. Now both parties can communicate even if both of them are technically unaddressable without the use of a STUN server.