4 in 1 fast config of DHCP NTP NFS and RSYSLOGD for me

Step 1 –> I need a DHCP server for multiple subnets, here is the config

->To install DHCP packages
sudo apt-get install isc-dhcp-server

->To set which interface will listen DHCP requests
sudo vi /etc/default/isc-dhcp-server

->Here configure INTERFACES=”” section for multiple interface use like this INTERFACES=”eth1 eth2″

->Do some config for subnets , i did not change something about general just added the lines end of the file

sudo vi /etc/dhcp/dhcpd.conf

# vCenter Site A Mng Block
subnet 10.111.31.0  netmask 255.255.255.0 {
range 10.111.31.100 10.111.31.150;
option routers                  10.111.31.1;
option subnet-mask              255.255.255.0;
option broadcast-address        10.111.31.255;
option domain-name-servers      8.8.8.8;
}

->To see the dhcp deamon
sudo service isc-dhcp-server start

->To see the process
dhcpd     1705     1  0 11:35 ?        00:00:00 dhcpd -user dhcpd -group dhcpd -f -q -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/dhcp/dhcpd.conf eth1

->To see the leases
cat /var/lib/dhcp/dhcpd.leases

Thats it !

Step 2 –> I need a Local Time Server because my nodes do not have internet connectivity

-> To install ntp packages

sudo apt-get install ntp

-> Jump in to config , i changed already ubuntu time server with my local
vi /etc/ntp.conf

-> These are for Turkey local NTP provider

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server ntp1.ulakbim.gov.tr
server ntp2.ulakbim.gov.tr

-> These are default don’t touch

# By default, exchange time with everybody, but don’t allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

->Add you nodes network to query time from you

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust
restrict 10.111.31.0 mask 255.255.255.0 nomodify notrap
restrict 10.111.34.0 mask 255.255.255.0 nomodify notrap

->Start the service

noroot@ubudhcpdns:~$ sudo /etc/init.d/ntp restart
* Stopping NTP server ntpd                                                                                                                                           [ OK ]
* Starting NTP server ntpd

-> Query it
noroot@ubudhcpdns:~$ ntpq -c lpeer
remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+samur.ulak.net. 131.188.3.221    2 u  565   64    0    9.141    3.471   0.184
*193.140.100.41  130.149.17.21    2 u   97   64  326    9.018    2.773   1.273
juniperberry.ca .INIT.          16 u    –  512    0    0.000    0.000   0.000

->I used it for local ESX i nodes, check it

[root@vCENTER-sITE-a:~] ntpq -p
remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.111.31.3     193.140.100.41   3 u   51   64  377    0.072    8.987   0.408

Thats it !

Step 3 –> I need a iso store , install nfs and share it

-> To install ntp packages
noroot@ubudhcpdns:~$ sudo apt-get install nfs-kernel-server

-> Configure export , first create the folder start to upload iso files and then export it

sudo vi /etc/exports

/isos  *(ro,sync,no_root_squash)

noroot@ubudhcpdns:/$ sudo /etc/init.d/nfs-kernel-server start
* Exporting directories for NFS kernel daemon…                                                                                            exportfs: /etc/exports [1]: Neither ‘subtree_check’ or ‘no_subtree_check’ specified for export “*:/isos”.
Assuming default behaviour (‘no_subtree_check’).
NOTE: this default has changed since nfs-utils version 1.0.x

[ OK ]
* Starting NFS kernel daemon

Thats it !

Step 4 –> Configure rsyslogd to convert your server central logging

–> First create a folder name “loggs” then change the owner of it

noroot@rabbitmq:/var/log$ sudo chown syslog:adm /logss

Above i used syslog:adm because under /var folder some of folders owner set like that

–> Edit rsyslogd.conf and add/changes realated lines

(myself i activated udp/tcp together)
# provides UDP syslog reception

$ModLoad imudp

$UDPServerRun 514

# provides TCP syslog reception

$ModLoad imtcp

$InputTCPServerRun 514

and add such lines end of the file

# Dynamic Remote Loggin Config

$template FILENAME,”/logss/%fromhost-ip%/syslog.log”

*.* ?FILENAME

–> Restart rsyslogd and try you get the logs or not !

Some notes :

its possible to use %PROGRAMNAME% tag for file creation

*.* ?FILENAME –> get all type of events not just only “cron.*” or others and ?FILENAME is like a placeholder

then under the path with host ip address logs are will be stored

VM

 

 

Posted on 14/09/2015, in Linux and tagged , , . Bookmark the permalink. 1 Comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: