From 8bd5bbf36609ef1d555c19749133aa0b2803eed3 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sat, 12 Sep 2026 20:49:29 +0200 Subject: [PATCH] fix: IP del modo VPS via interfaz de la ruta por defecto (#5) Co-authored-by: Hermes Agent --- openwebui/deploy.ps1 | 6 +++++- wordpress/deploy.ps1 | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/openwebui/deploy.ps1 b/openwebui/deploy.ps1 index c552880..f30e00d 100644 --- a/openwebui/deploy.ps1 +++ b/openwebui/deploy.ps1 @@ -96,8 +96,12 @@ if ($Mode -eq 'local') { Write-Host " URL: ${Cyan}http://localhost:${WebUiPort}${NC}" } else { 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 | - 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 if (-not $Ip) { $Ip = 'TU_IP' } Write-Host " URL: ${Cyan}http://${Ip}:${WebUiPort}${NC}" diff --git a/wordpress/deploy.ps1 b/wordpress/deploy.ps1 index 8d7c5cb..5fdc677 100644 --- a/wordpress/deploy.ps1 +++ b/wordpress/deploy.ps1 @@ -131,8 +131,12 @@ if ($Mode -eq 'local') { Write-Host " IA (chat): ${Cyan}http://localhost:${WebUiPort}${NC}" } else { 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 | - 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 if (-not $Ip) { $Ip = 'TU_IP' } Write-Host " WordPress: ${Cyan}http://${Ip}:${WpPort}${NC}"