νƒœκ·Έ 보관물: Linux

Eve-NGμ—μ„œ OpenNMS κ΅¬μΆ•ν•˜κΈ°

 

1. 사전 μ€€λΉ„

  • Eve-NG 파일 λͺ©λ‘
    • Router: c3725-adventerprisek9-mz.124-15.T14
    • Switch: i86bi-linux-l2-adventerprisek9-15.1a
    • OpenNMS μ„œλ²„ : linux-ubuntu-18.04-server.tar.gz

이외 ν˜Έν™˜ μž₯λΉ„ λͺ©λ‘μ€ Eve-NG νŽ˜μ΄μ§€ μ°Έκ³ !
μ΄λ―Έμ§€λŠ” κ΅¬κΈ€λ§ν•˜λ©΄ μ‰½κ²Œ 찾을 수 μžˆλ‹€.


2. Eve-NG λ„€νŠΈμ›Œν¬ ꡬ성

Eve-NG 내뢀에 μœ„μΉ˜ν•œ μ„œλ²„ 말고, PC의 VMμ„œλ²„μ— 직접 μ„€μΉ˜ν•΄λ„ λ¬΄λ°©ν•˜μ§€λ§Œ, Eve-NG에 μ„€μΉ˜ν•΄λ³΄λ„λ‘ ν•œλ‹€.

2-1) 곡유기 ꡬ성(IPTIME)
κ³ κΈ‰ μ„€μ • > NAT/λΌμš°ν„° 관리 > λΌμš°νŒ… ν…Œμ΄λΈ” 관리

2-2) VMware λ„€νŠΈμ›Œν¬
Bridged둜 μ„€μ •ν•œλ‹€.
가상머신에도 곡유기의 사섀 IPκ°€ λΆ€μ—¬λœλ‹€.

2-3) Eve-NG λΌμš°ν„°

Router> 
Router> en 
Router# conf t 
Router(config)# int fa0/0 
Router(config-if)# ip addr 192.168.0.250 255.255.255.0 
Router(config-if)# exit 
Router(config)#  
Router(config)# inf fa0/1 
Router(config-if)# ip addr 10.10.10.1 255.255.255.0 
Router(config-if)# exit 
Router(config)#  
Router(config)# ip route 0.0.0.0 0.0.0.0 192.168.0.1 
Router(config)# 

2-4) Eve-NG Network Cloud
Add an object > Network > Type: Management(Cloud0)

2-5) Eve-NG λ‚΄λΆ€ OpenNMS μ„œλ²„ 및 VPC
– OpenNMSμ„œλ²„ (Ubuntu)
“/etc/netplan/01-netcfg.yaml” μˆ˜μ •

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 10.10.10.200/24
      gateway4: 10.10.10.1
      nameservers:
          addresses: [168.126.63.1, 8.8.8.8]
    eth1:
      dhcp4: yes

μˆ˜μ • ν›„ “sudo netplan apply”둜 μ μš©ν•˜κΈ°.

– VPC
ip 10.10.10.10 255.255.255.0 10.10.10.1


3. OpenNMS μ„œλ²„ μ„€μ •

[1] NMS νŒ¨ν‚€μ§€ μ„€μΉ˜

– /etc/apt/sources.list.d/opennms.list 파일 νŽΈμ§‘
 : apt repository μΆ”κ°€

deb https://debian.opennms.org stable main
deb-src https://debian.opennms.org stable main
 

– GPG ν‚€ μΆ”κ°€
wget -0 – https://debian.opennms.org/OPENNMS-GPG-KEY | apt-key add –

– OpenNMS μ„€μΉ˜
apt update
apt -y install opennms

[2] PostgreSQL μ„€μ •
– PostgreSQL μ„œλΉ„μŠ€ μ‹œμž‘
systemctl start postgresql

– PostgreSQL μ‚¬μš©μž 및 DB 생성

su - postgres
createuser -P opennms 
createdb -O opennms opennms
psql -c "ALTER USER postgres WITH PASSWORD 'YOUR-POSTGRES-PASSWORD';"
exit

1: postgres μœ μ €λ‘œ λ³€κ²½ / postgreSQL은 postgres μœ μ €λ§Œ μ ‘κ·Όκ°€λŠ₯
2: β€˜opennms’ μœ μ € 생성
3: μ†Œμœ μžκ°€ β€˜opennms’인 opennms DB 생성
4: postgres μœ μ € λΉ„λ°€λ²ˆν˜Έ μ„€μ •.
– postgreSQL 접속 없이 psql λͺ…λ Ήμ–΄ μ‹€ν–‰
– psql μ ‘μ†ν–ˆλ‹€λ©΄, psql -c β€œβ€ μ§€μš°κ³  μ‹€ν–‰
– YOUR-POSTGRES-PASSWORD에 μ›ν•˜λŠ” λΉ„λ°€λ²ˆν˜Έ μž…λ ₯
5: κΈ°μ‘΄ 접속 κ³„μ •μœΌλ‘œ λŒμ•„κ°€κΈ°

– opennms-datasources.xml μˆ˜μ •
OPENNMS_HOME=/usr/share/opennms
(ν™˜κ²½ λ³€μˆ˜λ₯Ό μ„€μ •ν•œλ‹€.)

vim ${OPENNMS_HOME}/etc/opennms-datasources.xml
 
<jdbc-data-source name="opennms"
                    database-name="opennms"
                    class-name="org.postgresql.Driver"
                    url="jdbc:postgresql://localhost:5432/opennms"
                    user-name="** YOUR-OPENNMS-USERNAME **"
                    password="** YOUR-OPENNMS-PASSWORD **" />
 
<jdbc-data-source name="opennms-admin"
                    database-name="template1"
                    class-name="org.postgresql.Driver"
                   url="jdbc:postgresql://localhost:5432/template1"
                    user-name="postgres"
                    password="** YOUR-POSTGRES-PASSWORD **" />

4: μ•žμ„œ μƒμ„±ν•œ DBλͺ…
7: DB에 μ ‘κ·Όν•  수 μžˆλŠ” μœ μ €λͺ…
8: DB에 μ ‘κ·Όν•  수 μžˆλŠ” μœ μ €μ˜ λΉ„λ°€λ²ˆν˜Έ
14: postgreSQL κ΄€λ¦¬μž 접근을 가진 μœ μ €λͺ…
15: postgreSQL κ΄€λ¦¬μž 접근을 가진 μœ μ €μ˜ λΉ„λ°€λ²ˆν˜Έ

[3] OpenNMS μ΄ˆκΈ°ν™” 및 μ„œλΉ„μŠ€ μ‹œμž‘
– Java μ„€μΉ˜ 경둜 지정
${OPENNMS_HOME}/bin/runjava -s

– DB 및 OpenNMS μ΄ˆκΈ°ν™”
${OPENNMS_HOME}/bin/install -dis

-OpenNMS λΆ€νŒ… μ‹œ μ„œλΉ„μŠ€ μ‹œμž‘ μ„€μ • 및 μ§€κΈˆ μ‹œμž‘
systemctl enable opennms
systemctl start opennms

[4] OpenNMS νŽ˜μ΄μ§€ 접속
– http://10.10.10.200:8980/opennms 둜 접속
– ID: admin / PW: admin