确定 Web 服务出站 IP 地址
我的企业有一个 .NET Web 服务(不是 WCF)托管在具有四个网络接口的服务器上的 IIS 中。该服务调用由第三方托管的外部 Web 服务。
为了在内部和第三方正确配置防火墙,我们需要知道 Web 服务正在向服务器上的哪些可用 IP 地址发出请求。
.NET 有没有办法提取这些信息?对于非编程方法,我在 ServerFault 上问同样的问题会更好吗?
My business has a .NET web service (not WCF) hosted in IIS on a server which has four network interfaces. The service makes calls to an external web service, hosted by a third party.
In order to configure firewalls correctly internally and at the third party, we need to know which of the available IP addresses on the server the web service is making requests on.
Is there a way in .NET to extract this information? Would I be better asking the same question on ServerFault for a non-programming approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正常情况下,服务器的出站IP与接收请求的IP相同。
IIS 除了在同一接口上应答请求之外什么也不做。
如果您想确定的话,我认为简单地检查您的防火墙日志然后开始围绕它进行编码以找出答案可能会更容易。
每个物有所值的防火墙都有日志记录,可以轻松地告诉您从哪里到哪里的流量。
In normal cases, the outbound IP of the server will be the same as the one receiving the request.
IIS does nothing more then answering the request on the same interface.
If you want to be sure, i think it might be easier indeed to simple check your firewall logs then to start coding stuff around it to find out.
Every firewall that is half worth it's money has logging which can easily tell you what traffic is going from where to where.
也许可以通过编程方式从路由器获取信息,但这并不是一件小事...只需向诸如whatismyip.com之类的站点发送请求,然后查看它告诉您它从哪个IP地址获取请求。
我不知道多个网络接口如何影响流量。当然,最安全的方法是第三方可以提供一个返回请求来源的 IP 地址的页面,这样您就知道您正在以与 Web 服务请求完全相同的方式发送请求。
It might be possible to get the information from the router programmatically, but that would not be trivial... Just send a request to a site like whatismyip.com, and see what IP address it is telling you that it gets the request from.
I don't know how the multiple network insterfaces affect the traffic. The safest would of course be if the third party could just put up a page that returns the IP adress that the request comes from, so that you know that you are sending the request in the exact same way as the web service request.