Wednesday, December 28, 2011

Difference between Protocol number and Port number

Protocol number is the value contained in the “protocol” field of an IPv4 header. It is used to identify the protocol. This is an 8 bit filed. In IPv6 this field is called “Next header” field. Some of the protocol numbers of commonly used routing protocols are given below:
Protocol Protocol Number
EIGRP 88
OSPF 89

Monday, December 26, 2011

Different types of communication systems

Simplexsimplex half duplex and full duplex communicaitons

In this type of communication, first device send data and second device receive it. Second device never send  any information to first device. Broadcast systems like FM radio work in this way.

Half Duplex

In this type of communication, when first device send data, second device receives it and when second devices send data, first device receives it. But both devices can’t send or receive data at the same time. This type of communication is using in "walkie-talkie".

Full Duplex

In this type of communication, first and second device can send and receive data simultaneously. Phones and mobile phones are using this type of communication.

Note: In Ethernet communication we can set both end half or full duplex depending up on the requirements. That is Ethernet can work on both mode.

Sunday, December 25, 2011

Basic Switch Configuration

Before begin configuration we need to see the current status of switch. This can be don using verity of ‘show’ commands. Some of them are given below

  • SW1#Show int status  ;shows description of ports, status, VLAN in which port is connected to, duplex, speed of each interface  etc.
  • SW1#show int fa0/1 ;This command shows interface specific details like Transmission rate, error state, etc.
  • SW1#show run int fa0/1 ;This command shows the commands entered under the interface fa0/1, in the running configuration
  • SW1#show power inline : This command shows the power settings of each port. Used for VoIP devices. If you don’t know about inline power, please check here

Now, lets set the interface attributesCisco switch port

Setting interface attributes

The syntax is as follows:

interface type mod/port

speed {10 | 100 | 1000 | auto}  ;This command tells transmission speed. It can be set depending on Speed of Interface. Normally Switch detects the speed correctly. Default configuration is “auto” ie. automatically detect the speed

duplex {half | full | auto} ;set the duplex of interface. Default is auto. But it is better to hardcode by command on both side.  If you set duplex to auto then make it on both side. Also, if you set duplex make sure that it is typed on both side, otherwise mismatch will happen. If you don’t know about duplex, please check here

mdix auto ;This is the default setting. . This permit switch to automatically discover if a crossover connection is needed. we can change the setting by “no mdix auto” command

media-type {sfp | rj45} ;detects automatically. sfp used for fiber optic ports

Sample configuration is given below:

SW1(config)#interface fa0/1

SW1(config-if)#speed 100

SW1(config-if)#duplex full

SW1(config-if)#no shut (to enable the interface)

Ok. That’s enough. But the problem is, we have to type it on all interface. Hmm… It has an easy way – use the ‘range’ command

SW1(config)#int range fa 0/1 - 4 , fa0/15 ;comma is surrounded by space. This will select the specified range of interfaces i.e. from fa0/1 to fa0/4 and fa0/15 at the same time. Now we can set any attributes to that interface.

SW1(config-if-range)#shut

Setting inline power

SW(config-if)#power inline {auto|never} :to automatically discover power need by port or disable power

SW(config-if)#power inline {consumption mw | static max mw} : to give power specifically

Saturday, December 24, 2011

Inline Power / Power over Ethernet (PoE)

Inline Power and  PoE are used to provide power to IP phones, wireless access points etc. by the catalyst switch trough the same data cable.

In the reality, as you may know, out of 8 channels in the UTP cable, only 4 is used for data transmission. So these methods use the rest to provide power to the devices. PoE-Inliine

Cisco Provides 3 methods to deliver current through the Ethernet cable:

  1. Cisco Inline Power
  2. 802.3af PoE
  3. 802.3at PoE+
Property Inline Power 802.3af 802.3at PoE+
Standard Cisco Proprietary IEEE standard IEEE standard
Maximum power delivery 7W/port 15.4W/port 34.20 W
Cable speed 10/100 only Compatible with gigabit Ethernet Compatible with gigabit Ethernet
Compatibility Incompatible with all non-Cisco devices that accept power over Ethernet Not compatible with Cisco inline power – the power negotiation process is completely different Backward compatible with 802.3af

 

The devices connecting to the port are divided into different classes depending up on the power consumption:

Class Max Power  
0 15.4 W Default
1 4.0 W  
2 7.0 W  
3 15.4 W  
4 Undefined Future Use

 

Some advantages of using these methods are:

  • Centralized point of power
  • Centralized point of backup
  • Cheaper cabling

Configuration

Switch#show power inline ;to see the current status of ports

Switch(config-if)#power inline {auto|never|delay}

    • auto: automatically detect power
    • never: to disable power supply through that port
    • delay: wait up to the given delay time before turning off the power of that port if the phone went offline. This is useful when phone is rebooting.

Switch(config-if)#power inline {consumption mw | static max mw} ;to give power specifically

Note: We don’t need to type any command. Cisco switch detect all cisco devices and power needed by the devices automatically using CDP.

Friday, December 23, 2011

VTP

VTP stands for VLAN Trunking Protocol. Unlike the name implies, VTP is used for replication of VLAN information. That means, we just need to create VLANs or edit VLAN information only on one switch. Then VTP will transfer that information through the trunk link to all other switches which make the administration centralized.

VTP works based on the revision number. By default, VTP revision number is 0 on all switches. If we change any VLAN information on a switch, like… adding VLAN, deleting VLAN, renaming VLAN, etc.. the revision number increases. When other switches get the VTP update, it check the VTP revision number contained in the update with its on VTP revision number. If the local revision number is lower than the one it received, it replace the whole VLAN database with the currently received database.

VTP has three modes – Server, Client and Transparent. Depending upon VTP mode in which the switch operates, it gets the features as follows:

  • Server(default)
    • Power to change VLAN information
    • Sends and receives VTP updates
    • Saves VLAN configuration
  • Client
    • Cannot change VLAN information
    • Sends and receives VTP updates
    • Does not save VLAN configuration
  • Transparent
    • Forwards(passes through) VTP updates
    • Does not listen to VTP advertisements i.e.. it does not update its VLAN information using the VTP updates from other switches
    • Power to change local VLAN information
    • Saves VTP configuration (local)

By default cisco switches comes with VTP server mode. Because of there is no VTP Domain name applied to new switches, they act as server for themselves. Also, switches doesn’t participate in VTP until they hear VTP advertisement from another switch.

To see the current VTP status, use the following command

SW1#show vtp statusVTP Modes

Now lets make VTP run on every switch as in the figure.

Set VTP management domain name on all switches

SW1# vtp domain TestDomain

SW2# vtp domain TestDomain

SW3# vtp domain TestDomain

Note: If there is no domain name exist in all switches, then if we configure domain name on SW1, all switches get it automatically.

Set VTP mode of each switch

SW1# vtp mode server

SW2# vtp mdoe transparent

SW3# vtp mode client

Set VTP password (optional)

eg: SW1# vtp password P1ssw0rd

Note: if we want to set the password, set it on all switches

Set VTP version

Default VTP version is 1. if we want to change it to version 2, then do the following command on all switches

eg: SW1# vtp version 2

 

VTP synchronization issues

If we accidently connect a switch with higher revision number and same domain name to the network, all the switches will replace their database to it’s database. Then network connection may not available to users.

Solution:

Before attaching the switch to the network, reset its revision number to zero. Do one of the following to reset revision number to 0

  • Change VTP mode to transparent, then back to server
  • Change VTP domain to a bogus name, then back

Thursday, December 22, 2011

Private VLAN

Private VLAN is the technique of dividing single VLAN into different sub VLANs. This is generally used in the ADSL networks. Also, we can use it to simplify the IP address assignment because all ports are in the same subnet, although they are logically separated in the data link layer.

Private VLAN contains two components

  1. Primary VLAN, which is the real VLAN
  2. Secondary VLANs, which are the sub VLANs

Secondary VLANs can be one of these:

    • Isolated
      • Ports associated with this VLAN cannot communicate each other
      • Ports associated with this VLAN cannot communicate with any other private VLAN
      • Ports associated with this VLAN can communicate only with Primary VLAN
    • Community
      • Ports associated with this VLAN can communicate each other
      • Ports associated with this VLAN cannot communicate with any other private VLAN
      • Ports associated with this VLAN can communicate only with Primary VLAN

Now lets, Create these VLANs as in the figureprivate vlan

Creating Community VLANs

Sw1(config)# vlan 100

Sw1(config-vlan)#private-vlan community

Sw1(config)# vlan 200

Sw1(config-vlan)#private-vlan community

Creating isolated VLAN

Sw1(config)# vlan 300

Sw1(config-vlan)#private-vlan isolated

Creating primary VLAN and joining it with primary VLAN

Sw1(config)# vlan 500

Sw1(config-vlan)#private-vlan primary

Sw1(config-vlan)#private-vlan association 100,200,300

To proceed to next step, we must understand about different types of ports

There are mainly two types of port in Private VLAN - Promiscuous port and Host port. Host port is further divides into two types - Isolated port and Community port.

  • Promiscuous port : This port can communicate with anything connected to primary or secondary VLANs. Usually, router, firewall etc. are connect to this port
  • Isolated port: This port connect to hosts within the isolated VLAN. It can only communicate with the promiscuous port
  • Community port :  This port connect to hosts within the community VLAN. It can communicate with promiscuous port and other ports in the same community VLAN

