Sunday, February 17, 2019

configuring snmp with ipv6 ip address on linux servers


When we configure snmpd with ipv6 ip address on Linux servers like CentOS or Redhat Enterprises Linux systems we may get an error like : SNMP Error: cannot resolve source hostname. It is because snmp is trying to resolve your ipv6 address as ipv4. To make it work, we need to modify it as below.
com2sec -> com2sec6

To make the snmpd listen on ipv6 address, we need to add the following line to the snmpd.conf file
agentaddress udp6:161
That will make snmpd bind to your ipv6 address.

To set the community string with ipv6 we have to use the parameter com2sec6 instead of com2sec which is used for ipv4.

Let us see the example below.
[root@Hostname ~]# cat /etc/snmp/snmpd.conf
com2sec6 notConfigUser  140b:c010:101:53e1::11 community_string

group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c         notConfigUser

view    systemview    included   .1.3.6
access  notConfigGroup ""      any       noauth    exact  systemview none none

syslocation Organization_name Project_name
syscontact IT Group <>

master agentx
pass . /usr/bin/ucd5820stat

smuxpeer .
dontLogTCPWrappersConnects 1

interface bond0 6 2000000000
interface bond1 6 2000000000

agentaddress udp6:161

Then restart snmpd. If its centos7 or rhel7
[root@Hostname ~]# systemctl restart snmpd

No comments:

Post a Comment

Be nice. That's all.