<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: iptables question in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784108#M23248</link>
    <description>You can do that.&lt;BR /&gt;&lt;BR /&gt;  First of all, as it has already been pointed out, you must make sure the ip_conntrack_ftp module is loaded. &lt;BR /&gt;  Second, you need in the firewall a rule similar to&lt;BR /&gt;iptables -A FORWARD -p tcp -m state --state ESTABLISHED,RELATED,NEW -j ACCEPT.&lt;BR /&gt;This rule would trigger on the data channel (ftp uses two channels, a command channel on port 21 and a data channel which can either be on port 20 or a dynamically negociated high port, depending on the type - active or passive - of the ftp connection)&lt;BR /&gt;  You will also need the following rule:&lt;BR /&gt; iptables -A PREROUTING -t nat -d x.x.x.120 --dport 21 -j DNAT --to IP_of_real_server&lt;BR /&gt;&lt;BR /&gt;  You also must make sure that &lt;BR /&gt;- the routing part is 100% OK. That is, packets sent via the NIC do go to the real server, via the firewall. Yes, you can do that with only one NIC but please read the security comment from the end of my reply&lt;BR /&gt;- the second firewall will allow this packets to pass thru&lt;BR /&gt;- the replies from the real server will not go directly to the clients which started the ftp session, but via the x.x.x.120 linux box. The reason is that a) the clients expect replies to come from the server they have sent the request to (that is x.x.x.120). Packets coming from any other IP will be discarded by the clients and b) the connection tracking module of the linux box will take care of modifying the source IP in the reply packets, so as to make the clients believe they are talking only with the linux box.&lt;BR /&gt;&lt;BR /&gt;Security comment: since you are using the external/public interface for packets going to an internal server, you actually make public part of your internal traffic. This is something you definitely should NOT do. From a security point of view, correct approaches are&lt;BR /&gt;- either add a second NIC and connect that one to the second firewall or&lt;BR /&gt;- create a tunnel between the servers and encrypt all communication between them.</description>
    <pubDate>Mon, 08 May 2006 18:43:37 GMT</pubDate>
    <dc:creator>Manuel Wolfshant</dc:creator>
    <dc:date>2006-05-08T18:43:37Z</dc:date>
    <item>
      <title>iptables question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784103#M23243</link>
      <description>Hi all&lt;BR /&gt;I've a linux box with only one NIC.&lt;BR /&gt;Say that linu box public IP is x.x.x.120.&lt;BR /&gt;&lt;BR /&gt;Now i need to forward the ftp traffic to the public IP to an internal IP of another server.&lt;BR /&gt;&lt;BR /&gt;The linux box is not connected directly to the LAN of the internal server, but with another firewall.&lt;BR /&gt;&lt;BR /&gt;Is possible to NAT to the internal server without direct connection to the internal LAN??&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 08 May 2006 05:19:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784103#M23243</guid>
      <dc:creator>Marco_113</dc:creator>
      <dc:date>2006-05-08T05:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: iptables question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784104#M23244</link>
      <description>It all depends on the other server. I assume the other server also has a "public" IP so you should be able to forward to that IP. You can then  do (D)NAT on that server to the box inside the LAN. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 May 2006 06:49:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784104#M23244</guid>
      <dc:creator>Marius Pana_1</dc:creator>
      <dc:date>2006-05-08T06:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: iptables question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784105#M23245</link>
      <description>No the server ftp is on an internal network.&lt;BR /&gt;The linux box is connected to the internal LAN with a firewall.&lt;BR /&gt;&lt;BR /&gt;The problem is that i cannot route on the same nic!!&lt;BR /&gt;&lt;BR /&gt;Does anyone know if ther's a software (squid like) to configure ftp reverse proxy??&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 May 2006 08:14:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784105#M23245</guid>
      <dc:creator>Marco_113</dc:creator>
      <dc:date>2006-05-08T08:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: iptables question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784106#M23246</link>
      <description>Probably, you can do this with an IP tunnel. There are different options to do this, including openvpn and ssh tunnel. The tunnel should cross the firewall connection, and maybe this is not desirable. Ftp is a multiport protocol and this is the major problem.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 May 2006 08:38:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784106#M23246</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-05-08T08:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: iptables question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784107#M23247</link>
      <description>There is an FTP helper module for connection&lt;BR /&gt;tracking.  Routeback out the same interface&lt;BR /&gt;is possbile but needs to enabled. &lt;BR /&gt;&lt;BR /&gt;Look at the documentation for shorewall. &lt;BR /&gt;It may contain an example close enough&lt;BR /&gt;to what you want to do, although it &lt;BR /&gt;is complicated by the additional firewall.&lt;BR /&gt;&lt;BR /&gt;You may be better to mirror the FTP content&lt;BR /&gt;on the frontend server. This can be done &lt;BR /&gt;with rsync over ssh.&lt;BR /&gt;</description>
      <pubDate>Mon, 08 May 2006 12:35:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784107#M23247</guid>
      <dc:creator>Bill Thorsteinson</dc:creator>
      <dc:date>2006-05-08T12:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: iptables question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784108#M23248</link>
      <description>You can do that.&lt;BR /&gt;&lt;BR /&gt;  First of all, as it has already been pointed out, you must make sure the ip_conntrack_ftp module is loaded. &lt;BR /&gt;  Second, you need in the firewall a rule similar to&lt;BR /&gt;iptables -A FORWARD -p tcp -m state --state ESTABLISHED,RELATED,NEW -j ACCEPT.&lt;BR /&gt;This rule would trigger on the data channel (ftp uses two channels, a command channel on port 21 and a data channel which can either be on port 20 or a dynamically negociated high port, depending on the type - active or passive - of the ftp connection)&lt;BR /&gt;  You will also need the following rule:&lt;BR /&gt; iptables -A PREROUTING -t nat -d x.x.x.120 --dport 21 -j DNAT --to IP_of_real_server&lt;BR /&gt;&lt;BR /&gt;  You also must make sure that &lt;BR /&gt;- the routing part is 100% OK. That is, packets sent via the NIC do go to the real server, via the firewall. Yes, you can do that with only one NIC but please read the security comment from the end of my reply&lt;BR /&gt;- the second firewall will allow this packets to pass thru&lt;BR /&gt;- the replies from the real server will not go directly to the clients which started the ftp session, but via the x.x.x.120 linux box. The reason is that a) the clients expect replies to come from the server they have sent the request to (that is x.x.x.120). Packets coming from any other IP will be discarded by the clients and b) the connection tracking module of the linux box will take care of modifying the source IP in the reply packets, so as to make the clients believe they are talking only with the linux box.&lt;BR /&gt;&lt;BR /&gt;Security comment: since you are using the external/public interface for packets going to an internal server, you actually make public part of your internal traffic. This is something you definitely should NOT do. From a security point of view, correct approaches are&lt;BR /&gt;- either add a second NIC and connect that one to the second firewall or&lt;BR /&gt;- create a tunnel between the servers and encrypt all communication between them.</description>
      <pubDate>Mon, 08 May 2006 18:43:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/iptables-question/m-p/3784108#M23248</guid>
      <dc:creator>Manuel Wolfshant</dc:creator>
      <dc:date>2006-05-08T18:43:37Z</dc:date>
    </item>
  </channel>
</rss>

