我有一个openVPN客户端,它运行在windows2008 R2服务器上,通过这个windows 2008,我试图对位于win2008s真实网络后面的机器执行静态nat操作。这是我对2008年服务器的配置;
2008年服务器上NAT配置的输出
# ----------------------------------
# NAT configuration
# ----------------------------------
pushd routing ip nat
uninstall
install
set global tcptimeoutmins=1440 udptimeoutmins=1 loglevel=ERROR
#
#NAT Configuration For Interface Local Area Connection 2
#
add interface name="Local Area Connection 2" mode=FULL
add addressrange name="Local Area Connection 2" start=10.9.0.24 end=10.9.0.31 mask=255.255.255.248
add addressmapping name="Local Area Connection 2" public=10.9.0.28 private=192.168.10.59 inboundsessions=enable
#
#NAT Configuration For Interface Local Area Connection
#
add interface name="Local Area Connection" mode=PRIVATE
popd当我尝试从openvpn服务器平10.9.0.28或连接到其上的tcp端口时,我看到目的地nat在windows 2008服务器上完成,我的数据包被发送到10.9.0.28,但源ip为10.9.0.1。
19:54:25.046131 IP 10.9.0.1.43109 > 192.168.10.59.2000: Flags [S], seq 870055875, win 5840, options [mss 1350,sackOK,TS val 8948005 ecr 0,nop,wscale 7], length 0
19:54:25.046198 IP 192.168.10.59.2000 > 10.9.0.1.43109: Flags [R.], seq 0, ack 870055876, win 0, length 0
19:54:28.044561 IP 10.9.0.1.43109 > 192.168.10.59.2000: Flags [S], seq 870055875, win 5840, options [mss 1350,sackOK,TS val 8951005 ecr 0,nop,wscale 7], length 0当然,返回数据包的方式没有找到发端者,我也试图不直接映射主机,而是服务/端口转换,但这也不起作用。当然,在我的linux机箱中,我可以在使用iptables时更改源IP地址,但是在相同的情况下,我无法在windows上找到如何做到这一点。
那么,您知道如何在windows服务器进行NAT时更改源ip吗?
谢谢你提前提供帮助
高克坦
发布于 2017-08-25 19:59:39
您可以使用netsh这样做:
netsh routing ip nat install
netsh routing ip nat add interface "Local sth or Ethernet etc" AddressOnly
netsh routing ip nat add addressrange "Local sth or Ethernet etc" start=10.9.0.24 end=10.9.0.31 255.255.255.248
netsh routing ip nat add addressmapping "Local sth or Ethernet etc" public=<what_you_want_the_ip_to_look_like> <what_the_ip_actually_is> inboundsessions=disable最后一种选择是在相反的方向使用相同的地址(或者不像我们这里所做的那样)。这可能会破坏你的互联网连接,如果你不知道你在做什么。
https://serverfault.com/questions/436425
复制相似问题