XLX YSF

2021-03-10 YSF : Reflector 만들기

DS5QDR Heonmin Lee in Korea 2021. 3. 10. 20:34

YSF Reflector 만들기를 해보았습니다

인터넷에서 구글링을 하여 여러 분들이 올린 글들을 참고하였습니다

 

주요 참고한 사이트는 아래와 같습니다

- register.ysfreflector.de/installation

- ks0lnk.net/?page_id=2968

- egloos.zum.com/sojubox/v/3563578

- m.cafe.daum.net/d-star/dFCs/43

 

준비물 

- RaspberryPi 3B 

- 16G Micro SD Card

- os : Raspberry Pi OS Lite
www.raspberrypi.org/software/operating-systems/#raspberry-pi-os-32-bit

 

 

1단계] YSFReflector 설치

1-1. 기본 설치 준비

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install git -y

 

자동 설치는 아래 install.sh 실행

sudo nano install.sh

sudo chmod +x install.sh

sudo ./install.sh

install.sh
0.00MB

 

tail -F /var/log/YSFReflector/YSFReflector-20121-03-15.log

sudo /etc/init.d/YSFReflector.sh start

 

아래 내용은 HL5DRY OM님께서 도움을 주셨습니다

시작시 YSFReflector.sh start

sudo nano /etc/rc.local

if [ "$_IP" ]; then

  printf "My IP address is %s\n" "$_IP"

fi

/etc/init.d/YSFReflector.sh start    <--- 추가

exit 0

 

매 3시간 30분 마다 reload 실시

crontab -e

30 */3 * * *  /etc/init.d/YSFReflector.sh reload     <--- 추가

 

 

 

 

아래는 수동 설정 입니다

 

1-2. YSF Client  가져오기 및 설정

- YSFClients 가져오기

git clone https://github.com/g4klx/YSFClients.git YSFClients

cd ./YSFClients/YSFReflector

sudo make clean all

- YSFCReflector.ini 설정

[General]
Daemon=1                            # 반드시 1 로 세팅하세여
[Info]
Name=KR ysf-gimhae             # 자신의 고유 이름 입니다 Reflector 등록 시 같은 이름으로 설정해야 합니다
Description=KR-YSF-DS5QDR    # 자신의 Reflector 설명, 글자수 제한 지켜주세요 (14자 이내)
[Log]
DisplayLevel=2
FileLevel=2
FilePath=/var/log/YSFReflector  # Log 파일 저장 위치 지정
FileRoot=YSFReflector              # Log 파일 명 지정
FileRotate=1
[Network]
Port=42005                             # 기본값은 42000 인데 DVSwitch 서버가 42000을 사용하기에 다른 번호로 지정
Debug=0
[Block List]
File=BlockList.txt
Time=5

 

 

1-3. mmdvm 사용자 구룹 추가

sudo groupadd mmdvm
sudo useradd mmdvm -g mmdvm -s /sbin/nologin

 

 

1-4. 설정 파일 실행 디렉토리로 복사

sudo mkdir -p /opt/YSFReflector
sudo mkdir -p /var/log/YSFReflector
sudo cp /home/pi/YSFClients/YSFReflector/YSFReflector     /opt/YSFReflector/
sudo cp /home/pi/YSFClients/YSFReflector/YSFReflector.ini /etc/

 

 

1-5. start-up script 작성

sudo nano /etc/init.d/YSFReflector

- 아래 내용 복사하고 저장

#!/bin/bash
### BEGIN INIT INFO
#
# Provides:             YSFReflector
# Required-Start:       $all
# Required-Stop:        
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Example startscript YSFReflector

#
### END INIT INFO
## Fill in name of program here.
PROG="YSFReflector"
PROG_PATH="/opt/YSFReflector/"
PROG_ARGS="/etc/YSFReflector.ini"
PIDFILE="/var/run/YSFReflector.pid"
USER="root"

start() {
      if [ -e $PIDFILE ]; then
          ## Program is running, exit with error.
          echo "Error! $PROG is currently running!" 1>&2
          exit 1
      else
          cd $PROG_PATH
          ./$PROG $PROG_ARGS
          echo "$PROG started"
          touch $PIDFILE
      fi
}

stop() {
      if [ -e $PIDFILE ]; then
          ## Program is running, so stop it
         echo "$PROG is running"
         rm -f $PIDFILE
         killall $PROG
         echo "$PROG stopped"
      else
          ## Program is not running, exit with error.
          echo "Error! $PROG not started!" 1>&2
          exit 1
      fi
}

## Check to see if we are running as root first.
## Found at
## http://www.cyberciti.biz/tips/shell-root-user-check-script.html
if [ "$(id -u)" != "0" ]; then
      echo "This script must be run as root" 1>&2
      exit 1
fi

case "$1" in
      start)
          start
          exit 0
      ;;
      stop)
          stop
          exit 0
      ;;
      reload|restart|force-reload)
          stop
          sleep 5
          start
          exit 0
      ;;
      **)
          echo "Usage: $0 {start|stop|reload}" 1>&2
          exit 1
      ;;
esac
exit 0
### END

 

 

1-6. start-up script 실행 및 작동 확인

cd /etc/init.d/

sudo chmod +x YSFReflector

sudo apt-get install sysv-rc-conf -y

sudo sysv-rc-conf YSFReflector on

sudo sysv-rc-conf --list YSFReflector

pi@raspberrypi:~ $ sudo sysv-rc-conf --list YSFReflector
YSFReflector 2:on       3:on    4:on    5:on

 

