Sunday, October 13, 2013

Routing Control-Data plane interaction



What are the functions of a control plane and data plane of a router?/How the router creates the routing table?
The Router consists of a control plane and data plane, the control plane is used to exchange the routing updates of routing protocols like RIP,OSPF,IS-IS,BGP. Each protocol when enabled on a router initiates it process to build its tables in RIB, am not going in detail about each routing protocol how they work, as our main focus is working of control and data planes. Once the routing databases exchanged over the control plane the router puts the best routes of the router databases into routing table and a copy of it is sent to the Forwarding Information Base(FIB) in the data plane, the below figure illustrates the control plane and date plane functions of the router.




Once the FIB is created by the router, the data is routed with the help of forwarding information base(FIB). Whenever there is a topology change the routers updates their RIB which updates the Route table in control plane and again a copy of Route table is sent to FIB.

How a packet is routed?
When the data packet is received by the router it checks the IP header of the packet to find the destination IP, then checks its routing table for the longest prefix match, if a match is found the router sends that packet over the outgoing interface of the entry present in the routing table.






Saturday, March 2, 2013

TCP 3-WAY HANDSHAKE

TCP the transport control protocol, its a reliable communication protocol and provides end-to-end services.
The applications HTTP,FTP,TELNET,SMTP,IMAP uses the TCP because these protocols need the connection oriented services and TCP provides the Flow control and Congestion control.
UDP is less overhead when comparing with TCP, TCP header has many fields and these are used for the accurate data delivery without a packet loss. Have a look at the TCP and UDP headers.

                                                                 TCP Header


UDP Header


As TCP is connection oriented protocol it has to keep track of the established connections and carries all the required fields.

UDP is simple and less overhead protocol which is used by applications like DNS,DHCP,RTP,SNMP

3-way handshake:
Before any data is transferred by TCP first it establishes the connection which is called as 3-way handshake.The TCP connection is established with 3 packets [SYN],[SYN,ACK],[ACK].



lets see how the Telnet connection is established between the two routers,

Telnet from 10.0.0.2 to 10.0.0.1

First packet from node 10.0.0.2 to 10.0.0.1, seq no=0,Des port is 23 telnet application ,sync bit is set ,window size is 4128



Now 10.0.0.1 replies to this packet with SYN,ACK bit set,with its own seq number and window size



The 10.0.0.2 replies with ACK to 10.0.0.2 with seq=1


Connection is established between the two nodes once the 3 packets are exchanged, the node 10.0.0.2 can execute the commands in the telnet session established to 10.0.0.1 node. Once the user exit the telnet session the 10.0.0.1 sends a packet to 10.0.0.2 to tear off the connection with FIN bit set



Wednesday, January 2, 2013

IP Subnetting

Before i talk about subnetting we just talk about IP-internet protocol, as we all know that "ip" represents name of the node or system in the network, which the device responds when user calls it by its name (IP) and the call can be made with protocols(PING,TELNET,FTP,HTTP,etc) so here's the question, Does any device can reach any device in the world? you think traffic can be controlled ? it will be a chaos if that happens.

whats the solution? so they introduced a concept called segmenting,with this we can limit the traffic pass from one network to other network.

whats is a network?
Example: 10.0.0.0/8 is called one network , you might have already got an idea and thinks its a Class A network.
i explain you about classes later just after this, first look at this address 10.0.0.0/8 
10.0.0.0--------network address(cannot be assigned to any host)
host address starts from 10.0.0.1 to 10.255.255.254(so how many address for hosts? (2^24)-1(minus one for broadcast address))
10.255.255.255----broadcast address(cannot be assigned to any host,used for ARP)

If you observe the above calculation i took a cutoff of first 8 bits because its /8 subnet mask so i counted host address from 10.0.0.1 to 10.255.255.254 without touching 10(first octet)

lets just take the 10.0.0.0/9 network. we can tell that there are 2^23-1 host addresses but from where does the host addresses starts?

It starts at 10.0.0.1 to 10.127.255.254 

Now if you have 10.0.0.0/8 network we can subnet it into two /9 network. agree?
 if we subnet 10.0.0.0/8 to /9 then we will have 10.0.0.0/9 and 10.128.0.0/9(two networks with (2^23)-1 hosts each)
so instead of having all the (2^24)-1 host addresses in single network we subnetted into two networks with (2^23)-1 host addresses each.

As you observe one single broadcast domain is divided into two broadcast domains.

Now the same /9 networks can be further subnetted into /10 and soon which can give us more networks with limited hosts.

So the /8 turned to /9 with less number of hosts with more number of subnets, if we further subnet, the increase in number of networks decrease the number of hosts per each subnet network.

Classes?
what are the classes? when the internet started the designers followed the class mechanism to differentiate the networks which called as Class A,Class B,Class C,D and E because at that time the devices in that network are very less as the internet grows more devices added to the network which led to subnetting of these Classes.

You can find enough information about these classes on web.

when the big network is subnetted into small small networks, we introduced routing to route the traffic from one network to other network.

you try subnetting the following and let me know the number of hosts in the each network and to which subnet the following networks belongs to.

192.0.0.0/23,
120.0.0.0/17,
10.0.0.0/24,
11.0.0.0/16,
134.0.0.0/15


first try yourself and post your answers, i will let u know the formula to calculate easily

So how do we calculate?

lets take the subnet 10.1.0.0/23

Network address 10.1.0.0 subnet mask 255.255.254.0

Now the take the third octet and subtract it from 256 .i.e 256-254=2

10.1.0.0/23 ----10.1.0.1 to 10.1.1.254
10.1.2.0/23 ----10.1.2.1 to 10.1.3.254
10.1.4.0/23 ----10.1.4.1 to 10.1.5.254
|
|
|
|
10.1.254.0/23 ---- 10.1.255.254

so total 128 subnets with /23 mask and each subnet has 2^9-1 hosts

As given address is 10.1.0.0/23 it has 2^9-1 hosts starting from 10.1.0.1 to 10.1.1.254