OpenVPN and Clients and Windows: Difference between revisions

wiki.TerraBase.info
Jump to navigation Jump to search
Created page with "Nothing ever works like one wants it to. Take for instance a client connecting into an OpenVPN server. Communication back to the client? Nah! Who needs that. In the case of Windows, it isn't OpenVPN's fault. If you can't ping from a VPN Server to a Windows Client, try this script on Windows;<syntaxhighlight lang="text">pktmon stop 2>$null pktmon filter remove pktmon filter add "Physical-IP-Ping" -t ICMP -i 192.168.2.51 pktmon filter add "VPN-IP-Ping" -t ICMP -i 17..."
 
mNo edit summary
 
Line 30: Line 30:
-WeakHostSend Disabled  
-WeakHostSend Disabled  
</syntaxhighlight>
</syntaxhighlight>
=== More Commands That Work (Experimental) ===
powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias <nowiki>''</nowiki>LAN_NIC<nowiki>''</nowiki> -AddressFamily IPv4 -WeakHostReceive Disabled -WeakHostSend Disabled`"'"
powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias <nowiki>''</nowiki>OpenVPN_NIC<nowiki>''</nowiki> -AddressFamily IPv4 -WeakHostReceive Disabled -WeakHostSend Disabled`"'"
powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias <nowiki>''</nowiki>LAN_NIC<nowiki>''</nowiki> -AddressFamily IPv4 -WeakHostReceive Enable -WeakHostSend Enable`"'"
powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias <nowiki>''</nowiki>OpenVPN_NIC<nowiki>''</nowiki> -AddressFamily IPv4 -WeakHostReceive Enable -WeakHostSend Enable`"'"
powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias <nowiki>''</nowiki>LAN_NIC<nowiki>''</nowiki>,<nowiki>''</nowiki>OpenVPN_NIC<nowiki>''</nowiki> -AddressFamily IPv4 -WeakHostReceive Disabled -WeakHostSend Disabled`"'"
powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias <nowiki>''</nowiki>LAN_NIC<nowiki>''</nowiki>,<nowiki>''</nowiki>OpenVPN_NIC<nowiki>''</nowiki> -AddressFamily IPv4 -WeakHostReceive Enabled -WeakHostSend Enabled`"'"
Set-NetIPInterface -InterfaceA 'LAN_NIC','OpenVPN_NIC' -Add IPv4 -WeakHostR Disabled -WeakHostS Disabled
Set-NetIPInterface -InterfaceA 'LAN_NIC','OpenVPN_NIC' -Add IPv4 -WeakHostR Enabled -WeakHostS Enabled
powershell.exe -NoP -C "Start-Process powershell.exe -Verb RunAs -Wai -A '-NoP -C `"Set-NetIPInterface -InterfaceA <nowiki>''</nowiki>LAN_NIC<nowiki>''</nowiki>,<nowiki>''</nowiki>OpenVPN_NIC<nowiki>''</nowiki> -Add IPv4 -WeakHostR Enabled -WeakHostS Enabled`"'"
powershell.exe -NoP -C "Start-Process powershell.exe -Verb RunAs -Wai -A '-NoP -C `"Set-NetIPInterface -InterfaceA <nowiki>''</nowiki>LAN_NIC<nowiki>''</nowiki>,<nowiki>''</nowiki>OpenVPN_NIC<nowiki>''</nowiki> -Add IPv4 -WeakHostR Disabled -WeakHostS Disabled`"'"

Latest revision as of 20:42, 27 July 2026

Nothing ever works like one wants it to. Take for instance a client connecting into an OpenVPN server. Communication back to the client? Nah! Who needs that. In the case of Windows, it isn't OpenVPN's fault.

If you can't ping from a VPN Server to a Windows Client, try this script on Windows;

pktmon stop 2>$null
pktmon filter remove

