CentOS SNMP Client Setup

  1. Install

    root@cmlin03:/# yum install net-snmp-utils
    
  2. Backup original config

    joe@cmlin03:/etc/snmp# sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
    
  3. Create new config

    joe@cmlin03:/etc/snmp# sudo vi /etc/snmp/snmpd.conf
    rocommunity	mycommunity
    syslocation	"office rack, large server"
    syscontact	joe@smithinc.com
    
  4. Configure iptables to allow snmp connections

    sudo vi /etc/sysconfig/iptables
    -A INPUT -p tcp --dport 161 -j ACCEPT
    -A INPUT -p udp --dport 161 -j ACCEPT
    
  5. Start the service

    /etc/init.d/snmpd start
    
  6. Test

    joe@cmlin02:/etc/snmp# snmpwalk -v 1 -c mycommunity -O e localhost
    
  7. Configure to start snmpd on boot

    joe@cmlin02:/etc/snmp# sudo chkconfig snmpd on
    

CentOS 6 – Enable logging for OpenLDAP

[root@cmlin02 openldap]# vi /etc/rsyslog.conf 

...
# LDAP
local4.* /var/log/ldap.log

 ...
[root@cmlin02 openldap]# /etc/init.d/rsyslog restart
Shutting down system logger:                               [  OK  ]
Starting system logger:                                    [  OK  ]
[root@cmlin02 openldap]# 
[root@cmlin02 openldap]# touch /var/log/ldap.log
[root@cmlin02 openldap]# service slapd restart
[root@cmlin02 log]# tail -100f /var/log/ldap.log 
...

Jul 25 10:43:24 cmlin02 slapd[10271]: conn=1019 op=196 SRCH attr=cn
Jul 25 10:43:24 cmlin02 slapd[10271]: <= bdb_equality_candidates: (member) not indexed
Jul 25 10:43:24 cmlin02 slapd[10271]: <= bdb_equality_candidates: (uniqueMember) not indexed
Jul 25 10:43:24 cmlin02 slapd[10271]: conn=1019 op=196 SEARCH RESULT tag=101 err=0 nentries=1 text=

CentOS named debug logging

I need to debug my DNS and the best way to do so is via logging. Therefore:

[root@cmlin02 ~]# vi /etc/named.conf

...

logging {
  channel "default_syslog" {
    #syslog local6;
    file "/var/log/named/named.log" versions 3 size 5m;
    severity debug;
  };

  category default { default_syslog; };
  category general { default_syslog; };
  category config { default_syslog; };
  category security { default_syslog; };
  category resolver { default_syslog; };
  category xfer-in { default_syslog; };
  category xfer-out { default_syslog; };
  category notify { default_syslog; };
  category client { default_syslog; };
  category network { default_syslog; };
  category update { default_syslog; };
  #category queries { default_syslog; };
  category lame-servers { default_syslog; };
};
...
[root@cmlin02 ~]# service named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]
[root@cmlin02 ~]# tail -f /var/log/named/named.log 
...

centos /etc/resolv.conf resets itself on reboot

On centos, everytime I reboot /etc/resolv.conf resets itself. Turns out it is the PEERDNS var inside the network config.

[root@cmlin02 ~]# more /usr/share/doc/initscripts-9.03.27/sysconfig.txt
PEERDNS=yes|no

modify /etc/resolv.conf if peer uses msdns extension (PPP only) or
DNS{1,2} are set, or if using dhclient. default to “yes”.

[root@cmlin02 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0 | grep PEERDNS
[root@cmlin02 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
...
PEERDNS=no
...

then reboot