<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Linux Forum &mdash; iptables nat + 2 VPN сервера]]></title>
		<link>https://linuxforum.ru/viewtopic.php?id=10225</link>
		<atom:link href="https://linuxforum.ru/extern.php?action=feed&amp;tid=10225&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «iptables nat + 2 VPN сервера».]]></description>
		<lastBuildDate>Sun, 23 Jan 2011 11:31:15 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135391#p135391</link>
			<description><![CDATA[<p>пока не увижу правила на vpn2 не что сказать не могу.</p>]]></description>
			<author><![CDATA[null@example.com (Kettler)]]></author>
			<pubDate>Sun, 23 Jan 2011 11:31:15 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135391#p135391</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135374#p135374</link>
			<description><![CDATA[<p><strong>Kettler</strong>, не, не взлетело<br />внешние хосты начали пинговаться с клиента при таком раскладе<br />на 1 VPN</p><div class="codebox"><pre><code>Chain PREROUTING (policy ACCEPT 473 packets, 28607 bytes)
 pkts bytes target     prot opt in     out     source               destination
   39  2337 DNAT       all  --  *      *       10.8.0.0/24          0.0.0.0/0           to:10.4.0.2

Chain POSTROUTING (policy ACCEPT 107 packets, 6866 bytes)
 pkts bytes target     prot opt in     out     source               destination
  209 12698 SNAT       all  --  *      *       10.8.0.0/24          0.0.0.0/0           to:10.4.0.1

при пинге с клиента:
[root@30001176 ~]# tcpdump -n -t -i tun1
IP 10.4.0.1 &gt; 10.4.0.2: ICMP echo request, id 1024, seq 54528, length 40
IP 10.4.0.2 &gt; 10.4.0.1: ICMP echo reply, id 1024, seq 54528, length 40
IP 10.4.0.1 &gt; 10.4.0.2: ICMP echo request, id 1024, seq 54784, length 40
IP 10.4.0.2 &gt; 10.4.0.1: ICMP echo reply, id 1024, seq 54784, length 40
IP 10.4.0.1 &gt; 10.4.0.2: ICMP echo request, id 1024, seq 55040, length 40</code></pre></div><p>на tun0 ( это клиент&lt;---&gt;VPN 1 ), тоже в нормне</p><p>на 2 VPS сейчас такие правила<br /></p><div class="codebox"><pre><code>Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
DNAT       all  --  10.4.0.0/24          0.0.0.0/0           to:80.67.3.98
DNAT       all  --  0.0.0.0/0            80.67.3.98          to:10.4.0.1

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
SNAT       all  --  10.4.0.0/24          0.0.0.0/0           to:80.67.3.98
SNAT       all  --  80.67.3.98           0.0.0.0/0           to:10.4.0.2</code></pre></div><p>при этом опять-же nslookup через все это не проходит не проходит<br />сейчас попробую за втором tcpdump&#039;ом посмотреть, что происходит</p><p>в общем из 4 правил на 2 VPN срабатывает только <br />DNAT&nbsp; &nbsp; &nbsp; &nbsp;all&nbsp; --&nbsp; 10.4.0.0/24&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;to:80.67.3.98<br />судя по счетчикам <img src="https://linuxforum.ru/img/smilies/ab.gif" alt="ab" /></p>]]></description>
			<author><![CDATA[null@example.com (sergey_)]]></author>
			<pubDate>Sun, 23 Jan 2011 10:47:57 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135374#p135374</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135351#p135351</link>
			<description><![CDATA[<p>))) ну вроде теперь должно всё завестись как показал выше ну если ток у вас не что запретит.</p>]]></description>
			<author><![CDATA[null@example.com (Kettler)]]></author>
			<pubDate>Sun, 23 Jan 2011 09:54:10 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135351#p135351</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135350#p135350</link>
			<description><![CDATA[<p><strong>Kettler</strong>, не уверен что нужно показать)</p><div class="codebox"><pre><code>tun1      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.4.0.2  P-t-P:10.4.0.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:720 (720.0 b)  TX bytes:1312 (1.2 KiB)</code></pre></div><p>из iptables я пока все убрал</p>]]></description>
			<author><![CDATA[null@example.com (sergey_)]]></author>
			<pubDate>Sun, 23 Jan 2011 09:48:41 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135350#p135350</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135348#p135348</link>
			<description><![CDATA[<p>теперь на vpn2 покажи nat<br />на vpn2 надо попробовать добавить<br />iptables -t nat -A PREROUTING -i tun1 -j DNAT --to-destination&nbsp; ВНЕШНИЙ_ИП<br />или<br />iptables -t nat -A PREROUTING -i tun0 -j DNAT --to-destination&nbsp; ВНЕШНИЙ_ИП</p>]]></description>
			<author><![CDATA[null@example.com (Kettler)]]></author>
			<pubDate>Sun, 23 Jan 2011 09:39:37 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135348#p135348</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135315#p135315</link>
			<description><![CDATA[<p>да, с <br /></p><div class="quotebox"><blockquote><p>iptables --table nat --append POSTROUTING --out-interface tun1 -j MASQUERADE<br />iptables --table nat --append POSTROUTING --out-interface tun0 -j MASQUERADE<br />iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu</p></blockquote></div><p>vpn2 пингуется<br />попробовал на него добавить <br />iptables -t nat -A POSTROUTING -s 10.4.0.0/24 -o tun1 -j MASQUERADE<br />внешние хосты пока не пингуются</p><p>кстати<br />[root@30001176 ~]# echo &quot;1&quot; &gt; /proc/sys/net/ipv4/ip_dynaddr<br />bash: /proc/sys/net/ipv4/ip_dynaddr: Operation not permitted</p>]]></description>
			<author><![CDATA[null@example.com (sergey_)]]></author>
			<pubDate>Sun, 23 Jan 2011 08:11:26 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135315#p135315</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135198#p135198</link>
			<description><![CDATA[<p>так завелось или нет?</p>]]></description>
			<author><![CDATA[null@example.com (Kettler)]]></author>
			<pubDate>Sat, 22 Jan 2011 18:08:31 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135198#p135198</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135181#p135181</link>
			<description><![CDATA[<p><strong>Kettler</strong>, ага, спасибо большое, только терь жду когда хостеры модули iptables поправят, часть не разрешены в контейнере<br />venet0 это 2 интнрфейсы с внешними IP и один я для проверки создавал 192.168.10.1</p>]]></description>
			<author><![CDATA[null@example.com (sergey_)]]></author>
			<pubDate>Sat, 22 Jan 2011 16:56:24 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135181#p135181</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135171#p135171</link>
			<description><![CDATA[<p>#!/bin/bash<br />echo &quot;1&quot; &gt; /proc/sys/net/ipv4/ip_forward<br />echo 1 &gt; /proc/sys/net/ipv4/ip_dynaddr<br />modprobe iptable_nat<br />modprobe ip_conntrack_ftp<br />modprobe ip_nat_ftp<br />iptables -F<br />iptables -F -t nat<br />iptables -F -t mangle</p><p>iptables -P INPUT ACCEPT<br />iptables -P OUTPUT ACCEPT<br />iptables -P FORWARD ACCEPT</p><p>#Маскардинг в локалку<br />iptables --table nat --append POSTROUTING --out-interface tun1 -j MASQUERADE<br />iptables --table nat --append POSTROUTING --out-interface tun0 -j MASQUERADE<br />iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu</p><p>Давай начнём с данного скрипта на vpn1. Потом от клиента пинг до vpn 2 будет?<br />Если не заведёться замени на &quot;iptables --table nat --append POSTROUTING --out-interface tun1 -j MASQUERADE&quot;<br />iptables -t nat -A PREROUTING -s 10.8.0.0/24 -j DNAT --to-destination 10.4.0.2<br />И ещё что за интерфейс venet0 ?</p>]]></description>
			<author><![CDATA[null@example.com (Kettler)]]></author>
			<pubDate>Sat, 22 Jan 2011 16:01:19 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135171#p135171</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135167#p135167</link>
			<description><![CDATA[<p><strong>Kettler</strong>, ага</p>]]></description>
			<author><![CDATA[null@example.com (sergey_)]]></author>
			<pubDate>Sat, 22 Jan 2011 15:48:36 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135167#p135167</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135154#p135154</link>
			<description><![CDATA[<p>ок шас разберусь ядром помогу.<br />на точке vpn 2 нат поднят?</p>]]></description>
			<author><![CDATA[null@example.com (Kettler)]]></author>
			<pubDate>Sat, 22 Jan 2011 15:11:56 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135154#p135154</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135108#p135108</link>
			<description><![CDATA[<p><strong>Kettler</strong>, не, трафик приходит из туннеля 10.8.0.1, заворачивается в подсеть второго туннеля 10.4.0.1, и уже со второго сервера в инет, ну и обратный маршрут <img src="https://linuxforum.ru/img/smilies/ab.gif" alt="ab" /></p>]]></description>
			<author><![CDATA[null@example.com (sergey_)]]></author>
			<pubDate>Sat, 22 Jan 2011 13:26:05 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135108#p135108</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135104#p135104</link>
			<description><![CDATA[<p>такс вам надо чтоб 10.10.0.0/24 ходила в 194.10.10.10 ?<br />venet0 - ?</p>]]></description>
			<author><![CDATA[null@example.com (Kettler)]]></author>
			<pubDate>Sat, 22 Jan 2011 13:09:47 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135104#p135104</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135034#p135034</link>
			<description><![CDATA[<p><strong>Kettler</strong>, tun0 - это от клиента до vpn1<br /></p><div class="quotebox"><blockquote><p>tun0&nbsp; &nbsp; &nbsp; Link encap:UNSPEC&nbsp; HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:10.8.0.1&nbsp; P-t-P:10.8.0.2&nbsp; Mask:255.255.255.255<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP POINTOPOINT RUNNING NOARP MULTICAST&nbsp; MTU:1500&nbsp; Metric:1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX packets:39813 errors:0 dropped:0 overruns:0 frame:0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TX packets:26249 errors:0 dropped:0 overruns:0 carrier:0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collisions:0 txqueuelen:100<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX bytes:2379587 (2.2 MiB)&nbsp; TX bytes:2829034 (2.6 MiB)</p><p>tun1&nbsp; &nbsp; &nbsp; Link encap:UNSPEC&nbsp; HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:10.4.0.1&nbsp; P-t-P:10.4.0.2&nbsp; Mask:255.255.255.255<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP POINTOPOINT RUNNING NOARP MULTICAST&nbsp; MTU:1500&nbsp; Metric:1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX packets:570 errors:0 dropped:0 overruns:0 frame:0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TX packets:683 errors:0 dropped:0 overruns:0 carrier:0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collisions:0 txqueuelen:100<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX bytes:37152 (36.2 KiB)&nbsp; TX bytes:39243 (38.3 KiB)</p><br /><p>Destination&nbsp; &nbsp; &nbsp;Gateway&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Genmask&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Flags Metric Ref&nbsp; &nbsp; Use Iface<br />10.8.0.2&nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;255.255.255.255 UH&nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 tun0<br />10.4.0.2&nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;255.255.255.255 UH&nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 tun1<br />10.8.0.0&nbsp; &nbsp; &nbsp; &nbsp; 10.8.0.2&nbsp; &nbsp; &nbsp; &nbsp; 255.255.255.0&nbsp; &nbsp;UG&nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 tun0<br />192.0.2.0&nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;255.255.255.0&nbsp; &nbsp;U&nbsp; &nbsp; &nbsp;0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 venet0<br />169.254.0.0&nbsp; &nbsp; &nbsp;0.0.0.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;255.255.0.0&nbsp; &nbsp; &nbsp;U&nbsp; &nbsp; &nbsp;0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 venet0<br />0.0.0.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;192.0.2.1&nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;UG&nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 venet0</p></blockquote></div><p>PS, там на схемке немного другие IP</p><p>10.0.0.0/24 - это 10.8.0.0/24<br />10.10.0.0/24 - это 10.4.0.0/24</p>]]></description>
			<author><![CDATA[null@example.com (sergey_)]]></author>
			<pubDate>Sat, 22 Jan 2011 09:18:09 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135034#p135034</guid>
		</item>
		<item>
			<title><![CDATA[Re: iptables nat + 2 VPN сервера]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=135003#p135003</link>
			<description><![CDATA[<p>Где vpn1 ifconfig можно и route -n? Ток чтоб все соедининения впн были подняты.</p>]]></description>
			<author><![CDATA[null@example.com (Kettler)]]></author>
			<pubDate>Sat, 22 Jan 2011 07:46:48 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=135003#p135003</guid>
		</item>
	</channel>
</rss>
