大网数据广告活动
服务器运维问答

OpenVPN - pass only certain ports throught vpn

· 52CE 我爱测

I have OpenVPN server on VPS, I'm working on windows 8.1 and I want pass only certain ports throught VPN (eg. 3000, 3001). Is it possible from windows?

问题原文

原帖链接 · Artur · CC BY-SA 3.0

I have OpenVPN server on VPS, I'm working on windows 8.1 and I want pass only certain ports throught VPN (eg. 3000, 3001). Is it possible from windows?

已采纳解答

原帖链接 · Esa Jokinen · CC BY-SA 3.0

OpenVPN has two modes:

  • TAP (Network Tapping System) that simulates a link layer (OSI layer 2) device. In this mode both ends can be on the same subnet (e.g. 10.0.0.0/24) and information are carried by ethernet frames, creating network bridge.
  • TUN (network TUNnel) that simulates internet layer (OSI network layer, layer 3) device and carries IP packets.

Both modes allows you to either use the VPN for all traffic (default route to 0.0.0.0/0 on the remote side) or just the traffic within the same subnet (TAP) or to all or some subnets on the other end (TUN).

TCP and UDP (where you have the port numbers) works on the transport layer (/OSI layer 4). Therefore it is not a feature neither OpenVPN nor Windows can have but a protocol level limitation on all VPN implementations: It is not possible with (Open)VPN, but it'll be possible to configure at firewall.

You can:

  • If you don't route all traffic through the VPN, you can use different interfaces for different ports, e.g. public http://example.com:80 vs. private 172.16.0.30:3001 for your Nessus client(?)
  • Use SSH tunneling instead of VPN, ssh -L 3001:localhost:3001 [email omitted] (Local Port Forwarding) or PuTTY (Connection > SSH > Tunnels: Source port 3001 & Destination localhost:3001, Local, Auto). This will bind the service to a port on your local machine i.e. you can connect to localhost:3001. (It is also possible to use different source port on local side.)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-04-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。