fix: IP del modo VPS via interfaz de la ruta por defecto #5

Merged
hermes merged 1 commits from fix/vps-lan-ip into main 2026-09-12 20:49:30 +02:00
2 changed files with 10 additions and 2 deletions

No files matched your search

+5 -1
View File
@@ -96,8 +96,12 @@ if ($Mode -eq 'local') {
Write-Host " URL: ${Cyan}http://localhost:${WebUiPort}${NC}" Write-Host " URL: ${Cyan}http://localhost:${WebUiPort}${NC}"
} else { } else {
Warn 'Modo: VPS (accesible desde fuera)' Warn 'Modo: VPS (accesible desde fuera)'
# IP real de LAN: la de la interfaz con la ruta por defecto (evita vEthernet
# WSL/Hyper-V, Docker, VPN — que son 172.16-31.*, 10.x internos, etc.)
$GwIf = (Get-NetRoute -DestinationPrefix '0.0.0.0/0' -ErrorAction SilentlyContinue |
Sort-Object RouteMetric | Select-Object -First 1).ifIndex
$Ip = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue | $Ip = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue |
Where-Object { $_.IPAddress -notlike '127.*' -and $_.IPAddress -notlike '169.254.*' -and $_.IPAddress -notmatch '^172\.(1[6-9]|2[0-9]|3[01])\.' } | Where-Object { $_.ifIndex -eq $GwIf -and $_.IPAddress -notlike '127.*' } |
Select-Object -First 1).IPAddress Select-Object -First 1).IPAddress
if (-not $Ip) { $Ip = 'TU_IP' } if (-not $Ip) { $Ip = 'TU_IP' }
Write-Host " URL: ${Cyan}http://${Ip}:${WebUiPort}${NC}" Write-Host " URL: ${Cyan}http://${Ip}:${WebUiPort}${NC}"
+5 -1
View File
@@ -131,8 +131,12 @@ if ($Mode -eq 'local') {
Write-Host " IA (chat): ${Cyan}http://localhost:${WebUiPort}${NC}" Write-Host " IA (chat): ${Cyan}http://localhost:${WebUiPort}${NC}"
} else { } else {
Warn 'Modo: VPS (accesible desde fuera)' Warn 'Modo: VPS (accesible desde fuera)'
# IP real de LAN: la de la interfaz con la ruta por defecto (evita
# vEthernet WSL/Hyper-V, Docker, VPN)
$GwIf = (Get-NetRoute -DestinationPrefix '0.0.0.0/0' -ErrorAction SilentlyContinue |
Sort-Object RouteMetric | Select-Object -First 1).ifIndex
$Ip = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue | $Ip = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue |
Where-Object { $_.IPAddress -notlike '127.*' -and $_.IPAddress -notlike '169.254.*' -and $_.IPAddress -notmatch '^172\.(1[6-9]|2[0-9]|3[01])\.' } | Where-Object { $_.ifIndex -eq $GwIf -and $_.IPAddress -notlike '127.*' } |
Select-Object -First 1).IPAddress Select-Object -First 1).IPAddress
if (-not $Ip) { $Ip = 'TU_IP' } if (-not $Ip) { $Ip = 'TU_IP' }
Write-Host " WordPress: ${Cyan}http://${Ip}:${WpPort}${NC}" Write-Host " WordPress: ${Cyan}http://${Ip}:${WpPort}${NC}"