2024年9月25日 星期三

X Window 安裝 VPN 管理工具

apt-get install network-manager-pptp
apt-get install network-manager-pptp-gnome

LEAF 使用 SNMPD

 安裝 netsnmpd.lrp

編輯 /etc/snmp/snmpd.conf 加入
rocommunity public  192.168.0.0/16
extend hardware "/bin/cat /sys/devices/virtual/dmi/id/product_name"
extend manufacturer "/bin/cat /sys/devices/virtual/dmi/id/sys_vendor"
extend distro "/usr/bin/tail -n 1 /etc/issue"

Proxmox VE8 啟用 SNMP

 apt install libpve-apiclient-perl 

cat >/etc/snmp/cat_serial <<EOF
#!/bin/bash
/bin/cat /sys/devices/virtual/dmi/id/product_serial
EOF

wget https://raw.githubusercontent.com/librenms/librenms-agent/master/agent-local/proxmox -O /etc/snmp/proxmox

wget -O /etc/snmp/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
chmod +x /etc/snmp/distro

chmod a+x /etc/snmp/proxmox /etc/snmp/cat_serial

編輯 /etc/snmp/snmpd.conf
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.$(date +%Y%m%d-%H%M%S)

cat >/etc/snmp/snmpd.conf <<EOF
# Change RANDOMSTRINGGOESHERE to your preferred SNMP community string
com2sec readonly  default         RANDOMSTRINGGOESHERE
group MyROGroup v2c        readonly
view all    included  .1                               80
access MyROGroup ""      any       noauth    exact  all    none   none
syslocation ROOM 110
syscontact email <email@mail>

#OS Distribution Detection
#extend distro /usr/bin/distro
#Hardware Detection

# (uncomment for x86 platforms)
extend manufacturer '/bin/cat /sys/devices/virtual/dmi/id/sys_vendor'
extend hardware '/bin/cat /sys/devices/virtual/dmi/id/product_name'
#extend serial '/bin/cat /sys/devices/virtual/dmi/id/product_serial'

# (uncomment for ARM platforms)
#extend hardware '/bin/cat /sys/firmware/devicetree/base/model'
#extend serial '/bin/cat /sys/firmware/devicetree/base/serial-number'

extend distro /etc/snmp/distro
extend proxmox  "/usr/bin/sudo /etc/snmp/proxmox"
extend serial   "/usr/bin/sudo /etc/snmp/cat_serial"
EOF

編輯 /etc/sudoers  加入
Debian-snmp     ALL=(ALL) NOPASSWD: /etc/snmp/proxmox
Debian-snmp     ALL=(ALL) NOPASSWD: /etc/snmp/cat_serial

Proxmox ve 叢集移除節點

systemctl stop pve-cluster corosync
pmxcfs -l
rm -r /etc/corosync/*
rm /etc/pve/corosync.conf
killall pmxcfs
systemctl start pve-cluster

Neighbour table overflow

查詢狀態
arp -an|wc -l

grep . /proc/sys/net/ipv4/neigh/default/gc_thresh*
/proc/sys/net/ipv4/neigh/default/gc_thresh1:512
/proc/sys/net/ipv4/neigh/default/gc_thresh2:4096
/proc/sys/net/ipv4/neigh/default/gc_thresh3:8192

解决方法:
echo 60   > /proc/sys/net/ipv4/neigh/default/gc_stale_time
echo 512  > /proc/sys/net/ipv4/neigh/default/gc_thresh1
echo 2048 > /proc/sys/net/ipv4/neigh/default/gc_thresh2
echo 4096 > /proc/sys/net/ipv4/neigh/default/gc_thresh3

echo "net.ipv4.neigh.default.gc_thresh1 = 512"  >> /etc/sysctl.conf
echo "net.ipv4.neigh.default.gc_thresh2 = 2048" >> /etc/sysctl.conf
echo "net.ipv4.neigh.default.gc_thresh3 = 4096" >> /etc/sysctl.conf
sysctl -p

2024年9月24日 星期二