3.3.13

SNMPv3設定

在Ubuntu底下設定SNMPv3 , 用的是net-snmp的指令
SNMP這個協定 , 一般用來監測網路設備 , 以方便管理
一般大眾用的都是V1 ,V2的版本 , 這兩個版本並無加密機制
如果有人惡意在捕捉網路封包 , 區網架構將會有洩密之虞
所以後來改進的第三版 , 加入了認證、隱私和存取控制的機制




參考這篇文件設定SNMPv1 SNMPv2
ubuntu1204 + SNMP + MRTG

我們來加入SNMPv3
先停止snmpd
/etc/init.d/snmpd stop
輸入
net-snmp-config --create-snmpv3-user -ro -a MD5 -A 12345678 public
//-a 加密方式
//-A 密碼 //最小8位
// public 是帳號
輸入這段指令只是測試用 , 完成後 , 你會發現帳號密碼存到哪些目錄
帳號
/var/lib/snmp/snmp.conf
//你會在此檔案中找到public
密碼
/usr/share/snmp/snmpd.conf
//你會在此檔案中找到12345678
啟動snmpd
/etc/init.d/snmpd start
//一定要先停止snmpd , 才能寫入帳號密碼
測試
snmpwalk -v3 -u public -l auth -a MD5 -A 12345678 localhost
這樣架構就有了 , 接下來看說明
net-snmp-config:
--create-snmpv3-user [-ro] [-a authpass] [-x privpass] [-X DES]
[-A MD5|SHA] [username]

snmpwalk:
V3驗證常用參數
-v 1|2c|3 specifies SNMP version to use
-u USER-NAME set security name (e.g. bert)
-l LEVEL set security level (noAuthNoPriv|authNoPriv|authPriv)
-a PROTOCOL set authentication protocol (MD5|SHA)
-A PASSPHRASE set authentication protocol pass phrase
-x PROTOCOL set privacy protocol (DES|AES)
-X PASSPHRASE set privacy protocol pass phrase
V2c/V1驗證常用
-c COMMUNITY set the community string


net-snmp-config --create-snmpv3-user -ro -a MD5 -A 12345678 -x DES -X 12345678 public
接下來對數據進行DES加密
net-snmp-config --create-snmpv3-user -ro -a SHA -A 12345678 -x AES -X 12345678 public
加密方式有四種 
測試                //如果你帳號密碼一直沒改 , 會一直覆蓋過去 , 取最後一次來測試
snmpwalk -v3 -u public -l auth -a MD5 -A 12345678 -x DES -X 12345678 localhost
snmpwalk -v3 -u public -l auth -a SHA -A 12345678 -x AES -X 12345678 localhost

沒有留言:

張貼留言