Search Windows and Linux Networking

Tuesday, October 25, 2011

Configure Cisco Router with OSPF and DHCP Relay Agent

Configure Network with using  Cisco Router and DHCP server

Today we will see how to configure cisco router with ospf and act as relay agent.


For example we have a DHCP Server that is configure to provide IP address two different network  192.168.0.0/24 and 192.168.2.0/24.  DHCP is providing correct ip in same network(head office) but in other network client are not getting ip address from DHCP server.
Problem is occurring  because by default router break broadcast domain .to fix the problem we have told router to allow DHCP DORA process



Head office Router

Router>
Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
HeadOffice(config)#hostname HeadOffice
HeadOffice(config)#interface FastEthernet 0/0
HeadOffice(config-if)#ip address 192.168.0.1 255.255.255.0
HeadOffice(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

HeadOffice(config-if)#exit
HeadOffice(config)#interface FastEthernet 1/0
HeadOffice(config-if)#ip address 192.168.1.1 255.255.255.0
HeadOffice(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up

HeadOffice(config-if)#exit
HeadOffice(config)#

Configure routing with ospf:-

HeadOffice(config)#router ospf 1
HeadOffice(config-router)#network 192.168.0.0 0.0.0.255 area 0
HeadOffice(config-router)#network 192.168.1.0 0.0.0.255 area 0
HeadOffice(config-router)#

00:53:17: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.2.1 on FastEthernet1/0 from LOADING to FULL, Loading Done

HeadOffice(config-router)#exit
HeadOffice(config)#exit

%SYS-5-CONFIG_I: Configured from console by console
HeadOffice#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.0.0/24 is directly connected, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet1/0
O    192.168.2.0/24 [110/2] via 192.168.1.2, 00:00:18, FastEthernet1/0

HeadOffice#

Saving Our Configuration 

HeadOffice#copy running-config startup-config
Destination filename [startup-config]? [Press Enter Key]
Building configuration...
[OK]
HeadOffice#

Branch Office Router
Router> [Press Enter key]
Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname branchoffice
branchoffice(config)#interface fastEthernet 1/0
branchoffice(config-if)#ip address 192.168.1.2 255.255.255.0
branchoffice(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up

branchoffice(config-if)#exit
branchoffice(config)#interface fastEthernet 0/0
branchoffice(config-if)#ip address 192.168.2.1 255.255.255.0
branchoffice(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up

Configure routing with ospf

branchoffice(config)#router ospf 1
branchoffice(config-router)#network 192.168.1.0 0.0.0.255 area 0
branchoffice(config-router)#network 192.168.2.0 0.0.0.255 area 0
branchoffice(config-router)#exit
branchoffice(config)#exit
Verity Route:-

Verify all network are now known to router by show ip route command

branchoffice#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

O    192.168.0.0/24 [110/2] via 192.168.1.1, 00:00:33, FastEthernet1/0
C    192.168.1.0/24 is directly connected, FastEthernet1/0
C    192.168.2.0/24 is directly connected, FastEthernet0/0
Check our network are accessible or not by ping command :- 

branchoffice#ping 192.168.0.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 31/31/32 ms


Configure Router for DHCP Relay agent 
By default Router break brodcast domain and dhcp DORA process run by brodcasting for DHCP Server to get IP address information so we need to told router to send dhcp brodcast to DHCP Server.

branchoffice#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
branchoffice(config)#interface fastEthernet 0/0
branchoffice(config-if)#ip helper-address 192.168.0.2
branchoffice(config-if)#exit
branchoffice(config)#exit
branchoffice#

Saving Our Configuration 


branchoffice#copy running-config startup-config
Destination filename [startup-config]? [Press Enter Key]
Building configuration...
[OK]
branchoffice#

Now DHCP server will provide correct ip address by looking at network request coming from for example 192.168.2.0 /24 network. it simple

Wednesday, October 19, 2011

Adding Windows host in to Nagios Monitoring System

Monitoring windows host from Nagios monitoring system

Last time we have seen how to install nagios. Today we will see how to add Windows system in to nagios for monitoring.

suppose I wanted to monitor following  network in to nagios :-
Suppose :-
Server-PT is mail server and IP address is 192.168.1.2
Router1 has ip address eth0 192.168.1.1 and for eth1 192.168.2.1
Router0 has ip address eth1 192.168.2.2 and for eth0 192.168.3.1
and our other server are in this network like Nagios server, File server, Domain Controller and access point.
Nagios has ip address 192.168.3.2
File_server has ip address 192.168.3.3
AD_server is working as DNS, DHCP and Domain Controller server and it has ip address 192.168.3.4
Access_point has ip address 192.168.3.5

Now login in to Nagios and create object configuration file as:-

# touch /etc/nagios/hosts.cfg   (To define host)
# touch /etc/nagios/services.cfg (To define Services)
# touch /etc/nagios/hostgroups.cfg (To define hostgroups)
# touch /etc/nagios/contacts.cfg (To define Contacts details)





Give sufficient right to nagios to read file 
# chown -r nagios.nagios /etc/nagios/*

Now specify all these file and directory in nagios main configuration file.
# vi /etc/nagios/nagios.cfg
cfg_file=/etc/nagios/hosts.cfg
cfg_file=/etc/nagios/services.cfg
cfg_file=/etc/nagios/hostgroups.cfg
cfg_file=/etc/nagios/contacts.cfg

Now configure object configuration file:-

# vi /etc/nagios/contacts.cfg
 # Define contact details
define contact{
contact_name              sandeep
use                                generic-contact
alias                             Sandeep Kapadane
email                            sandeepk@domainname.com
        }

define contact{
contact_name              help
use                               generic-contact
alias                             IT Support help
email                            help@domainname.com
        }

define contact{
contact_name              manager
use                               generic-contact
alias                             Team Manager
email                            manager@domainname.com
        }

# Define contact groups

define contactgroup{
contactgroup_name     It-Team
alias                             IT Team
members                      sandeepk,help,manager
        }
# vi /etc/nagios/hosts.cfg
# Create template for host as generic-server and core-server

define host{
 name                           generic-server
notifications_enabled              1
event_handler_enabled           1
flap_detection_enabled           1
failure_prediction_enabled      1
process_perf_data                  1
retain_status_information         1
retain_nonstatus_information    1
notification_period                   24x7
register                                    0
        }

define host{
 name                           core-server
use                               generic-server
check_period               24x7
check_interval              5
retry_interval               1
max_check_attempts   10
check_command         check-host-alive
notification_interval      60
notification_options      d,u,r
contact_groups            admins
register                        0
        }

# Define host

define host{
 use                              core-server
host_name                   Router0
alias                             Router0
address                       192.168.3.1
}

define host{
 use                              core-server
host_name                   Router1
alias                             Router1
address                       192.168.1.1
parents                         Router0
}

define host{
 use                              core-server
host_name                   Server-PT
alias                             Mail Server
address                       192.168.1.2
parents                         Router1
}

define host{
 use                              core-server
host_name                   File_server
alias                             File Server
address                       192.168.3.3   
}

define host{
use                               core-server
host_name                   AD_server
alias                             Domain Controller
address                       192.168.3.4
}

define host{
use                               core-server
host_name                   Access_point
alias                             Wireless Access point
address                        192.168.3.5
}

Now define Host Groups in object configuation file

# vi /etc/nagios/hostgroups.cfg
define hostgroup{
hostgroup_name          all_hosts
alias                             All Hosts
members                      Router0, Router1, Server-PT, File_server, AD_server, Access_point
        }

define hostgroup{
hostgroup_name          Domain Controllers
alias                             Domain Controllers
members                      AD_server
}

define hostgroup{
hostgroup_name          CoreNetwork
alias                             CoreNetwork
members                      Router0, Router1,Access_point
}

define hostgroup{
hostgroup_name          CoreServer
alias                             CoreServer
members                      Server-PT, File_server, AD_server
}

Now Define Services to monitor in object configuration file services.cfg
# vi /etc/nagios/services.cfg
  # Create Template for all services.

define service{
name                                         services
active_checks_enabled               1
passive_checks_enabled             1
parallelize_check                        1
obsess_over_service                  1
check_freshness                         0
notifications_enabled                  1
event_handler_enabled               1
flap_detection_enabled               1
failure_prediction_enabled          1
process_perf_data                     1
retain_status_information            1
retain_nonstatus_information       1
is_volatile                                   0
check_period                             24x7
max_check_attempts                 3
normal_check_interval               10
retry_check_interval                  2
contact_groups                          admins
notification_options                   w,u,c,r
# notification_interval                60
notification_period                    24x7
register                                     0
        }
# create template for Ping service

define service{
use                               services
name                            ping
check_command          check_ping!1000.0,20%!2000.0,60%
register                         0
        }
# Add host for ping
define service{
use                               ping
service_description       PING
hostgroup_name           all_hosts
        }
# Monitor UP Time

define service{
use                               services
name                            uptime
check_command          check_nt!UPTIME
register                         0
        }

define service{
use                               uptime
service_description     UP TIME
host_name                   Server-PT, File_server, AD_server
hostgroup_name               
}
define service{
use                               services
name                            Uptime
check_command         check_snmp!-C public -o sysUpTime.
register                                    0
        }

define service{
use                               Uptime
service_description     UP TIME
# host_name                      
           hostgroup_name             CoreNetwork
}


# Monitoring Disk Space 

define service{
        use                               services
        name                            Disk space on c
        check_command          check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        register                        0
        }
define service{
          use                             Disk space on c
          service_description     C: Drive Space
         host_name                  Server-PT, File_server, AD_server
#        hostgroup_name         Domain Controllers
}
define service{
        use                               services
        name                            Disk space on d
        check_command          check_nt!USEDDISKSPACE!-l d -w 80 -c 90
        register                         0
        }
define service{
          use                             Disk space on d
          service_description     D: Drive Space
         host_name                  Server-PT, File_server
#        hostgroup_name         Domain Controllers
}

# Monitoring CPU Load 

define service{
        use                             services
        name                          CPU Load
        check_command        check_nt!CLIENTVERSION
        register                        0
        }
define service{
        use                                    CPU Load
        service_description            CPU Load
        hostgroup_name                Domain Controllers
       host_name                          Server-PT
        }

# Monitoring Memory Usage 
define service{
        use                             services
        name                          Memory Usage
        check_command        check_nt!MEMUSE!-w 80 -c 90
        register                        0
        }
define service{
        use                                     Memory Usage
        service_description             Memory Usage
        hostgroup_name                  Domain Controllers
       host_name                            Server-PT
        }
# Monitoring System Services

define service{
        use                             services
        name                          Server Service
        check_command        check_nt!SERVICESTATE!-d SHOWALL -l lanmanServer
        register                        0
        }
define service{
        use                             Server Service
        service_description     Server Service
#       hostgroup_name         Domain Controllers
       host_name                   Server-PT, File_server, AD_server
        }

define service{
        use                             services
        name                          DNS Server Service
        check_command        check_nt!SERVICESTATE!-d SHOWALL -l Dns
        register                        0
        }
define service{
        use                                    DNS Server Service
        service_description             DNS Server Service
        hostgroup_name                  Domain Controllers
#       host_name
        }

define service{
        use                             services
        name                          DHCP Server Service
        check_command        check_nt!SERVICESTATE!-d SHOWALL -l DhcpServer
        register                       0
        }
define service{
        use                             DHCP Server Service
        service_description     DHCP Server Service
        hostgroup_name         Domain Controllers
#       host_name
       }

define service{
        use                             services
        name                          Net Logon service
        check_command        check_nt!SERVICESTATE!-d SHOWALL -l Netlogon
        register                       0
        }
define service{
        use                             Net Logon service
        service_description     Net Logon service
        hostgroup_name         Domain Controllers
#       host_name
        }

# Monitoring NSClient Version 


define service{
        use                               services
        name                            NSClinet Version
        check_command           check_nt!CLIENTVERSION
        register                        0
        }
define service{
        use                                NSClinet Version
        service_description        NSClient++ Version
#      hostgroup_name            Domain Controllers
        host_name                    Server-PT, File_server, AD_server
        }

# Next time we will see how to configure nagios for host and service escalation and dependency

Wednesday, October 12, 2011

How To Install FTP Server role on Windows Server 2008 Core


To install FTP server role on Windows 2008 Core we will need to follow below steps..

1) First we will need to install IIS web server role using below command.


2) Then we will need to run below command for IIS Management compatibility.



3) After that run below command for IIS Metabase.


4) After that we will need to run below command for FTP publishing service.



5) Finally we have to run below command for FTP Server



This was the setup part of FTP Server. Home directory for this FTP server will be a default one i.e. C:\InetPub\FTPRoot (considering your OS is installed on C drive).

Now we have to set FTP service as "auto" to start it with windows for this we have to use below command.



And then start the service using below command you will receive success massage.



But we will not be able to access the FTP server unless we configure the firewall accordingly.

For this we have to add Allow rule for the FTP port in firewall using below command.



To activate firewall application filter for FTP that will dynamically open ports for data connections use below command.

netsh advfirewall set global StatefulFtp enable