Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Networking explained


Obitech
 Share

Recommended Posts

Networking explained

Table of Contents

* Introduction
* Networks
* IP addresses
* Network Interface Cards & Network Adapters
* Transport Protocols
* Application Protocols
* Routers and hubs
* Ports
* Peer-to-Peer and Client-Server
* Network Address Translation or Port Forwarding

Introduction

Greetings,

In this tutorial I will explain what port forwarding is, what its purpose is and how it works. If you want a quick overview then please see the Table of Contents. This tutorial tries to be as in-depth and as easy as possible but when you feel confused about something then you may always post your questions here. You shouldn't stay uninformed.

Networks

Well, we first begin with some, probably boring, theory. As it is pretty much required before we can go touch anything. So what are networks? You'll form a network when you connect at least two computers with each other. There are three types of networks in general:

* Local Area Network (LAN)
* Intranet
* Internet

The LAN is actually defined as when the network has a radius of max. 1 km (about 0.62 milles). The LAN is by far the fastest of the networks as it uses the "smallest" area available: the local area.

The Intranet and the Internet both fall under one category called the wide area network (WAN). A network falls under WAN when it has a radius of min. 1 km (about 0.62 milles). As you can already guess, it's the slowest type of networking available.

What's the difference between Intranet and Internet? Intranet is private, that means that it is mainly used by companies. Lets say you work for Coca-Cola England and you've to send some promotion film to Coca-Cola U.S. then you'll most likely have to use the Intranet. The Internet is public, so it's like Intranet but it's used by everyone owning a computer and of course a connection to the Internet.

IP addresses

Each computers on the Internet uses an IP address, also called the public IP address or remote IP address. Each computer has its own IP address (in theory) so it can be distinguished. Although, every computer directly connected to the internet has its own IP address, computers connected to a LAN network will all use the IP address of the LAN network.

There are currently two types of IP addresses:

* IPv4 addresses
* IPv6 addresses

IPv4 addresses are the once which are currently still in use and widespread. An IPv4 address is 32 bits in size and thus uses 4 bytes to be represented. The IP range goes from 0.0.0.0 up to 255.255.255.255 (in theory). Meaning that there are 4294967296 unique addresses.

Although IPv4 addresses are widespread, it has a problem to deal with. As there are only 4294967296 unique addresses, we will soon have a shortage (Estimations range between 2010-2020 mainly). So we have a problem here. There's a solution though: IPv6\. IPv6 uses 128-bit addresses meaning that there are 2128 unique addresses. IPv6 addresses also use a different notation, it uses hexadecimal characters instead of decimal characters. An IPv6 address can range from 0000:0000:0000:0000:0000:0000:0000:0000 till ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff. As you can see, the notation is pretty different.

So far most operating systems will support IPv4 completely. Some moderner operating systems will support IPv6 too (e.g. Windows Vista, Windows 7, Mac OS X 10.5, Mac OS X 10.6, Linux…).

Network Interface Cards & Network Adapters

To connect to a network a computer would need a card or chip, this is usually called the Network Interface Card (NIC) or Network Adapter. Each NIC can be distinguished too, using a MAC address. I will not really go in-depth about this as it will hardly be of any use for you.

Transport Protocols

In order to send and receive comprehensible data to and from other computers there needs to be some standard, this is where the transport protocol(s) come in. There are two pretty famous protocols:

* Transfer Control Protocol (TCP)
* User Datagram Protocol (UDP)

TCP is a stream protocol, whist UDP is a packet protocol. What's the difference? Well, TCP uses a stream of bytes to be send over (so: there is a connection which remains and the data should come in order, thus TCP is reliable). UDP instead uses packets, which each have their own amount of bytes (so: there is no connection required and the data can come in order, thus UDP is "unreliable", more likely chaotic). Why is UDP unreliable though? When using UDP packets can get lost while in TCP the "packet" would get resend.

UDP and TCP are easy to compare with something in life: telephones and mail. When you're mailing somebody, you're just sending a packet (UDP), but what if the packet gets lost? Then you'll have to resend it. Also you can be waiting for two mails, one is sent a few hours ago and arrived yesterday, another one was sent two months ago and arrived just now, concluding that the mails were not sent in order. When you're phoning somebody, you'll need a connection. You speak to him/her over the phone which will result in electronic signals going over the cable, this is the stream. The messages should surely come in order and they shouldn't get lost, else we've a problem here.

Application Protocols