sudo nano ysfping.sh

#!/bin/bash
echo -n "YSFGATEWAY" | nc -u $1 $2 -w 2 && echo
echo -n "YSFS" | nc -u $1 $2 -w 2 && echo

 

pi@raspberrypi:~ $ ./ysfping.sh ysf-ds5qdr.duckdns.org 42000
YSFS62432KR ysf-gimhae   KR-YSF-DS5QDR 000

 

잘 작동하는지 Log 확인

tail -F /var/log/YSFReflector/YSFReflector-2021-03-18.log

I: 2021-03-18 02:47:19.420 Opening YSF network connection
I: 2021-03-18 02:47:19.421 Opening UDP port on 42005
I: 2021-03-18 02:47:19.421 Opening UDP port on 42005
M: 2021-03-18 02:47:19.421 Starting YSFReflector-20210215
M: 2021-03-18 02:47:23.002 Adding DS5QDR     (164.51.173.126:32780)
M: 2021-03-18 02:49:19.456 Currently linked repeaters/gateways:
M: 2021-03-18 02:49:19.456     DS5QDR    : 120.212.13.1:32780 1/60
M: 2021-03-18 02:50:02.789 Adding DS5QDR     (164.51.173.126:4260)
M: 2021-03-18 02:50:04.279 Received data from DS5QDR     to ALL        at DS5QDR
M: 2021-03-18 02:50:07.395 Received end of transmission
M: 2021-03-18 02:50:37.320 Received data from DS5QDR     to ALL        at DS5QDR
M: 2021-03-18 02:50:42.366 Network watchdog has expired
M: 2021-03-18 02:51:19.503 Currently linked repeaters/gateways:
M: 2021-03-18 02:51:19.503     DS5QDR    : 120.212.13.1:32780 1/60
M: 2021-03-18 02:51:19.504     DS5QDR    : 40.213.13.1:4260 1/60
M: 2021-03-18 02:51:51.022 Removing DS5QDR     (164.51.173.126:4260) unlinked
M: 2021-03-18 02:53:19.540 Currently linked repeaters/gateways:
M: 2021-03-18 02:53:19.541     DS5QDR    : 120.212.13.1:32780 1/60
M: 2021-03-18 02:55:19.586 Currently linked repeaters/gateways:
M: 2021-03-18 02:55:19.586     DS5QDR    : 120.212.13.1:32780 1/60
M: 2021-03-18 02:57:19.635 Currently linked repeaters/gateways:
M: 2021-03-18 02:57:19.635     DS5QDR    : 120.212.13.1:32780 1/60
M: 2021-03-18 02:59:19.671 Currently linked repeaters/gateways:
M: 2021-03-18 02:59:19.671     DS5QDR    : 120.212.13.1:32780 1/60

 

 

 

 

2단계] YSFReflector-DashBoard 설치


2-1. 기본 설치 준비

sudo apt-get install apache2 -y

sudo groupadd www-data

sudo usermod -G www-data -a

sudo chown -R www-data:www-data /var/www/html

sudo chmod -R 775 /var/www/html

sudo apt-get install php-common php-cgi php -y

 

 

2-2. YSFReflector-Dashboard 가져오기 및 복사

git clone https://github.com/dg9vh/YSFReflector-Dashboard.git YSFReflector-Dashboard

sudo cp /home/pi/YSFReflector-Dashboard/* /var/www/html/ -r
sudo mkdir -p /var/www/html/config

 

 

2-3. 웹 브라운즈 (크롬 등) 에서 Setup 실행 및 파일 삭제

 

sudo apt install php libapache2-mod-php -y

웹브라운즈 url 창에 자신의 YSF Reflector IP주소/setup.php 하고 설정 후 저장하면 됩니다

http://192.168.0.17/setup.php

 

2-4. 해킹 방지를 위해 setup.php index.php 파일 삭제

sudo mv /var/www/html/setup.php /var/www/html/save-setup.php

sudo mv /var/www/html/index.html /var/www/html/save-index.html

 

 

 

 

3단계] 오래된 Log 삭제 crontab 등록 

 

3-1. 오래된 Log 삭제 프로그램 작성

cd /home/pi/

sudo nano remove_old_log.sh

#!/bin/sh
find /var/log/YSFReflector -name 'YSFReflector-*' -mtime +5 | sudo xargs rm -f

sudo chmod +x remove_old_log.sh

 

3-2. crontab 등록

crontab -e 등록

0 5 * * * /home/pi/remove_old_log.sh

 

 

4단계] YSF Reflector 등록

 

register.ysfreflector.de/register

 

아래 내용은 위에서 YSFReflector.ini 파일에서 설정한 값을 같이 입력하세요

- Host/IP-Address : 자신의 DNS 주소를 입력 (예 : ysf-ds5qdr.duckdns.org)

- Port : YSFReflector.ini 에 설정한 값 입력 (예 : 42005)

- DashBoard-URL : http://ysf-ds5qdr.duckdns.org/index.php

등을 입력하고 Submit 클릭

 

5단계] Dash Board 확인 및 포트포워드 설정

http://192.168.0.17

 

모든 설정이 마쳤으면 자신의 공유기에  포트포워드 설정하시기 바랍니다

YSFReflector IP주소, UDP 42005, TCP 80 포트 개방하셔야 외부에서 접속이 가능합니다

 

 

 

감사합니다

 

 

DS5QDR 73!