<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Linux Forum &mdash; Раздача инта в локалку]]></title>
	<link rel="self" href="https://linuxforum.ru/extern.php?action=feed&amp;tid=29782&amp;type=atom" />
	<updated>2013-08-26T06:13:58Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=29782</id>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=360253#p360253" />
			<content type="html"><![CDATA[<p>Все разобрался NAT не&nbsp; &nbsp;так заворачивал на squid</p>]]></content>
			<author>
				<name><![CDATA[spirit1086]]></name>
				<uri>https://linuxforum.ru/profile.php?id=28962</uri>
			</author>
			<updated>2013-08-26T06:13:58Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=360253#p360253</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=360147#p360147" />
			<content type="html"><![CDATA[<p>посмотрите пожалуйста почему у меня через прокси клиенты не получают инет Squid в роли прозрачного прокси сервера<br />Iptables<br /></p><div class="codebox"><pre><code>#!/bin/bash
# Очистка всех цепочек iptables
iptables -F
iptables -F -t nat
iptables -F -t mangle
iptables -X
iptables -t nat -X
iptables -t mangle -X

# Политика по умолчанию,запретить все что не разрешено
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

# Разрешаем обращение к lo интерфейсу
iptables -A INPUT -i lo -p all -j ACCEPT
iptables -A OUTPUT -o lo -p all -j ACCEPT

# Разрешаем обращение к внутреннему eth0 интерфейсу
iptables -A INPUT -i eth0 -p all -j ACCEPT
iptables -A OUTPUT -o eth0 -p all -j ACCEPT

# Пропускать уже инициированные, а также их дочерние
iptables -A INPUT -p all -m state --state ESTABLISHED,RELATED -j ACCEPT

# Пропускать новые, инициированные, а также их дочерние
iptables -A OUTPUT -p all -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

# Разрешить форвардинг для новых,инициированных, а также их дочерних
iptables -A FORWARD -p all -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT


# Настройка NAT
iptables -t nat -A PREROUTING -s 192.168.137.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-port 3128</code></pre></div><p>Squid<br /></p><div class="codebox"><pre><code>#
# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8    # RFC1918 possible internal network
acl localnet src 172.16.0.0/12    # RFC1918 possible internal network
acl localnet src 192.168.0.0/16    # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines


acl SSL_ports port 443
acl Safe_ports port 80        # http
acl Safe_ports port 21        # ftp
acl Safe_ports port 443        # https
acl Safe_ports port 70        # gopher
acl Safe_ports port 210        # wais
acl Safe_ports port 1025-65535    # unregistered ports
acl Safe_ports port 280        # http-mgmt
acl Safe_ports port 488        # gss-http
acl Safe_ports port 591        # filemaker
acl Safe_ports port 777        # multiling http
acl CONNECT method CONNECT

#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager

# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on &quot;localhost&quot; is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

acl MyLocal src 192.168.137.0/24 # МОЯ ЛОКАЛКА
acl MyProtocol proto http
http_access allow MyProtocol Safe_ports
http_access allow MyLocal    

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 3128 transparent

# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?

# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/spool/squid 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid

# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern -i (/cgi-bin/|\?) 0    0%    0
refresh_pattern .        0    20%    4320</code></pre></div>]]></content>
			<author>
				<name><![CDATA[spirit1086]]></name>
				<uri>https://linuxforum.ru/profile.php?id=28962</uri>
			</author>
			<updated>2013-08-25T14:06:05Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=360147#p360147</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=360042#p360042" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>AlfaStriker пишет:</cite><blockquote><p>В файл <strong>/etc/rc.d/rc.local</strong> добавь строчку:<br /></p><div class="codebox"><pre><code>/etc/sysconfig/firewall.sh</code></pre></div></blockquote></div><p>Это лишнее. Достаточно сделать:<br /></p><div class="codebox"><pre><code>#iptables-save &gt; /etc/sysconfig/iptables</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Cruiser78]]></name>
				<uri>https://linuxforum.ru/profile.php?id=631</uri>
			</author>
			<updated>2013-08-24T20:30:16Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=360042#p360042</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=360041#p360041" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>spirit1086 пишет:</cite><blockquote><p>форвардинг включен,а вот </p><div class="quotebox"><cite>Cruiser78⇓ пишет:</cite><blockquote><p>-A POSTROUTING -o $EXT_IF -j MASQUERADE</p></blockquote></div><p> iptables ругается<br />Вообще я правильно понимаю пинги идут туда и обратно между собой, а инета нет на локальной машине потому что&nbsp; правила в iptables по дефолту?</p></blockquote></div><p>А на что он ругается? На переменную EXT_IF (внешний интерфейс)? А определить её перед использованием Вы не забыли? Я же не знаю, как у Вас внешний интерфейс называется, телепатическими способностями не обладаю...</p>]]></content>
			<author>
				<name><![CDATA[Cruiser78]]></name>
				<uri>https://linuxforum.ru/profile.php?id=631</uri>
			</author>
			<updated>2013-08-24T20:26:40Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=360041#p360041</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=360030#p360030" />
			<content type="html"><![CDATA[<p><strong>AlfaStriker</strong>спс</p>]]></content>
			<author>
				<name><![CDATA[spirit1086]]></name>
				<uri>https://linuxforum.ru/profile.php?id=28962</uri>
			</author>
			<updated>2013-08-24T17:29:37Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=360030#p360030</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=360021#p360021" />
			<content type="html"><![CDATA[<p>теперь еще буду со squid разбираться</p>]]></content>
			<author>
				<name><![CDATA[spirit1086]]></name>
				<uri>https://linuxforum.ru/profile.php?id=28962</uri>
			</author>
			<updated>2013-08-24T15:11:10Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=360021#p360021</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=360020#p360020" />
			<content type="html"><![CDATA[<p><strong>AlfaStriker</strong>,&nbsp; Спасибо с первого раза поперло теперь буд разбираться!</p>]]></content>
			<author>
				<name><![CDATA[spirit1086]]></name>
				<uri>https://linuxforum.ru/profile.php?id=28962</uri>
			</author>
			<updated>2013-08-24T15:07:33Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=360020#p360020</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=360014#p360014" />
			<content type="html"><![CDATA[<p>Может файл скрипт правил iptables создашь?<br />Так удобней имхо.<br /></p><div class="codebox"><pre><code>touch /etc/sysconfig/firewall.sh
chmod +x /etc/sysconfig/firewall.sh
chmod 750 /etc/sysconfig/firewall.sh
vi /etc/sysconfig/firewall.sh</code></pre></div><div class="codebox"><pre><code>#!/bin/bash
# Очистка всех цепочек iptables
iptables -F
iptables -F -t nat
iptables -F -t mangle
iptables -X
iptables -t nat -X
iptables -t mangle -X

# Политика по умолчанию, запретить все что не разрешено
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

# Разрешаем обращение к lo интерфейсу
iptables -A INPUT -i lo -p all -j ACCEPT
iptables -A OUTPUT -o lo -p all -j ACCEPT

# Разрешаем обращение к внутреннему eth0 интерфейсу
iptables -A INPUT -i eth0 -p all -j ACCEPT
iptables -A OUTPUT -o eth0 -p all  -j ACCEPT

# Пропускать уже инициорванные, а также их дочерние
iptables -A INPUT -p all -m state --state ESTABLISHED,RELATED -j ACCEPT

# Пропускать новые, иницированные, а также их дочерние
iptables -A OUTPUT -p all -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

# Разрешить форвардинг для новых, иницированных, а также их дочерних
iptables -A FORWARD -p all -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

# Настройка NAT
iptables -t nat -A POSTROUTING -s 192.168.137.0/24 -j MASQUERADE</code></pre></div><p>В файл <strong>/etc/rc.d/rc.local</strong> добавь строчку:<br /></p><div class="codebox"><pre><code>/etc/sysconfig/firewall.sh</code></pre></div>]]></content>
			<author>
				<name><![CDATA[AlfaStriker]]></name>
				<uri>https://linuxforum.ru/profile.php?id=15778</uri>
			</author>
			<updated>2013-08-24T12:15:55Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=360014#p360014</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=359991#p359991" />
			<content type="html"><![CDATA[<p>написал ноль эффекта , а на centOS не надо как на винде давать общий доступ на интернет соединение ?</p>]]></content>
			<author>
				<name><![CDATA[spirit1086]]></name>
				<uri>https://linuxforum.ru/profile.php?id=28962</uri>
			</author>
			<updated>2013-08-24T08:24:12Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=359991#p359991</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=359989#p359989" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>А вот это в iptables по умолчанию было записано, я ничего не писал здесь</p></blockquote></div><p>В CentOs еще не доводилось работать, но думаю разница невелика.</p><div class="codebox"><pre><code>#iptables -t nat -A POSTROUTING -o $EXT_IF -j MASQUERADE</code></pre></div><p>$EXT_IF - замените на название вашего сетевого интерфейса с интернетом (к примеру ppp0).</p>]]></content>
			<author>
				<name><![CDATA[marikk]]></name>
				<uri>https://linuxforum.ru/profile.php?id=20103</uri>
			</author>
			<updated>2013-08-24T07:41:00Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=359989#p359989</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=359988#p359988" />
			<content type="html"><![CDATA[<p>Снес систему много чего накрутил и заново поставил чистую, инет на CentOs поднял, с локалки что с CentOs что с винды идут пинги между собой<br />eth0 сетевуха локальная Centos шлюза<br /></p><div class="codebox"><pre><code>ip 192.168.137.5
mask 255.255.255.0
gateway 
dns 192.168.137.5</code></pre></div><br /><p>компа с Win7<br /></p><div class="codebox"><pre><code>ip 192.168.137.11
mask 255.255.255.0
gateway 192.168.137.5
dns 8.8.8.8</code></pre></div><p>/etc/sysctl.conf&nbsp; &nbsp; &nbsp; net.ipv4.ip_forward = 1&nbsp; поставил</p><p>А вот это в iptables по умолчанию было записано, я ничего не писал здесь<br /></p><div class="codebox"><pre><code>INPUT ACCEPT 
FORWAD ACCEPT
OUTPUT ACCEPT
-A INPUT -m state  --state  ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state NEW -m tcp -p tcp  --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD  -j REJECT --reject-with icmp-host-prohibited</code></pre></div><p>Подскажите какие дальше действия чтобы на локальном компе работал инет</p>]]></content>
			<author>
				<name><![CDATA[spirit1086]]></name>
				<uri>https://linuxforum.ru/profile.php?id=28962</uri>
			</author>
			<updated>2013-08-24T07:35:12Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=359988#p359988</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=359986#p359986" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>spirit1086⇓ пишет:</cite><blockquote><p>INPUT ACCEPT <br />FORWAD ACCEPT<br />OUTPUT ACCEPT<br />-A INPUT -m state&nbsp; --state&nbsp; ESTABLISHED,RELATED -j ACCEPT<br />-A INPUT -p icmp -j ACCEPT<br />-A INPUT -i lo -j ACCEPT<br />-A INPUT -m state NEW -m tcp -p tcp&nbsp; --dport 22 -j ACCEPT<br />-A INPUT -j REJECT --reject-with icmp-host-prohibited<br />-A FORWARD&nbsp; -j REJECT --reject-with icmp-host-prohibited</p></blockquote></div><p>Не стоит с такой белеберды начинать настраивать шлюз. </p><p>Настройте интерфейсы. Проверьте соединение(к интернету и к локалке). Включите форвардинг. С помощью iptables включите трансляцию пакетов туда-обратно (маскарадинг или snat). И когда все это заработает добавляйте плюшек сколько душе угодно.</p><div class="quotebox"><blockquote><p>iptables ругается</p></blockquote></div><p>Увидеть бы ошибку.</p><p>А вы заменили $EXT_IF на название интерфейса с интернет соединением ?</p>]]></content>
			<author>
				<name><![CDATA[marikk]]></name>
				<uri>https://linuxforum.ru/profile.php?id=20103</uri>
			</author>
			<updated>2013-08-24T07:27:29Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=359986#p359986</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=359976#p359976" />
			<content type="html"><![CDATA[<p>форвардинг включен,а вот </p><div class="quotebox"><cite>Cruiser78⇓ пишет:</cite><blockquote><p>-A POSTROUTING -o $EXT_IF -j MASQUERADE</p></blockquote></div><p> iptables ругается<br />Вообще я правильно понимаю пинги идут туда и обратно между собой, а инета нет на локальной машине потому что&nbsp; правила в iptables по дефолту?</p>]]></content>
			<author>
				<name><![CDATA[spirit1086]]></name>
				<uri>https://linuxforum.ru/profile.php?id=28962</uri>
			</author>
			<updated>2013-08-24T06:18:18Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=359976#p359976</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=359971#p359971" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>spirit1086 пишет:</cite><blockquote><p>Удалил последние две строки все равно с машины с win7 нет инета</p></blockquote></div><p>А на центосе форвардинг пакетов включен?</p><div class="codebox"><pre><code>#echo 1 &gt; /proc/sys/net/ipv4/ip_forward</code></pre></div><p>Ну и правило в iptables про форвардинг должно выглядеть чуть иначе:</p><div class="codebox"><pre><code>-A FORWARD -o $LAN_IF -j ACCEPT
-A POSTROUTING -o $EXT_IF -j MASQUERADE</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Cruiser78]]></name>
				<uri>https://linuxforum.ru/profile.php?id=631</uri>
			</author>
			<updated>2013-08-24T03:00:22Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=359971#p359971</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Раздача инта в локалку]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=359970#p359970" />
			<content type="html"><![CDATA[<p>Удалил последние две строки все равно с машины с win7 нет инета</p>]]></content>
			<author>
				<name><![CDATA[spirit1086]]></name>
				<uri>https://linuxforum.ru/profile.php?id=28962</uri>
			</author>
			<updated>2013-08-23T21:16:57Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=359970#p359970</id>
		</entry>
</feed>
