Monday, 6 November 2017

InterVLAN routing (Multilayer Switch)

Introduction

A Multilayer switch also known as a Layer 3 switch is a device that performs the function of a switch as well as a router also. The multilayer switch has the ability to operate at higher layers.  It can perform both Layer 2 and layer 3 functions at extremely fast speed. This is also a great option for us if we want to perform InterVLAN routing. In a Multilayer Switch, the VLAN interface acts as a router interface having an IP address and a subnet mask. The configuration of a multilayer switch is very easy and simpler as compared to a Router-On-A-Stick(ROAS).

Now take 2 PC's and a MultiLayer switch and connect it using a straight cable. Connect PC1 with interface fa 0/3 and PC2 with interface fa 0/5.

Now the first step is to vlan 3 and vlan 5 and assign vlan's to interfaces fa 0/3  and fa 0/5
switch(config)# vlan 3
switch(config-vlan)# name vlan03
switch(config-vlan)# exit
switch(config)# vlan 5
switch(config-vlan)# name vlan05
switch(config-vlan)# exit
switch(config)# interface fa 0/3
switch(config-if)# switchport mode access
switch(config-if)# switchport access vlan 3
switch(config-if)# exit
switch(config)# interface fa 0/5
switch(config-if)# switchport mode access
switch(config-if)# switchport access vlan 5

Now after you have made access ports to interfaces, it's time to assign IP address to vlan 3 and vlan 5

switch(config)# interface vlan 3
switch(config-if)# ip address 192.168.3.1 255.255.255.0
switch(config-if)# exit
switch(config)# interface vlan 5
switch(config-if)# ip address 192.168.5.1 255.255.255.0
switch(config-if)# exit

The last command helps to perform routing in a multilayer switch. Without this command, the packets cannot be routed in a multilayer switch.

switch(config)# ip routing

Now we assign IP adresses to PC1 and PC2 as shown below




Note that the default gateways of both the PC's contains the same IP address that we have given to VLAN interfaces. Now if we ping PC2 from PC1, we get the reply.











Sunday, 5 November 2017

Introduction to DHCP Part 2

DHCP Configuration

The DHCP is configured on a router. We then also state that router as a DHCP server. Remember that from a subnet, you must assign DHCP lease range that starts from .101 till .254 ( for example like 192.168.0.101 till 192.168.0.254). The range till 100 is used for static IP addressing such as those IP addresses that are given to switches, gateways, VLAN's, DNS servers etc. This is a standard way for using DHCP and is performed by many companies in the world.

To enable dhcp server you must write the following command on the router :
Ip dhcp pool name of pool

DHCP server settings

Following are the settings that we need to make on a DHCP server .
 
The subnet ID and the mask
The DHCP server needs to know all the addresses in the subnet.

Reserved addresses
Addresses that are reserved or excluded from the DHCP server which are needed to be used for static IP addressing. The command that is used for reserved addresses is :
ip dhcp excluded-address lowest address highest address

Default-router
The IP address of the router which is being used on that subnet.

DNS IP address
The IP address which is giving to a DNS server in the network.

Now take 2 PC's, 1 switch and 1 router. Connect the PC's and router with the switch using a straight cable as shown below

Now for the configuration
Router(config)# ip dhcp pool network
Router(dhcp-config)# network 192.168.5.0 255.255.255.0
Router(dhcp-config)# default-router 192.168.5.1 
Router(dhcp-config)# dns-server 192.168.5.5
Router(dhcp-config)# exit

Now again go to config mode so we can write the command for reserve static IP addresses

Router(config)# ip dhcp excluded-address 192.168.5.1 192.168.5.100

Now go to router interface 0/0 and assign the IP address to the interface which you have also given to the default router in the DHCP settings too.

 Router(config)# interface fa 0/0
 Router(config-if)# ip address 192.168.5.1 255.255.255.0
 Router(config-if)# no shutdown

Now go to PC1 and PC2 and click on DHCP in IP configuration


You can see that the IP address, subnet mask, default gateway and DNS server has been assigned dynamically by the DHCP successfully.

 

Introduction to DHCP Part 1

Introduction

