简体   繁体   English

NAT,Debian,iptables

[英]NAT, Debian, iptables

I'm not sure how to phrase this exactly, which is why I'm posting a question because maybe that will help me to phrase the question properly, but basically I have a machine (machine c) visible to machine b through a private network. 我不确定如何准确地说出这个,这就是为什么我发布一个问题,因为这可能会帮我正确地说出问题,但基本上我有机器(机器c)通过专用网络可见机器b 。 Machine c has no connection to any other network, but machine b does. 机器c没有连接到任何其他网络,但机器b没有。 Machine b has a connection to machine a and machine c. 机器b与机器a和机器c连接。 How would I go about exposing the connection from machine c to the outside world (machine a), if I only have access to machine b? 如果我只能访问机器b,我将如何将连接从机器c暴露到外部世界(机器a)? Basically, I started at machine a, and I have full access to machine b, but my networking understanding is too amateur to figure out if I need iptables or something else to do what I'm looking for. 基本上,我从机器a开始,我可以完全访问机器b,但我的网络理解太业余,无法弄清楚我是否需​​要iptables或其他东西来做我正在寻找的东西。 Thanks! 谢谢!

A <==> B <==> C

With the vague information you provided, it seems like you would forward traffic via the interface which connects C to B and then to A. There are various tools you can use for this, iptables is certainly one and ip route is another which I've used for some quick tests. 根据您提供的模糊信息,您似乎可以通过连接C到B然后再连接到A的接口转发流量。有各种工具可以用于此, iptables肯定是一个而ip route是我的另一个用于一些快速测试。 Here's a link about ip route that should give you enough examples to get your self into a better situation. 这是一个关于ip route的链接,它应该给你足够的例子让你的自己处于更好的状态。

Another way would be to use a SSH tunnel from C to A if you're trying to connect to something specific. 另一种方法是使用从C到A的SSH隧道,如果您尝试连接到特定的东西。 So you could do something like the following on C: 所以你可以在C上做类似的事情:

ssh -L localhost:9000:machineA:9000 user@machineB

Links 链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM