Server Protocol

Ben Lee·2022년 1월 12일
0

SCADA

목록 보기
2/4
post-thumbnail

SFTP protocol

원격지 PLC와 server의 데이터 통신을 위해 우선 server의 프로토콜을 구성해야 한다. 과거 Talnet이라는 프로토콜을 주로 사용하였지만 보안 등 여러 문제점으로 인하여 ping 송/수신 확인용도 이외는 거의 사용되지 않는 추세이다. 현재는 FTP 프로토콜의 보안을 강화한 SFTP 통신이 주로 사용되고 있다.

Server Configuration(feat. OpenSSH)

server에서 SFTP 프로토콜을 활용하기 위해 우선 SSH 통신 기능을 설정해야 한다. SSH용 통신을 위한 여러 소프트웨어가 존재하고 있으며, 그 중 Microsoft에서 제공하는 OpenSSH를 사용하고자 한다. 관련한 자세한 정보는 공식문서에서 확인할 수 있다.
WinSCP에서 제공하는 OpenSSH 공식문서를 사용할 시 에러 발생
Windows 10 이상에서는 추가 기능을 사용한 OpenSSH 설치가 가능하지만, 이하 버젼에서는 PowerShell로 설치해야 한다.

  • Server-side에서 PowerShell 관리자 모드 실행
//Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
  • OpenSSH 서버 실행 및 구성
// Start the sshd service
Start-Service sshd

//OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'

// Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
    Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
    New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
    Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}

Port Fowarding

당연하겠지만, 공유기를 사용한 환경에서 server가 구성되어 있다면 포트 포워딩을 통해 client와 통신할 포트를 지정해야 한다. iptime 기준 포트 포워딩 설정 진입은 다음과 같다.
1. 192.168.0.1
2. 로그인
3. 관리도구
4. 고급설정
5. NAT/라우터 관리
6. 포트포워드 설정

  • 규칙 이름: ex)OpenSSH
  • 내부 IP 주소: server 내부 IP
  • 외부 포트: 사용자 지정 ex)3333
  • 내부 포트: 22 (ssh 용 default port)
profile
개발자가 되고픈 엔지니어

0개의 댓글