Dynamic Host Configuration Protocol (DHCP) is the most commonly used protocol in the TCP/IP network. Suppose you are a network engineer in company and you have to assign IP address to 50 PC's of a department. Instead of assigning static IP address to each PC, You can assign them IP addresses from an IP Pool using a DHCP server. The configuration of host IP settings sits in a DHCP server. The client learn these settings using DHCP messages. DHCP assigns a temporary lease of IP addresses to the host for a temporary period of time. When the time expires, the host is then assigned with a new IP Address. When  a device is removed from the network, the server reclaim the IP addresses and assign it to someone else or save it for the future.

The DHCP Process uses four types of messages to assign an IP address to a DHCP Client
  1. Discover
  2. Offer 
  3. Request
  4. Acknowledge 
Discover
It is sent by a DHCP client to discover a DHCP server to claim an IP address.

Offer
The offer for an IP address lease is sent to the client by a DHCP server and also inform the client of it's other information and parameters.

Request
The DHCP client then sends the request to the DHCP server for the IP address lease which has been sent in the offer message.

Acknowledge
The DHCP server then assign the address and also lists the DNS server IP addresses, mask and the  default router.

IPv4 Special Address

There is a somewhat a problem with the DHCP client that they don't have an IP address yet to communicate with a DHCP server so there are two special IPV4 address that helps them to solve this problem.

0.0.0.0 : This is an address that is reserved to the host who don't have an IP address yet .

255.255.255.255: It is known as  The Local Broadcast Address. The Packets that are sent to this destination address are broadcasted on the Local data link but the routers will not forward them.

Allocation modes