Now, lets assign these different types of port to different VLANs we created. Remember, every ports except Promiscuous port are host port. So the VLAN which we assign these ports determines whether it is isolated port or community port.

SW1(config)#int range e0/1 - 2
SW1(config-if-range)#switchport
SW1(config-if-range)#switchport mode private-vlan host
SW1(config-if-range)#switchport private-vlan host-association 500 300

SW1(config)#int range e1/0 - 1
SW1(config-if-range)#switchport
SW1(config-if-range)#switchport private-vlan host-association 500 100

SW1(config)#int range e1/2 - 3
SW1(config-if-range)#switchport
SW1(config-if-range)#switchport private-vlan host-association 500 200

SW1(config)#int e0/0
SW1(config-if)#switchport
SW1(config-if)#switchport mode private-vlan promiscuous
SW1(config-if)#switchport private-vlan mapping 500 100,200,300

Basic Network Configuration of Linux System

Main configuration files

  • /etc/hostname : contains name of host machine ; give the hostname in this file to permanently change the hostname. Otherwise, use "hostname" command to change the hostname temporarily

#hostname client1.ciscofriend.comLinux Basic Networking

  • /etc/hosts : Contains Name to IP mapping in the local system
  • /etc/resolv.conf : Contains address of DNS servers
  • /etc/nsswitch.conf : Determines order in which name resolution take place in system. We can change the order in this file  to configure  system to check first DNS then host file etc.

Redhat Network Files

  • /etc/sysconfig/networks-scripts/ifcfg-eth0 : IP address information stored here
  • /etc/sysconfig/network : This file contains the hostname; but this is a non standard way, Ubuntu/Debain is using the correct way

Debian/Ubuntu Network files

  • /etc/network/interfaces

Commands to configure network

  • Ifconfig : dipsplay and configure network interfaces

#ifconfig eth0 192.168.1.22  (set the IP of Ethernet 0 interface to 192.168.1.22)

#ifconfig eth0 netmask 255.255.255.0  (set the subnet mask)

#ifconfig eth0 hw ether 00:00:00:00:00:11 (To change the MAC address of eth0 interface)

#route add default gw 192.168.1.1  (To change the default gateway)

  • Ifup : configure and activate network interface based on config files

#ifup eth0

  • Ifdown- disable configured network interfaces

#ifdown eth0

Wednesday, December 21, 2011

Commonly Using Port Numbers

Port TCP UDP Description
20 x   FTP-Data
21 x   FTP (login access)
22 x x SSH
23 x   Telent
25 x   SMTP (Mail, MTA)
49 x   TACACS+
53 x x DNS
69   x TFTP
80 x x HTTP (Web)
110 x x POP3 (email); generally uses TCP)
119 x   NNTP (Usenet News)
123   x NTP
139 x x NetBIOS (Microsoft)
143 x x IMAP
161 x x SNMP (Network Monitor)
179 x   BGP
443 x x HTTPS
465 x   SMTPS (Secure Mail over SSL)
993 x x IMAP (Secure IMAP over SSL)
995 x x POP3S (Secure POP3 over SSL)
1645,1812   x RADIUS Authentication
1646,1813   x RADIUS Accounting

Sunday, December 18, 2011

Installing Active directory in Windows Server 2008

Before starting installation process, make sure that the IP address computer name are correct. Now use server manager to add rolls or type “oobe” in the command prompt. Now the following window will appear:

CF-DC1-2011-12-17-05-27-53

Press add roles and now press next

CF-DC1-2011-12-17-05-28-29

Select the Active directory Domain Services check box and press next . This tells the server we want to install active directory

CF-DC1-2011-12-17-05-29-12

Press next

CF-DC1-2011-12-17-05-29-20

press next

CF-DC1-2011-12-17-05-29-27

press install

CF-DC1-2011-12-17-05-29-35

now we may close this wizard, if we close we need to type “dcpromo” on the command prompt and continue installation. Otherwise, press the link in the window highlighted by blue

CF-DC1-2011-12-17-05-30-19

Note : all the above steps can be done just typing “dcpromo” in the command prompt.

We are using normal mode. So press next. Advanced mode installation can be used to install read only domain controller

CF-DC1-2011-12-17-05-32-23

Press next if we are not using NT4 computers

CF-DC1-2011-12-17-05-32-35

Now Select “Create a new domain in a new forest” because we are creating new domain. If we have existing domain and we want to add additional domain controller, add child domain etc. we must use the other option

CF-DC1-2011-12-17-05-32-45

Enter the domain name for our new domain

CF-DC1-2011-12-17-05-32-54

Enter the forest functional level. If forest functional level /domain functional level is higher, more features will be enabled. I will explain about forest and domain functional level in another post.