pktmon filter add "Physical-IP-Ping" -t ICMP -i 192.168.2.51
pktmon filter add "VPN-IP-Ping" -t ICMP -i 172.16.20.100

pktmon start --capture --comp all --pkt-size 0 --log-mode real-time

See? OpenVPN is trying. But alas, Windows just isn't responding.

09:09:02.687395600 PktGroupId 1407374883553307, PktNumber 1, Appearance 1, Direction Rx , Type IP , Component 247, Edge 1, Filter 1, OriginalSize 84, LoggedSize 84
        ip: SourceIP > DestinationIP: ICMP echo request, id 3491, seq 9, length 64
09:09:02.687411300 PktGroupId 1407374883553307, PktNumber 1, Appearance 2, Direction Rx , Type IP , Component 248, Edge 1, Filter 1, OriginalSize 84, LoggedSize 84
        ip: SourceIP  > DestinationIP: ICMP echo request, id 3491, seq 9, length 64
09:09:03.685967700 PktGroupId 1407374883553308, PktNumber 1, Appearance 1, Direction Rx , Type IP , Component 247, Edge 1, Filter 1, OriginalSize 84, LoggedSize 84
        ip: SourceIP  > DestinationIP: ICMP echo request, id 3491, seq 10, length 64

Change the setting needed for it to reply;

Set-NetIPInterface `
-InterfaceAlias "WhatEverAdapterName" `
-AddressFamily IPv4 `
-WeakHostReceive Enabled `
-WeakHostSend Enabled

Check on the status;

Get-NetIPInterface `
-InterfaceAlias "WhatEverAdapterName" `
-AddressFamily IPv4 |
Format-Table InterfaceAlias,InterfaceIndex,WeakHostReceive,WeakHostSend

OK, put it back the way it was, if desired;

Set-NetIPInterface `
-InterfaceAlias "WhatEverAdapterName" `
-AddressFamily IPv4 `
-WeakHostReceive Disabled `
-WeakHostSend Disabled

More Commands That Work (Experimental)

powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias ''LAN_NIC'' -AddressFamily IPv4 -WeakHostReceive Disabled -WeakHostSend Disabled`"'"

powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias ''OpenVPN_NIC'' -AddressFamily IPv4 -WeakHostReceive Disabled -WeakHostSend Disabled`"'"

powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias ''LAN_NIC'' -AddressFamily IPv4 -WeakHostReceive Enable -WeakHostSend Enable`"'"

powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias ''OpenVPN_NIC'' -AddressFamily IPv4 -WeakHostReceive Enable -WeakHostSend Enable`"'"

powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias ''LAN_NIC'',''OpenVPN_NIC'' -AddressFamily IPv4 -WeakHostReceive Disabled -WeakHostSend Disabled`"'"

powershell.exe -NoProfile -Command "Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile -Command `"Set-NetIPInterface -InterfaceAlias ''LAN_NIC'',''OpenVPN_NIC'' -AddressFamily IPv4 -WeakHostReceive Enabled -WeakHostSend Enabled`"'"

Set-NetIPInterface -InterfaceA 'LAN_NIC','OpenVPN_NIC' -Add IPv4 -WeakHostR Disabled -WeakHostS Disabled

Set-NetIPInterface -InterfaceA 'LAN_NIC','OpenVPN_NIC' -Add IPv4 -WeakHostR Enabled -WeakHostS Enabled

powershell.exe -NoP -C "Start-Process powershell.exe -Verb RunAs -Wai -A '-NoP -C `"Set-NetIPInterface -InterfaceA ''LAN_NIC'',''OpenVPN_NIC'' -Add IPv4 -WeakHostR Enabled -WeakHostS Enabled`"'"

powershell.exe -NoP -C "Start-Process powershell.exe -Verb RunAs -Wai -A '-NoP -C `"Set-NetIPInterface -InterfaceA ''LAN_NIC'',''OpenVPN_NIC'' -Add IPv4 -WeakHostR Disabled -WeakHostS Disabled`"'"