DHCP server uses three allocation modes

  • Dynamic Allocation ( refers to the DHCP configuration which I will show you in the next part).
  • Automatic Allocation ( we can set the DHCP time to infinite).
  • Static Allocation  ( Configuring a specific IP address for a host based on the host's MAC address).

In the next part, we will learn the DHCP configuration for Dynamic Allocation.

Saturday, 4 November 2017

Administrative distance, Passive Rip and other terminologies

Administrative distance

suppose a router sees two multiple path going the the destination router direction.


It can see both the paths as best path because of multiple routing protocols running on the router. Sometimes even the metric count can't help us to choose the best path and still the router needs to choose single best path. To solve this problem each routing protocol has been assigned a different numeric value. Due to that numeric value, the router then chooses the routing protocol with the lowest numeric value. That value is known as the Administrative Distance (AD).

Following are the distance of the following protocols
  • Connected routes (AD=0)
  • Static routes (AD=1)
  • EIGRP routes (AD=90)
  • OSPF routes  (AD=110)
  • RIP routes (AD=120)
  • DHCP  (AD=254)


PASSIVE RIP
This Passive command helps to stop RIP updates being advertised to the interface. Configuration is shown below

Router(config)#router rip
Router(config-router)#Passive-interface g0/1

You have to activate the command on the interface which you don't want to advertise.

Load balancing
Suppose a router have find two paths with the same metric, so it sends some packets over one path and some to another path. This is known as Load -Balancing.

Contigous Network 
A contigous network is that topology in which a subnet of one network is not separated by a subset of classful network.

Discontigous Network
a discontigous network is that topology in which a subnet of one network is  separated by a subset of classful network.

No Autosummary
when older classful routing protocols were used in the early networking era, a cautios subnet design  was used to avoid discontigous classful network. The no autosummary command on every router of the topology helps to avoid this problem.

Routing Loop
When a set of routers that causes a packet which has been sent to there paths happens to be keep looping between them and never arrived to the destination. That status is known as Routing Loops.

Split Horizon
Split Horizon is a process that  helps to avoids routing loops. It has a distance vector feature that tells the router to discard/omit some routes from an update sent by some interface.

Route Poisoning: 
Route poisoning advertises a field to other routers with a special numeric value known as the infinite value.A Router consider those router as failed because of the infinite metric.

Friday, 3 November 2017

Routing Information Protocol

Routing Information Protocol (RIP) is one of the most used protocols in network. It is used for routing packets between routers. The version using nowadays is called RIPv2, though there is a new version known as RIPng (ng stands for the Next Generation) which may be used mostly for IPv6. After getting active on a router, the router performs three basic functions which are as follows :

  1. Router sending routing updates on the interfaces. 
  2. The router listens and then processes incoming updates on that same interface.
  3. The router advertises the connected subnets to the interface. 

The features of RIPv2 are as follows:

  • It is password authenticated
  • It creates the summary of routing table. 
  • It can also be used for multicast address.
  • It supports VLSM (Variable Length Subnet Mask) also.

Take three routers, three switches and three PC's. Connect the router with each other on there serial interface 2/0 and 3/0 using a serial cable. Then Connect each PC with a switch and each switch with the router on the interfaces 0/0 and 1/0 using a straight cable as shown below.



For configuration, we need to use router rip command on config mode and also choose version 2 for RIP. Following are the IP's and gateways we need to assign to PC's.



Now assign IP's to those interface which you will use as gateways . the IP's to be assign to router ethernet interfaces and serial interfaces.

In Router 0
fa 0/0 192.168.3.1
se 2/0 192.168.9.2
se 3/0 192.168.10.2

In Router 1
fa 0/0 192.168.5.1
se 2/0 192.168.9.1
se 3/0 192.168.11.2

In Router 2
fa 0/0 192.168.7.1
se 2/0 192.168.10.1
se 3/0 192.168.11.1

Following is the configuration for RIPv2

On Router 0
router(config)# router rip
router(config)# version 2
router(config)# network 192.168.3.0
router(config)# network 192.168.9.0
router(config)# network 192.168.10.0

On Router 1
router(config)# router rip
router(config)# version 2
router(config)# network 192.168.5.0
router(config)# network 192.168.9.0
router(config)# network 192.168.11.0

On Router 2
router(config)# router rip
router(config)# version 2
router(config)# network 192.168.7.0
router(config)# network 192.168.10.0
router(config)# network 192.168.11.0

Now if you ping pc1 to pc0 or pc2, you will get the reply :


To see the the routing table just write the command "show ip route", you will see the table as shown below


The lines which are starting with the symbol R shows the RIP connected routes.








Thursday, 2 November 2017

InterVLAN routing (Router-On-A-Stick)

                                          Router-On-A-Stick

Now consider yourself again as a network engineer in a bank. This time the scenario is that your treasury department, finance department and human resource are on the same switch. Now we know that the switch broadcast packets to all the ports, so if someone from the treasury department sends a packet to the finance department, it will be broadcasted to the human resource department also. Even if you put both the departments in a different Vlan together, still the packets will not be forwarded to the destination rather than broadcasted to all interfaces which we don't want. The forwarding of packets from source to destination is the job for a router. The process of forwarding packets between VLAN's is called InterVLAN routing. For forwarding packets, you need to connect the switch with the router. This feature is also known as Router-On-A-Stick.

Now take three pc's and a router and connect it with a switch. Connect the router with interface 0/1 and connect the pc's with interface 0/3 and 0/5 as shown below.
Now go to the switch and create vlan 3 and vlan 5.

switch(config)# vlan 3
switch(config-vlan)# name vlan03
switch(config)# vlan 5
switch(config-vlan)# name vlan05
switch(config-vlan)# exit

Now assign vlan 3 to interface fa 0/3 and vlan 5 to interface fa 0/5 and made fa 0/1 trunk port between the switch and router.

switch(config)# interface fa 0/3
switch(config-if)# switchport mode access
switch(config-if)# switchport access vlan 3
switch(config-if)# exit
switch(config)# interface fa 0/5
switch(config-if)# switchport mode access
switch(config-if)# switchport access vlan 5
switch(config-if)# exit
switch(config)# interface fa 0/1
switch(config-if)# switchport mode trunk
switch(config-if)# exit

Now you need to assign ip's to vlan 3 and vlan 5.

switch(config)# interface vlan 3
switch(config-if)# ip address 192.168.3.2 255.255.255.0
switch(config-if)# no shutdown
switch(config)# exit
switch(config)# interface vlan 5
switch(config-if)# ip address 192.168.5.2 255.255.255.0
switch(config-if)# no shutdown
switch(config)# exit

Now the work of the switch has been completed. Lets move on to the router. Now here we need to create subinterfaces for trunking to forward packet between VLAN's and we will use dot1q trunking. The command will be "encapsulation dot1q vlanid ".

router(config)# interface fa 0/0.1
router(config-subif)# encapsulation dot1q 3
router(config-subif)# ip address 192.168.3.1 255.255.255.0
router(config)# interface fa 0/0.2
router(config-subif)# encapsulation dot1q5
router(config-subif)# ip address 192.168.5.1 255.255.255.0
router(config)# interface fa 0/0
router(config-if)# no shutdown

The "no shutdown " command on interface fa 0/0 helps to active the port. Now assign IP's and gateways to both PC's as shown below :




Hence if you ping  the treasury department to finance department, you will get the reply as shown  below