As transport protocols are meant to get data sent and received in a specific way, there's no format for the data itself. The solution for this are application protocols. Well known application protocols are IMAP, SMTP, HTTP, FTP, POP3, IRC, Telnet, etc. In order to let two computers understand what each other tries to say, they'll use the application protocol to find that out.

Routers and hubs

In order to form a LAN we use routers or hubs. We'll connect each computer in our network to the router or hub and we'll connect that router or hub to the Intranet/Internet. This means that each computer will use the same public IP address, so how are computers distinguished? It's pretty simple, each router and hub gives each connected computer its unique IP also called the LAN or private IP.

Computers can also talk with the router/hub using the gateway. The gateway is also an IP address which is assigned to the router so it can be recognised as an individual device. The gateway is mainly used to configure the router.

Ports

In order to have multiple services running ports were designed. Ports can range from 0 till 65536\. Ports 0 - 1024 are special ports, assigned by IANA. Ports like 80 (HTTP), 25 (SMTP), etc. are used for/by special services. These ports will thus distinguish the services.

Peer-to-Peer and Client-Server

You can make two types of connections:

* Peer-to-Peer or Client-to-Client (P2P)
* Client-Server

In P2P both computers are equal, they both serve and get data. In Client-Server, the server serves data to the many clients. So, the server keeps track of the data. The second one is the most used design, although the first one is pretty popular too (e.g.: torrents).

Network Address Translation or Port Forwarding

A client connects to a server but behind the router are multiple computers, which computer is the server? By using Network Address (Port) Translation (NA[P]T) the router will route the data to the right computer. When using NAT, you have a table of ports, each port will either be blocked or unblocked. When a port is blocked, no data will be routed. When a port is unblocked, the data will be routed to the associated LAN IP. The server will be easily found by using NAT. This is also called port forwarding, the router will forward the data to the right computer by using the port in the NAT table.

Sincerely, Obitech.

P.S. this tutorial is unfinished and more content will be added later on.
Link to comment
Share on other sites

@Ghost:

> I mean…. this is no where close to everything about networking. I took 2 years of networking classes. I guess this can be useful to some people though... for something

True, I tried to explain the most things around port forwarding. As there are many more things to consider. Although this is way better than most of the tutorials about port forwarding and networking I've seen around, unless you can prove me wrong on that.

Also, I'm trying to be as clear as possible, meaning that discussing how the RTL8139 NIC works, for instance, serves no point (there's the RTL8139 specification for that), unless you're writing a NIC driver for that. If I was going to explain that, I could also explain how the TCP and UDP protocols work.

Even if you took two years of networking classes, there's a lot about networking. Server programmers would need to know about IOCP (Windows NT & Solaris 10 technology), blocking/non-blocking, asynchronous/synchronous networking, multi-threading servers, etc. While NIC driver programmers would need to know stuff about NICs like the RTL8139 and then again operating system developers would need to know about how protocols like TCP and UDP work, but also how to implement the several network layers. So there's no purpose to tell that kind of stuff to an audience which doesn't need it.

And there might surely be programmers around here. But this tutorial does not try to teach to those who are more familiar with the subject. Especially as that border is kind of big as this is a forum for an engine and not some C/C++/Java/Assembly/whatever programming community. (As in that case, this tutorial would be off-bounds).

@Zultar:

> yea this was useful thanks.

@Zultar:

> Very nice!

@Alpha:

> Wow..
>
> It'll help a ton of people, even helped me with a question I had! Looked here, and it was answered!
>
> Thank you so much!
>
> -Alpha

That's what this tutorial is for. It tries to help people solve their network problems and it tries to give them a better understanding of networking (as that's required before even touching the settings of a router).

Sincerely, Obitech.
Link to comment
Share on other sites

@[SSB:

> NetherArc link=topic=41760.msg420504#msg420504 date=1239225902]
> It kinda doesnt go over what you really need to get your server online, it's just an overview of what networking is.
>
> But, it is useful for ALOT of things, great job.

To get a server online you would need at least the server application (Check, as it came with Eclipse) and port forwarding (Check, as this tutorial explains about it, although it does not tell you how to do it for your router) and of course a computer which will be server (Check). So, unless you're talking about that, there's nothing really missing.

@Obitech: nice tutorial, probably some images would be great and perhaps improve the general approach for port forwarding as there still are some things to explain about that like the incomping/outcoming port (range).

Regards,
  Xenonyte.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...