<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Linux Forum &mdash; NAT CentOS 6.3]]></title>
	<link rel="self" href="https://linuxforum.ru/extern.php?action=feed&amp;tid=24929&amp;type=atom" />
	<updated>2012-11-01T07:43:01Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=24929</id>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=307067#p307067" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>kisil пишет:</cite><blockquote><p>Какой айпи компа с апачем.<br />В линуксе покажыте<br />iptables -S из под root</p></blockquote></div><p>[root@denix selinux]# iptables -S<br />-P INPUT ACCEPT<br />-P FORWARD ACCEPT<br />-P OUTPUT ACCEPT<br />-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT<br />-A INPUT -p icmp -j ACCEPT<br />-A INPUT -i lo -j ACCEPT<br />-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT<br />-A INPUT -j REJECT --reject-with icmp-host-prohibited<br />-A FORWARD -j REJECT --reject-with icmp-host-prohibited</p><p>а так 192.168.100.10<br /> ifconfig<br />eth0&nbsp; &nbsp; &nbsp; Link encap:Ethernet&nbsp; HWaddr 00:1F:C6:8E:9C:3E<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.100.10&nbsp; Bcast:192.168.100.255&nbsp; Mask:255.255.255.0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet6 addr: fe80::21f:c6ff:fe8e:9c3e/64 Scope:Link<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP BROADCAST RUNNING MULTICAST&nbsp; MTU:1500&nbsp; Metric:1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX packets:2733 errors:0 dropped:0 overruns:0 frame:0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TX packets:997 errors:0 dropped:0 overruns:0 carrier:0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collisions:0 txqueuelen:1000<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX bytes:268702 (262.4 KiB)&nbsp; TX bytes:341565 (333.5 KiB)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Interrupt:17</p><p>lo&nbsp; &nbsp; &nbsp; &nbsp; Link encap:Local Loopback<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:127.0.0.1&nbsp; Mask:255.0.0.0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet6 addr: ::1/128 Scope:Host<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP LOOPBACK RUNNING&nbsp; MTU:16436&nbsp; Metric:1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX packets:4 errors:0 dropped:0 overruns:0 frame:0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TX packets:4 errors:0 dropped:0 overruns:0 carrier:0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collisions:0 txqueuelen:0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX bytes:240 (240.0 b)&nbsp; TX bytes:240 (240.0 b)</p>]]></content>
			<author>
				<name><![CDATA[xdenix]]></name>
				<uri>https://linuxforum.ru/profile.php?id=26322</uri>
			</author>
			<updated>2012-11-01T07:43:01Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=307067#p307067</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=307065#p307065" />
			<content type="html"><![CDATA[<p>отключил selinux вообще, не помогло</p>]]></content>
			<author>
				<name><![CDATA[xdenix]]></name>
				<uri>https://linuxforum.ru/profile.php?id=26322</uri>
			</author>
			<updated>2012-11-01T07:39:45Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=307065#p307065</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=307059#p307059" />
			<content type="html"><![CDATA[<p>Я про файерволл, а не про настройки апача</p>]]></content>
			<author>
				<name><![CDATA[alexfinn]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25867</uri>
			</author>
			<updated>2012-11-01T07:27:32Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=307059#p307059</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=307056#p307056" />
			<content type="html"><![CDATA[<p>в настройках : Listen 80 прописано</p>]]></content>
			<author>
				<name><![CDATA[xdenix]]></name>
				<uri>https://linuxforum.ru/profile.php?id=26322</uri>
			</author>
			<updated>2012-11-01T07:19:49Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=307056#p307056</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306838#p306838" />
			<content type="html"><![CDATA[<p>минимально необходимые настройки для включения nat-а (masquerade-инга) для обеспечения локальной сети интернетом (не зависит от дистрибутива):</p><p><em>outInt - интерфейс, к которому подключен &quot;uplink&quot;</em><br /></p><div class="codebox"><pre><code>iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING
iptables -t nat -F OUTPUT
iptables -F FORWARD
iptables -P FORWARD -j ACCEPT
iptables -t nat -A POSTROUTING -o ${outInt} -j MASQUERADE
echo 1 &gt; /proc/sys/net/ipv4/ip_forward</code></pre></div><br /><p>с учетом дефолтных конфигов CentOS (RH-like):</p><p><em>localNetwork - адрес локальной сети (префиксная форма)<br />outInt - интерфейс, к которому подключен &quot;uplink&quot;</em><br /></p><div class="codebox"><pre><code>service iptables start
iptables -I FORWARD -s ${localNetwork} -j ACCEPT
iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A POSTROUTING -o ${outInt} -j MASQURADE
service iptables save
sysctl -w net.ipv4.ip_forward=1
cp /etc/sysctl.conf{,.$(date &quot;+%Y%m%d-%H%M&quot;)}
sed -ie &#039;/^\s*net.ipv4.ip_forward/s/0/1/&#039; /etc/sysctl.conf</code></pre></div><p>--<br />ресурсы:<br /><a href="http://gazette.linux.ru.net/rus/articles/iptables-tutorial.html">документация по iptables</a><br /><a href="https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/pdf/Deployment_Guide/Red_Hat_Enterprise_Linux-6-Deployment_Guide-en-US.pdf">RHEL6: Deployment Guide</a><br />man sysctl.conf</p>]]></content>
			<author>
				<name><![CDATA[afanasev.p]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25834</uri>
			</author>
			<updated>2012-10-31T05:13:46Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306838#p306838</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306712#p306712" />
			<content type="html"><![CDATA[<p>Однако я два дня потратил на эти две строки&nbsp; Вчера весь интернет перерыл <img src="https://linuxforum.ru/img/smilies/ab.gif" alt="ab" /></p>]]></content>
			<author>
				<name><![CDATA[pavlar]]></name>
				<uri>https://linuxforum.ru/profile.php?id=17275</uri>
			</author>
			<updated>2012-10-30T10:56:49Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306712#p306712</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306711#p306711" />
			<content type="html"><![CDATA[<p>ну и славненько <img src="https://linuxforum.ru/img/smilies/ab.gif" alt="ab" /> собственно, отличие от изначальной конфигурации - в двух строках в FORWARD</p>]]></content>
			<author>
				<name><![CDATA[alexfinn]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25867</uri>
			</author>
			<updated>2012-10-30T10:55:41Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306711#p306711</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306710#p306710" />
			<content type="html"><![CDATA[<p>Chain INPUT (policy ACCEPT 0 packets, 0 bytes)<br /> pkts bytes target&nbsp; &nbsp; &nbsp;prot opt in&nbsp; &nbsp; &nbsp;out&nbsp; &nbsp; &nbsp;source&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;destination<br />&nbsp; 128&nbsp; 9668 ACCEPT&nbsp; &nbsp; &nbsp;all&nbsp; --&nbsp; *&nbsp; &nbsp; &nbsp; *&nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;state RELATED,ESTABLISHED<br />&nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp;0 ACCEPT&nbsp; &nbsp; &nbsp;icmp --&nbsp; *&nbsp; &nbsp; &nbsp; *&nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0/0<br />&nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp;0 ACCEPT&nbsp; &nbsp; &nbsp;all&nbsp; --&nbsp; lo&nbsp; &nbsp; &nbsp;*&nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0/0<br />&nbsp; &nbsp; 2&nbsp; &nbsp;148 ACCEPT&nbsp; &nbsp; &nbsp;tcp&nbsp; --&nbsp; *&nbsp; &nbsp; &nbsp; *&nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;state NEW tcp dpt:22<br />&nbsp; 424&nbsp; 191K REJECT&nbsp; &nbsp; &nbsp;all&nbsp; --&nbsp; *&nbsp; &nbsp; &nbsp; *&nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reject-with icmp-host-prohibited</p><p>Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)<br /> pkts bytes target&nbsp; &nbsp; &nbsp;prot opt in&nbsp; &nbsp; &nbsp;out&nbsp; &nbsp; &nbsp;source&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;destination<br />25175 1538K ACCEPT&nbsp; &nbsp; &nbsp;all&nbsp; --&nbsp; *&nbsp; &nbsp; &nbsp; eth0&nbsp; &nbsp; 192.168.1.0/24&nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0/0<br />50029&nbsp; &nbsp;74M ACCEPT&nbsp; &nbsp; &nbsp;all&nbsp; --&nbsp; eth0&nbsp; &nbsp;*&nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 192.168.1.0/24&nbsp; &nbsp; &nbsp; state RELATED,ESTABLISHED<br />&nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp;0 REJECT&nbsp; &nbsp; &nbsp;all&nbsp; --&nbsp; *&nbsp; &nbsp; &nbsp; *&nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0/0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reject-with icmp-host-prohibited</p><p>Chain OUTPUT (policy ACCEPT 75 packets, 18184 bytes)<br /> pkts bytes target&nbsp; &nbsp; &nbsp;prot opt in&nbsp; &nbsp; &nbsp;out&nbsp; &nbsp; &nbsp;source&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;destination</p>]]></content>
			<author>
				<name><![CDATA[pavlar]]></name>
				<uri>https://linuxforum.ru/profile.php?id=17275</uri>
			</author>
			<updated>2012-10-30T10:52:12Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306710#p306710</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306708#p306708" />
			<content type="html"><![CDATA[<p>а теперь покажите еще раз конфиг с правилами и вывод<br />iptables -L -n -v</p>]]></content>
			<author>
				<name><![CDATA[alexfinn]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25867</uri>
			</author>
			<updated>2012-10-30T10:26:00Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306708#p306708</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306706#p306706" />
			<content type="html"><![CDATA[<p>Исправил Переезапустил Вроде и так тоже работает.</p>]]></content>
			<author>
				<name><![CDATA[pavlar]]></name>
				<uri>https://linuxforum.ru/profile.php?id=17275</uri>
			</author>
			<updated>2012-10-30T10:25:04Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306706#p306706</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306705#p306705" />
			<content type="html"><![CDATA[<p>эээ, а вы правила добавляли прямо в консоли что ли?<br />пропишите в конфиг те правила для FORWARD. что я приводил ДО <br /></p><div class="quotebox"><cite>pavlar пишет:</cite><blockquote><p>#-A FORWARD -j REJECT --reject-with icmp-host-prohibited</p></blockquote></div><p>и раскомментируйте ее</p><p>и проверьте</p><p>после корректировки файла перезапустите iptables</p>]]></content>
			<author>
				<name><![CDATA[alexfinn]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25867</uri>
			</author>
			<updated>2012-10-30T10:16:03Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306705#p306705</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306704#p306704" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>alexfinn пишет:</cite><blockquote><p>а теперь покажите нынешний конфиг <img src="https://linuxforum.ru/img/smilies/ab.gif" alt="ab" /></p></blockquote></div><div class="codebox"><pre><code># Generated by iptables-save v1.4.7 on Mon Oct 29 14:24:09 2012
*nat
:PREROUTING ACCEPT [219:21980]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -s 192.168.1.0/24 -o eth0 -j SNAT --to-source 194.44.31.236
COMMIT
# Completed on Mon Oct 29 14:24:09 2012
# Generated by iptables-save v1.4.7 on Mon Oct 29 14:24:09 2012
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [26:2050]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
#-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Mon Oct 29 14:24:09 2012</code></pre></div>]]></content>
			<author>
				<name><![CDATA[pavlar]]></name>
				<uri>https://linuxforum.ru/profile.php?id=17275</uri>
			</author>
			<updated>2012-10-30T10:13:49Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306704#p306704</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306703#p306703" />
			<content type="html"><![CDATA[<p>я ж говорю, покажите нынешний конфиг</p>]]></content>
			<author>
				<name><![CDATA[alexfinn]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25867</uri>
			</author>
			<updated>2012-10-30T10:09:44Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306703#p306703</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306702#p306702" />
			<content type="html"><![CDATA[<p>Так что так и оставить? Дыры не будет?</p>]]></content>
			<author>
				<name><![CDATA[pavlar]]></name>
				<uri>https://linuxforum.ru/profile.php?id=17275</uri>
			</author>
			<updated>2012-10-30T10:09:06Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306702#p306702</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NAT CentOS 6.3]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=306701#p306701" />
			<content type="html"><![CDATA[<p>а теперь покажите нынешний конфиг <img src="https://linuxforum.ru/img/smilies/ab.gif" alt="ab" /></p>]]></content>
			<author>
				<name><![CDATA[alexfinn]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25867</uri>
			</author>
			<updated>2012-10-30T10:08:55Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=306701#p306701</id>
		</entry>
</feed>
