31 lines
1.3 KiB
Bash
Executable File
31 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
WSL_IP="$(hostname -I | awk '{print $1}')"
|
|
WSL_HOST_IP="$(awk '/nameserver/ {print $2; exit}' /etc/resolv.conf)"
|
|
WINDOWS_IPS="$(
|
|
powershell.exe -NoProfile -Command "(Get-NetIPAddress -AddressFamily IPv4 | Where-Object { \$_.IPAddress -notlike '127.*' -and \$_.IPAddress -notlike '169.254*' -and \$_.InterfaceAlias -notlike '*WSL*' } | Select-Object -ExpandProperty IPAddress) -join ','" \
|
|
2>/dev/null | tr -d '\r'
|
|
)"
|
|
|
|
cat <<EOF
|
|
WSL 앱 정보
|
|
- WSL 내부 IP: ${WSL_IP}
|
|
- Windows 호스트와 연결된 주소 추정값: ${WSL_HOST_IP}
|
|
- Windows IPv4 후보: ${WINDOWS_IPS:-확인 실패}
|
|
- 포트 배치:
|
|
- hm-biz-process: 8000
|
|
- my-intranet-app: 8010
|
|
- b17301: 8020
|
|
|
|
중요
|
|
- WSL2에서는 다른 PC가 WSL 내부 IP(${WSL_IP})로 직접 접속하지 못하는 경우가 많습니다.
|
|
- 내부망 다른 PC에서는 보통 Windows 호스트 IP:8010 으로 접속해야 합니다.
|
|
- 따라서 Windows 관리자 PowerShell에서 portproxy + 방화벽 규칙을 설정해야 합니다.
|
|
|
|
다음 단계
|
|
1. WSL에서 my-intranet-app 실행: ./scripts/run_server.sh 8010
|
|
2. Windows 관리자 PowerShell 또는 CMD에서 scripts/setup_windows_all_portproxies 실행
|
|
3. 다른 PC 브라우저에서 http://Windows호스트IP:8010 접속
|
|
EOF
|