CF-DC1-2011-12-17-05-33-28

Enter the domain functional level. As above, higher is better

CF-DC1-2011-12-17-05-33-33

Select DNS because we don’t have another DNS server. If we have another one, we can use that one.

CF-DC1-2011-12-17-05-33-39

Note: If static IP not given already, it will give the warning. We can also give the IP address here. if error occurs again, that means you didn’t given IPv6 address. To solve this problem, either give IPv6 address or disable IPv6 addressing by removing check mark  in the configuration window of Network card

Press yes and next

CF-DC1-2011-12-17-05-34-51

Press next if we don’t want to change the location of active directory files. NTDS is the active directory database

CF-DC1-2011-12-17-05-34-56

Give the password to restore active directory if any problem occurs and press next

CF-DC1-2011-12-17-05-35-08

This window gives the summary of the answer we already given. If we want, we can press the export button to save the answer file for future installation or command line installation

CF-DC1-2011-12-17-05-35-30

Now active directory installation starts and tick the check box reboot on completion

CF-DC1-2011-12-17-05-35-41

After that reboot, we can see the role is installed in server manager. Also check the computer properties for details

Thursday, December 8, 2011

Upgrading Windows Server 2003 to Windows Server 2008

Before joining/upgrading  the Windows Server 2003 to Windows server 2008 domain, we need to upgrade the schema. To check the scheme is in old version or not, do the following:

Open windows registry by type regedit on the command prompt and go to

Hkey_local_machine > system > current control set > services > ntds> schema version

now check the version :

  • 31 means old
  • 44 means new (windows server 2008)

If it is 31, it means we need to upgrade the schema. To upgrade the schema and make it ready for windows server 2008, do the following:

In the Windows Server 2008 DVD, go to sources > adprep directory and do the following commands

d:\souces\adprep> adprep /forestprep

d:\souces\adprep> adprep /domainprep /gpprep

notes:

  • here My dvd drive is D:
  • /gpprep : used to changes permissions on group policy objects

Now, we can join the server to Windows Server 2008 domain or if it is already a domain controller, we can upgrade it to Windows Server 2008

Configuring ASA to allow ping

Just add ICMP to default inspection class:firewall
ASA(config)#policy-map global_policy
ASA(config-pmap)#class inspection_default
ASA(config-pmap-c)#inspect icmp

Tuesday, December 6, 2011

HTTP installation of RHEL6/CentOS/SL-6

On Server

  • Install apache server (HTTP server) using yum apache webserver5

#yum install httpd

Note: if you don’t know how to setup yum you can see this post

  • Mount the DVD (which is also specified in the above post) and copy the content to /var/www/html/cdrom

For example, if DVD is mounted to /cdrom directory, then

#cp –vrf /cdrom /var/www/html/

Note: alternatively, we can mount the DVD directly to the web accessible, /var/www/html/ path

  • Now, start the http service

#service httpd start

  • Check the setting using the web browser with server’s IP. If server IP is 192.168.1.10 then use http://192.168.1.10/cdrom 

Note: if firewall is on, turn off firewall or add exception to port 80

 

On the installation system

  • Download boot.iso from redhat.

Note: boot.iso not ship with DVD now. So we need to download it from redhat site. Alternatively we can use CentOS netinstall.iso, both are same

  • CentOS 6 netinstall.iso is available here:  redhat logo

http://mirrors.hns.net.in/centos/6.0/isos/x86_64/CentOS-6.0-x86_64-netinstall.iso

http://mirrors.hns.net.in/centos/6.0/isos/i386/CentOS-6.0-i386-netinstall.iso

  • Write the the image to a CD and put it in the CD-ROM drive. Alternatively, we can use USB key. It is explained here.
  • Reboot the system and supply the following boot string at the end of current line without quotes by pressing tab

'linux repo=http://192.168.1.10/cdrom ip=192.168.1.20 netmask=255.255.255.0 gateway=192.168.1.1 dns=192.168.1.1'

Note: if more than one DNS server is available specify it using comma. DNS server address is optional. Here IP is the address of the current system

Monday, December 5, 2011

Making CD/DVD as yum repository

1. Mount the CD/DVD to a folder

# mkdir /cdromcdrom

# mount -t iso9660 -o ro /dev/cdrom /cdrom

2. Create a repository file for that folder in /etc/yum.repos.d/

# nano /etc/yum.repos.d/cdrom.repo

Now add the following content to the file and save the file

[cdrom]
name=CD repo
baseurl=file:///cdrom
gpgcheck=0

Now we can install software using the yum command

Saturday, December 3, 2011

Disable login of all users except root

sudo touch /etc/nologin

Note: Now, only root can login to the system. Login as root and delete that file to allow other users to login

rm /etc/nologin