<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IT блог - полезные заметки. &#187; networking</title>
	<atom:link href="http://itblog.su/category/networking/feed" rel="self" type="application/rss+xml" />
	<link>http://itblog.su</link>
	<description>IT blog - авторский блог о Linux, windows, php, mysql.</description>
	<lastBuildDate>Mon, 16 Jan 2012 18:36:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Asterisk SIP and iptables</title>
		<link>http://itblog.su/asterisk-sip-and-iptables.html</link>
		<comments>http://itblog.su/asterisk-sip-and-iptables.html#comments</comments>
		<pubDate>Fri, 15 Oct 2010 18:41:33 +0000</pubDate>
		<dc:creator>Артур Шакиров</dc:creator>
				<category><![CDATA[CentOS Linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://itblog.su/?p=417</guid>
		<description><![CDATA[Появилась задача, удаленному офису нужно подключаться к астериску, и тут и там статические &#171;белые&#187; IP адреса. Для решения задачи были добавлены правила: iptables -A RH-Firewall-1-INPUT -i eth0 -s 91.211.000.000 -j ACCEPT iptables -A RH-Firewall-1-INPUT -i eth0 -d 91.211.000.000 -j ACCEPT если нужно открыть доступ для всех внешних подключений по SIP, то правила следующие: iptables -A [...]]]></description>
			<content:encoded><![CDATA[<p>Появилась задача, удаленному офису нужно подключаться к астериску, и тут и там статические &#171;белые&#187; IP адреса. Для решения задачи были добавлены правила:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1">iptables <span class="re5">-A</span> RH-Firewall-<span class="nu0">1</span>-INPUT <span class="re5">-i</span> eth0 <span class="re5">-s</span> 91.211.000.000 <span class="re5">-j</span> ACCEPT
iptables <span class="re5">-A</span> RH-Firewall-<span class="nu0">1</span>-INPUT <span class="re5">-i</span> eth0 <span class="re5">-d</span> 91.211.000.000 <span class="re5">-j</span> ACCEPT</pre></div></div></div></div></div></div></div>


<p>если нужно открыть доступ для всех внешних подключений по SIP, то правила следующие:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1">iptables <span class="re5">-A</span> INPUT <span class="re5">-p</span> udp <span class="re5">-i</span> eth0 <span class="re5">--dport</span> <span class="nu0">5060</span> <span class="re5">-j</span> ACCEPT
iptables <span class="re5">-A</span> INPUT <span class="re5">-p</span> tcp <span class="re5">-i</span> eth0 <span class="re5">--dport</span> <span class="nu0">5060</span> <span class="re5">-j</span> ACCEPT
iptables <span class="re5">-A</span> INPUT <span class="re5">-p</span> udp <span class="re5">-i</span> eth0 <span class="re5">--dport</span> <span class="nu0">10000</span>:<span class="nu0">20000</span> <span class="re5">-j</span> ACCEPT</pre></div></div></div></div></div></div></div>


<p>где eth0 интерфейс с &#171;белым&#187; внешним IP адресом, а 91.211.000.000 это IP адрес удаленного офиса.</p>
]]></content:encoded>
			<wfw:commentRss>http://itblog.su/asterisk-sip-and-iptables.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>static routes pushed through DHCP</title>
		<link>http://itblog.su/static-routes-pushed-through-dhcp.html</link>
		<comments>http://itblog.su/static-routes-pushed-through-dhcp.html#comments</comments>
		<pubDate>Wed, 15 Sep 2010 17:47:36 +0000</pubDate>
		<dc:creator>Артур Шакиров</dc:creator>
				<category><![CDATA[networking]]></category>
		<category><![CDATA[Несортированное]]></category>

		<guid isPermaLink="false">http://itblog.su/?p=399</guid>
		<description><![CDATA[Моя домашняя сеть находится в 192.168.1.0/24, а голос вынесен в подсеть 192.168.0.0/24. доступ &#171;в мир&#187; роутится через 192.168.1.1 а в голос через 192.168.1.111 (да вот захотелось мне так). Домашние машины получают ip адреса из подсети 192.168.1.0/24, а айпифоны из подсети 192.168.0.0/24 соответственно по дефолту машины не могут получить доступа к фойсовым аппаратам (ATA и IP [...]]]></description>
			<content:encoded><![CDATA[<p>Моя домашняя сеть находится в 192.168.1.0/24, а голос вынесен в подсеть 192.168.0.0/24.<br />
доступ &#171;в мир&#187; роутится через 192.168.1.1 а в голос через 192.168.1.111 (да вот захотелось мне так).<br />
Домашние машины получают ip адреса из подсети 192.168.1.0/24, а айпифоны из подсети 192.168.0.0/24</p>
<p>соответственно по дефолту машины не могут получить доступа к фойсовым аппаратам (ATA и IP фоны), прописывать на каждой машине статик роуты, я считаю моветоном. К счастью, не я один так считаю и есть <a href="http://www.faqs.org/rfcs/rfc3442.html">rfc3442</a> позволяющий с DHCP сервера передавать клиентам статичные маршруты.</p>
<p>итак настроим dhcp сервер давать статик роут на сеть 192.168.0.0/24 через 192.168.1.111</p>
<div class="codecolorer-container ini mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="ini codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">option ms-classless-static-routes code <span style="">249</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> array of unsigned integer 8</span><span style="color: #666666; font-style: italic;">;</span><br />
option rfc3442-classless-static-routes code <span style="">121</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> array of unsigned integer 8</span><span style="color: #666666; font-style: italic;">;</span><br />
<br />
option ms-classless-static-routes <span style="">24</span>, <span style="">192</span>,<span style="">168</span>,<span style="">0</span>, <span style="">192</span>, <span style="">168</span>, <span style="">1</span>, <span style="">111</span><span style="color: #666666; font-style: italic;">;</span><br />
option rfc3442-classless-static-routes <span style="">24</span>, <span style="">192</span>,<span style="">168</span>,<span style="">0</span>, <span style="">192</span>, <span style="">168</span>, <span style="">1</span>, <span style="">111</span><span style="color: #666666; font-style: italic;">;</span></div></div>
<p>Так как Microsoft компания новатор, срать ей хотелось на RFC. По этому в приведенном выше конфиге присутствуют ms-classless строки. Если у вас в сети нет windows машин, то можно их не уазывать.</p>
<p>На сервере делаем service dhcpd restart, а на клиенте /etc/init.d/networking restart и на клиенте получим:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">shakirov@work:~$ </span>route <span style="color: #660033;">-n</span><br />
Destination Gateway Genmask Flags Metric Ref Use Iface<br />
192.168.1.0 &nbsp; &nbsp; 0.0.0.0 &nbsp; &nbsp; &nbsp; &nbsp; 255.255.255.0 &nbsp; U &nbsp; &nbsp; <span style="color: #000000;">1</span> &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0</span> eth0<br />
192.168.0.0 &nbsp; &nbsp; 192.168.1.111 &nbsp; 255.255.255.0 &nbsp; UG &nbsp; &nbsp;<span style="color: #000000;">0</span> &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0</span> eth0<br />
169.254.0.0 &nbsp; &nbsp; 0.0.0.0 &nbsp; &nbsp; &nbsp; &nbsp; 255.255.0.0 &nbsp; &nbsp; U &nbsp; &nbsp; <span style="color: #000000;">1000</span> &nbsp; <span style="color: #000000;">0</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0</span> eth0<br />
0.0.0.0 &nbsp; &nbsp; &nbsp; &nbsp; 192.168.1.1 &nbsp; &nbsp; 0.0.0.0 &nbsp; &nbsp; &nbsp; &nbsp; UG &nbsp; &nbsp;<span style="color: #000000;">100</span> &nbsp; &nbsp;<span style="color: #000000;">0</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0</span> eth0</div></div>
<p>справедливо это для Ubuntu на клиенте, говорят что в других дистрибутивах нужно в /etc/dhcp3/dhclient.conf добавить:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">option rfc3442-classless-static-routes code <span style="color: #000000;">121</span> = array of unsigned integer <span style="color: #000000;">8</span>;</div></div>
<p>И в том же файле в поле request добавить параметр rfc3442-classless-static-routes; выглядеть в итоге должно так:</p>
<div class="codecolorer-container ini mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="ini codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">option rfc3442-classless-static-routes code <span style="">121</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> array of unsigned integer 8</span><span style="color: #666666; font-style: italic;">;</span><br />
<br />
send host-name <span style="color: #933;">&quot;&lt;hostname&gt;&quot;</span><span style="color: #666666; font-style: italic;">;</span><br />
request subnet-mask, broadcast-address, time-offset, routers,<br />
&nbsp; &nbsp; domain-name, domain-name-servers, domain-search, host-name,<br />
&nbsp; &nbsp; netbios-name-servers, netbios-scope, interface-mtu,<br />
&nbsp; &nbsp; rfc3442-classless-static-routes, ntp-servers<span style="color: #666666; font-style: italic;">;</span></div></div>
<p>И еще, если нет, то надо создать файл /etc/dhcp3/dhclient-exit-hooks.d/rfc3442-classless-routes</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">RUN</span>=<span style="color: #ff0000;">&quot;yes&quot;</span><br />
<br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$RUN</span>&quot;</span> = <span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$new_rfc3442_classless_static_routes</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$reason</span>&quot;</span> = <span style="color: #ff0000;">&quot;BOUND&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$reason</span>&quot;</span> = <span style="color: #ff0000;">&quot;REBOOT&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">rfc_routes</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$new_rfc3442_classless_static_routes</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">i</span>=<span style="color: #000000;">0</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #800000;">${#rfc_routes[@]}</span>; <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">net_length</span>=<span style="color: #800000;">${rfc_routes[$i]}</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>i++<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">net_address</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span> <span style="color: #000000;">0</span> <span style="color: #000000;">0</span> <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">j</span>=<span style="color: #000000;">0</span>; j <span style="color: #000000; font-weight: bold;">&lt;</span> $<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">$net_length</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000;">8</span> + \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$net_length</span> <span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000;">8</span> ? <span style="color: #000000;">1</span> : <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; j++, i++<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">do</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; net_address<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">$j</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${rfc_routes[$i]}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">done</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">gateway</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span> <span style="color: #000000;">0</span> <span style="color: #000000;">0</span> <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">j</span>=<span style="color: #000000;">0</span>; j <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000;">4</span>; j++, i++ <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gateway<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">$j</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${rfc_routes[$i]}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">done</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">old_IFS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$IFS</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">IFS</span>=<span style="color: #ff0000;">'.'</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$net_length</span>&quot;</span> == <span style="color: #ff0000;">&quot;32&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>route add <span style="color: #660033;">-host</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${net_address[*]}</span>&quot;</span> gw <span style="color: #ff0000;">&quot;<span style="color: #007800;">${gateway[*]}</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>route add <span style="color: #660033;">-net</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${net_address[*]}</span>/<span style="color: #007800;">$net_length</span>&quot;</span> gw <span style="color: #ff0000;">&quot;<span style="color: #007800;">${gateway[*]}</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">IFS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$old_IFS</span>&quot;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">done</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">fi</span></div></div>
<p>Ну и конечно сделать его исполняемым.</p>
<p>кстати, если нужно передать несколько статичных маршрутов клиентам, то перечислять их надо через запятую, примерно вот так:</p>
<div class="codecolorer-container ini mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="ini codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">option ms-classless-static-routes &nbsp; &nbsp; &nbsp; <span style="">24</span>, <span style="">192</span>,<span style="">168</span>,<span style="">0</span>, <span style="">192</span>,<span style="">168</span>,<span style="">1</span>,<span style="">111</span>, <span style="">16</span>, <span style="">172</span>,<span style="">16</span>, <span style="">10</span>,<span style="">16</span>,<span style="">40</span>,<span style="">100</span><span style="color: #666666; font-style: italic;">;</span><br />
option rfc3442-classless-static-routes <span style="">24</span>, <span style="">192</span>,<span style="">168</span>,<span style="">0</span>, <span style="">192</span>,<span style="">168</span>,<span style="">1</span>,<span style="">111</span>, <span style="">16</span>, <span style="">172</span>,<span style="">16</span>, <span style="">10</span>,<span style="">16</span>,<span style="">40</span>,<span style="">100</span><span style="color: #666666; font-style: italic;">;</span></div></div>
<p>И на последок, если используете OpenWRT и сервер dnsmasq, то вам приголится мануал http://www.debian-administration.org/articles/471</p>
]]></content:encoded>
			<wfw:commentRss>http://itblog.su/static-routes-pushed-through-dhcp.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>XEN bug on RTL8111/8168B</title>
		<link>http://itblog.su/xen-bug-on-rtl81118168b.html</link>
		<comments>http://itblog.su/xen-bug-on-rtl81118168b.html#comments</comments>
		<pubDate>Sat, 11 Apr 2009 13:23:12 +0000</pubDate>
		<dc:creator>Артур Шакиров</dc:creator>
				<category><![CDATA[CentOS Linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[dmesg]]></category>
		<category><![CDATA[HWaddr]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://itblog.su/?p=296</guid>
		<description><![CDATA[На свежеустановленный CentOS 5.3 был поставлен Xen, после ребута отмерла сеть. В dmesg сыпятся ошибки: vif0.0: received packet with own address as source address причиной тому совпадение HWaddr для eth0 и xenbr0 (каким-то боком eth0 перекосило). фиксится крайне просто, может быть не так элегантно как хотелось бы, но просто. В /etc/rc.local добавляем: /sbin/ip link set [...]]]></description>
			<content:encoded><![CDATA[<p>На свежеустановленный CentOS 5.3 был поставлен Xen, после ребута отмерла сеть. В dmesg сыпятся ошибки:<br />
vif0.0: received packet with  own address as source address</p>
<p>причиной тому совпадение HWaddr для eth0 и xenbr0 (каким-то боком eth0 перекосило).</p>
<p>фиксится крайне просто, может быть не так элегантно как хотелось бы, но просто. В /etc/rc.local добавляем:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ip link</span> <span style="color: #000000; font-weight: bold;">set</span> eth0 down<br />
<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ip link</span> <span style="color: #000000; font-weight: bold;">set</span> eth0 addr 00:1C:C0:7F:<span style="color: #000000;">76</span>:<span style="color: #000000;">33</span><br />
<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ip link</span> <span style="color: #000000; font-weight: bold;">set</span> eth0 up<br />
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>network restart</div></div>
<p>и делаем рестарт системы. </p>
]]></content:encoded>
			<wfw:commentRss>http://itblog.su/xen-bug-on-rtl81118168b.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Настройка сети в CentOS Linux</title>
		<link>http://itblog.su/nastrojjka-seti-v-centos-linux.html</link>
		<comments>http://itblog.su/nastrojjka-seti-v-centos-linux.html#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:23:08 +0000</pubDate>
		<dc:creator>Артур Шакиров</dc:creator>
				<category><![CDATA[CentOS Linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[eth]]></category>
		<category><![CDATA[ifconfig]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[sysconfig]]></category>

		<guid isPermaLink="false">http://itblog.su/?p=290</guid>
		<description><![CDATA[тема простая, но судя по вопросам в icq, вопросы по ней еще возникают. Попытаюсь всё в одной статье описать. Итак, самое превое, это просмотр настроек сети: &#91;root@kazan ~&#93;# ifconfig eth0 &#160; &#160; &#160;Link encap:Ethernet &#160;HWaddr 00:19:5B:72:57:C5 &#160; &#160; &#160; &#160; &#160; inet addr:192.168.12.200 &#160;Bcast:192.168.12.255 &#160;Mask:255.255.255.0 &#160; &#160; &#160; &#160; &#160; inet6 addr: fe80::219:5bff:fe72:57c5/64 Scope:Link &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>тема простая, но судя по вопросам в icq, вопросы по ней еще возникают. Попытаюсь всё в одной статье описать.</p>
<p><span id="more-290"></span></p>
<p>Итак, самое превое, это просмотр настроек сети:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># ifconfig</span><br />
eth0 &nbsp; &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.200 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet6 addr: fe80::<span style="color: #000000;">219</span>:5bff:fe72:57c5<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">64</span> Scope:Link<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP BROADCAST RUNNING MULTICAST &nbsp;MTU:<span style="color: #000000;">1500</span> &nbsp;Metric:<span style="color: #000000;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX packets:<span style="color: #000000;">10459189</span> errors:<span style="color: #000000;">0</span> dropped:<span style="color: #000000;">0</span> overruns:<span style="color: #000000;">0</span> frame:<span style="color: #000000;">0</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TX packets:<span style="color: #000000;">8331867</span> errors:<span style="color: #000000;">0</span> dropped:<span style="color: #000000;">0</span> overruns:<span style="color: #000000;">0</span> carrier:<span style="color: #000000;">0</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collisions:<span style="color: #000000;">0</span> txqueuelen:<span style="color: #000000;">1000</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX bytes:<span style="color: #000000;">1098049417</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1.0</span> GiB<span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp;TX bytes:<span style="color: #000000;">3691672162</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3.4</span> GiB<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Interrupt:<span style="color: #000000;">10</span> Base address:0x2000<br />
<br />
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: ::<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">128</span> Scope:Host<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP LOOPBACK RUNNING &nbsp;MTU:<span style="color: #000000;">16436</span> &nbsp;Metric:<span style="color: #000000;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX packets:<span style="color: #000000;">201334</span> errors:<span style="color: #000000;">0</span> dropped:<span style="color: #000000;">0</span> overruns:<span style="color: #000000;">0</span> frame:<span style="color: #000000;">0</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TX packets:<span style="color: #000000;">201334</span> errors:<span style="color: #000000;">0</span> dropped:<span style="color: #000000;">0</span> overruns:<span style="color: #000000;">0</span> carrier:<span style="color: #000000;">0</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collisions:<span style="color: #000000;">0</span> txqueuelen:<span style="color: #000000;">0</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX bytes:<span style="color: #000000;">29023905</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">27.6</span> MiB<span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp;TX bytes:<span style="color: #000000;">29023905</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">27.6</span> MiB<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
или<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># ip addr show</span><br />
<span style="color: #000000;">1</span>: lo: <span style="color: #000000; font-weight: bold;">&lt;</span>LOOPBACK,UP,LOWER_UP<span style="color: #000000; font-weight: bold;">&gt;</span> mtu <span style="color: #000000;">16436</span> qdisc noqueue<br />
&nbsp; &nbsp; link<span style="color: #000000; font-weight: bold;">/</span>loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br />
&nbsp; &nbsp; inet 127.0.0.1<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> scope host lo<br />
&nbsp; &nbsp; inet6 ::<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">128</span> scope host<br />
&nbsp; &nbsp; &nbsp; &nbsp;valid_lft forever preferred_lft forever<br />
<span style="color: #000000;">2</span>: eth0: <span style="color: #000000; font-weight: bold;">&lt;</span>BROADCAST,MULTICAST,UP,LOWER_UP<span style="color: #000000; font-weight: bold;">&gt;</span> mtu <span style="color: #000000;">1500</span> qdisc pfifo_fast qlen <span style="color: #000000;">1000</span><br />
&nbsp; &nbsp; link<span style="color: #000000; font-weight: bold;">/</span>ether 00:<span style="color: #000000;">19</span>:5b:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:c5 brd ff:ff:ff:ff:ff:ff<br />
&nbsp; &nbsp; inet 192.168.12.200<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global eth0<br />
&nbsp; &nbsp; inet6 fe80::<span style="color: #000000;">219</span>:5bff:fe72:57c5<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">64</span> scope <span style="color: #c20cb9; font-weight: bold;">link</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;valid_lft forever preferred_lft forever<br />
<span style="color: #000000;">3</span>: sit0: <span style="color: #000000; font-weight: bold;">&lt;</span>NOARP<span style="color: #000000; font-weight: bold;">&gt;</span> mtu <span style="color: #000000;">1480</span> qdisc noop<br />
&nbsp; &nbsp; link<span style="color: #000000; font-weight: bold;">/</span>sit 0.0.0.0 brd 0.0.0.0</div></div>
<p>Вывести список всех ip адресов машины можно, с маской подсети:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># ip addr show | grep inet | grep -v inet6 | awk '{print $2}'</span><br />
127.0.0.1<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span><br />
192.168.12.200<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span></div></div>
<p>без маски:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># ip addr show | grep inet | grep -v inet6 | awk '{print $2}' | awk -F&quot;/&quot; '{print $1}'</span><br />
127.0.0.1<br />
192.168.12.200</div></div>
<p>Настройки сетевых интерфейсов хранятся в /etc/sysconfig/network-scripts/ для примера покажу eth0</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cat /etc/sysconfig/network-scripts/ifcfg-eth0</span><br />
<span style="color: #666666; font-style: italic;"># VIA Technologies, Inc. VT6105 [Rhine-III]</span><br />
<span style="color: #007800;">DEVICE</span>=eth0<br />
<span style="color: #007800;">BOOTPROTO</span>=static<br />
<span style="color: #007800;">BROADCAST</span>=192.168.12.255<br />
<span style="color: #007800;">HWADDR</span>=00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
<span style="color: #007800;">IPADDR</span>=192.168.12.200<br />
<span style="color: #007800;">NETMASK</span>=255.255.255.0<br />
<span style="color: #007800;">NETWORK</span>=192.168.12.0<br />
<span style="color: #007800;">ONBOOT</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span></div></div>
<p>если правите настройки, незабываем рестартить сеть /etc/init.d/network restart</p>
<p>это универсальный конфиг, например нужно создать виртуальный интерфейс eth0:0 для это создаем /etc/sysconfig/network-scripts/ifcfg-eth0:0 с ip адресом 192.168.12.201, для этого:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># sed -i &quot;s/eth0/eth0:0/&quot; /etc/sysconfig/network-scripts/ifcfg-eth0:0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># sed -i &quot;s/192.168.12.200/192.168.12.201/&quot; /etc/sysconfig/network-scripts/ifcfg-eth0:0</span><br />
проверяем:<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cat /etc/sysconfig/network-scripts/ifcfg-eth0:0</span><br />
<span style="color: #666666; font-style: italic;"># VIA Technologies, Inc. VT6105 [Rhine-III]</span><br />
<span style="color: #007800;">DEVICE</span>=eth0:<span style="color: #000000;">0</span><br />
<span style="color: #007800;">BOOTPROTO</span>=static<br />
<span style="color: #007800;">BROADCAST</span>=192.168.12.255<br />
<span style="color: #007800;">HWADDR</span>=00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
<span style="color: #007800;">IPADDR</span>=192.168.12.201<br />
<span style="color: #007800;">NETMASK</span>=255.255.255.0<br />
<span style="color: #007800;">NETWORK</span>=192.168.12.0<br />
<span style="color: #007800;">ONBOOT</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span><br />
<br />
и рестартим сеть:<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># /etc/init.d/network restart</span><br />
Деактивируется интерфейс eth0: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#91;</span> &nbsp;OK &nbsp;<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
Деактивируется интерфейс-петля: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#91;</span> &nbsp;OK &nbsp;<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
Активируется интерфейс loopback: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#91;</span> &nbsp;OK &nbsp;<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
Активируется интерфейс eth0: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#91;</span> &nbsp;OK &nbsp;<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<br />
проверяем: <br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># ifconfig eth0:0</span><br />
eth0:<span style="color: #000000;">0</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.201 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP BROADCAST RUNNING MULTICAST &nbsp;MTU:<span style="color: #000000;">1500</span> &nbsp;Metric:<span style="color: #000000;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Interrupt:<span style="color: #000000;">10</span> Base address:0x2000</div></div>
<p>Другая, нередкая ситуация с серверами в датацентре, нужно повесить на машину диапазон ip адресов. Для примера возьмем 192.168.12.202 до 192.168.12.210. для этого:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># echo &quot;IPADDR_START=192.168.12.202&quot; &gt; /etc/sysconfig/network-scripts/ifcfg-eth0-range0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># echo &quot;IPADDR_END=192.168.12.210&quot; &gt;&gt; /etc/sysconfig/network-scripts/ifcfg-eth0-range0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># echo &quot;NETMASK=255.255.255.0&quot; &gt;&gt; /etc/sysconfig/network-scripts/ifcfg-eth0-range0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># echo &quot;CLONENUM_START=1&quot; &gt;&gt; /etc/sysconfig/network-scripts/ifcfg-eth0-range0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># echo &quot;NO_ALIASROUTING=yes&quot; &gt;&gt; /etc/sysconfig/network-scripts/ifcfg-eth0-range0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># /etc/init.d/network restart</span><br />
проверяем:<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>kazan ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># ifconfig | grep -E &quot;eth0|inet addr&quot;</span><br />
eth0 &nbsp; &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.200 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
eth0:<span style="color: #000000;">0</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.201 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
eth0:<span style="color: #000000;">1</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.202 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
eth0:<span style="color: #000000;">2</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.203 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
eth0:<span style="color: #000000;">3</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.204 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
eth0:<span style="color: #000000;">4</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.205 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
eth0:<span style="color: #000000;">5</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.206 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
eth0:<span style="color: #000000;">6</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.207 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
eth0:<span style="color: #000000;">7</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.208 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
eth0:<span style="color: #000000;">8</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.209 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0<br />
eth0:<span style="color: #000000;">9</span> &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 00:<span style="color: #000000;">19</span>:5B:<span style="color: #000000;">72</span>:<span style="color: #000000;">57</span>:C5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.12.210 &nbsp;Bcast:192.168.12.255 &nbsp;Mask:255.255.255.0</div></div>
<p>Настройка сети с помощью ifconfig и route. Предположим, на сервере есть второй интерфейс eth1, нужно повестиь на него ip из другой сети. Показываю на примере:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #660033;">-a</span> eth0 192.168.1.200 netmask 255.255.255.0<br />
route add default gw 192.168.1.100</div></div>
<p>Есть вопросы? добро пожаловать в комментарии.</p>
]]></content:encoded>
			<wfw:commentRss>http://itblog.su/nastrojjka-seti-v-centos-linux.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>possible SYN flooding on port 80. Sending cookies.</title>
		<link>http://itblog.su/possible-syn-flooding-on-port-80-sending-cookies.html</link>
		<comments>http://itblog.su/possible-syn-flooding-on-port-80-sending-cookies.html#comments</comments>
		<pubDate>Wed, 11 Feb 2009 22:14:25 +0000</pubDate>
		<dc:creator>Артур Шакиров</dc:creator>
				<category><![CDATA[CentOS Linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[dmesg]]></category>
		<category><![CDATA[flooding]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[netstat]]></category>
		<category><![CDATA[sysctl]]></category>
		<category><![CDATA[tcp]]></category>

		<guid isPermaLink="false">http://itblog.su/?p=274</guid>
		<description><![CDATA[Начал падать апач, при ближайшем рассмотрении dmesg выдал: possible SYN flooding on port 80. Sending cookies. посмотрим кто же у нас лидер по SYN запросам: netstat -n -p &#124; grep SYN_REC&#124; awk '{print $5}'&#124;awk -F: '{print $1}' &#124; sort -n &#124; uniq -c &#124; sort -nr &#124; head -n10 на первом месте 88.147.212.229 с числом [...]]]></description>
			<content:encoded><![CDATA[<p>Начал падать апач, при ближайшем рассмотрении dmesg выдал:<br />
possible SYN flooding on port 80. Sending cookies.</p>
<p>посмотрим кто же у нас лидер по SYN запросам:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">netstat</span> <span style="color: #660033;">-n</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> SYN_REC<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $5}'</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> -F: <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-nr</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> <span style="color: #660033;">-n10</span></div></div>
<p>на первом месте  88.147.212.229 с числом 1030, это один из наших победителей. банним ублюдка:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">iptables <span style="color: #660033;">-I</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-s</span> 88.147.212.229 <span style="color: #660033;">-j</span> REJECT <span style="color: #660033;">--reject-with</span> tcp-reset</div></div>
<p>если таких явных лидеров нет (и ничего не валится, кроме сообщений в /var/log/messages), то возможно ложное срабатывание. Лечим так:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sysctl <span style="color: #660033;">-w</span> net.ipv4.tcp_syncookies=<span style="color: #000000;">0</span><br />
<br />
затем в конфиг <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysctl.conf добавляем строчку:<br />
net.ipv4.tcp_syncookies=<span style="color: #000000;">0</span><br />
<br />
проверяем:<br />
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>tcp_syncookies</div></div>
]]></content:encoded>
			<wfw:commentRss>http://itblog.su/possible-syn-flooding-on-port-80-sending-cookies.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to kill TCP connection in CentOS</title>
		<link>http://itblog.su/how-to-kill-tcp-connection-in-centos.html</link>
		<comments>http://itblog.su/how-to-kill-tcp-connection-in-centos.html#comments</comments>
		<pubDate>Tue, 09 Dec 2008 23:13:27 +0000</pubDate>
		<dc:creator>Артур Шакиров</dc:creator>
				<category><![CDATA[CentOS Linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[dsniff]]></category>
		<category><![CDATA[epel]]></category>
		<category><![CDATA[eth]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[lang]]></category>
		<category><![CDATA[tcp]]></category>
		<category><![CDATA[tcpkill]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://itblog.su/?p=224</guid>
		<description><![CDATA[Убить tcp соединения в Centos (да и не только) можно утилитой tcpkill. Утилита входит в пакет dsniff, ставим из репозитория epel (на данный момент в этом репозитарии dsniff новее) или rpmforge под CentOS 5.2 &#91;root@srv001 ~&#93;# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm &#91;root@srv001 ~&#93;# yum install dsniff Ну, и несколько примеров использования: 1. убить все исходящие соединения с [...]]]></description>
			<content:encoded><![CDATA[<p>Убить tcp соединения в Centos (да и не только) можно утилитой tcpkill. Утилита входит в пакет dsniff, ставим из репозитория epel (на данный момент в этом репозитарии dsniff новее) или rpmforge под CentOS 5.2</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>srv001 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>srv001 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum install dsniff</span></div></div>
<p>Ну, и несколько примеров использования:<br />
1. убить все исходящие соединения с интерфейса eth0 на порт 21</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tcpkill <span style="color: #660033;">-i</span> eth0 port <span style="color: #000000;">21</span></div></div>
<p>2. убить все соединения исходящие/входящие с хоста</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tcpkill host 192.168.0.1<br />
tcpkill host hostname.ru</div></div>
<p>3. убить все ip пакеты между хостом 192.168.0.1 и любым другим, кроме 192.168.0.10</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tcpkill <span style="color: #c20cb9; font-weight: bold;">ip</span> host 192.168.0.1 and not 192.168.0.10</div></div>
<p>Ну и различные от этого вариации. Прошу учесть тот факт что если пакеты убивать нужно идущие на/с ip &#171;зацепленного&#187; на логический интерфейс (например eth0:1), то нужно явно это указать, как-то так:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tcpkill <span style="color: #660033;">-i</span> eth0:<span style="color: #000000;">1</span> host 123.123.123.1</div></div>
]]></content:encoded>
			<wfw:commentRss>http://itblog.su/how-to-kill-tcp-connection-in-centos.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Добавляем диапазон ip адресов.</title>
		<link>http://itblog.su/dobavlyaem-diapazon-ip-adresov.html</link>
		<comments>http://itblog.su/dobavlyaem-diapazon-ip-adresov.html#comments</comments>
		<pubDate>Sun, 24 Aug 2008 14:46:20 +0000</pubDate>
		<dc:creator>Артур Шакиров</dc:creator>
				<category><![CDATA[CentOS Linux]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://itblog.su/?p=185</guid>
		<description><![CDATA[Без лишних слов привожу листинги, однозначно работает это в Red Hat, Fedora Core ну и в CentOS на примере которого и буду показывать. &#91;root@dev2 ~&#93;# cat /etc/sysconfig/network-scripts/ifcfg-eth0:0 # VIA Technologies, Inc. VT6105 [Rhine-III] DEVICE=eth0:0 HWADDR=00:04:23:dc:ef:29 ONBOOT=yes NETMASK=255.255.255.0 IPADDR=192.168.12.222 GATEWAY=192.168.12.100 TYPE=Ethernet &#91;root@dev2 ~&#93;# cat /etc/sysconfig/network-scripts/ifcfg-eth0-range0 IPADDR_START=192.168.12.223 IPADDR_END=192.168.12.230 CLONENUM_START=1 рестартим сеть /etc/init.d/network restart и получаем желаемое: &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Без лишних слов привожу листинги, однозначно работает это в Red Hat, Fedora Core ну и в CentOS на примере которого и буду показывать.</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>dev2 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cat /etc/sysconfig/network-scripts/ifcfg-eth0:0</span><br />
<span style="color: #666666; font-style: italic;"># VIA Technologies, Inc. VT6105 [Rhine-III]</span><br />
<span style="color: #007800;">DEVICE</span>=eth0:<span style="color: #000000;">0</span><br />
<span style="color: #007800;">HWADDR</span>=00:04:<span style="color: #000000;">23</span>:dc:ef:<span style="color: #000000;">29</span><br />
<span style="color: #007800;">ONBOOT</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span><br />
<span style="color: #007800;">NETMASK</span>=255.255.255.0<br />
<span style="color: #007800;">IPADDR</span>=192.168.12.222<br />
<span style="color: #007800;">GATEWAY</span>=192.168.12.100<br />
<span style="color: #007800;">TYPE</span>=Ethernet</div></div>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>dev2 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cat /etc/sysconfig/network-scripts/ifcfg-eth0-range0</span><br />
<span style="color: #007800;">IPADDR_START</span>=192.168.12.223<br />
<span style="color: #007800;">IPADDR_END</span>=192.168.12.230<br />
<span style="color: #007800;">CLONENUM_START</span>=<span style="color: #000000;">1</span></div></div>
<p>рестартим сеть /etc/init.d/network restart</p>
<p>и получаем желаемое:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; inet 192.168.12.200<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global eth0<br />
&nbsp; &nbsp; inet 192.168.12.222<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global secondary eth0:<span style="color: #000000;">0</span><br />
&nbsp; &nbsp; inet 192.168.12.223<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global secondary eth0:<span style="color: #000000;">1</span><br />
&nbsp; &nbsp; inet 192.168.12.224<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global secondary eth0:<span style="color: #000000;">2</span><br />
&nbsp; &nbsp; inet 192.168.12.225<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global secondary eth0:<span style="color: #000000;">3</span><br />
&nbsp; &nbsp; inet 192.168.12.226<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global secondary eth0:<span style="color: #000000;">4</span><br />
&nbsp; &nbsp; inet 192.168.12.227<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global secondary eth0:<span style="color: #000000;">5</span><br />
&nbsp; &nbsp; inet 192.168.12.228<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global secondary eth0:<span style="color: #000000;">6</span><br />
&nbsp; &nbsp; inet 192.168.12.229<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global secondary eth0:<span style="color: #000000;">7</span><br />
&nbsp; &nbsp; inet 192.168.12.230<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> brd 192.168.12.255 scope global secondary eth0:<span style="color: #000000;">8</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://itblog.su/dobavlyaem-diapazon-ip-adresov.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Включаем IP Forwarding в Linux</title>
		<link>http://itblog.su/vklyuchaem-ip-forwarding-v-linux.html</link>
		<comments>http://itblog.su/vklyuchaem-ip-forwarding-v-linux.html#comments</comments>
		<pubDate>Sat, 23 Aug 2008 10:26:06 +0000</pubDate>
		<dc:creator>Артур Шакиров</dc:creator>
				<category><![CDATA[CentOS Linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://itblog.su/?p=182</guid>
		<description><![CDATA[По умолчанию в большинстве дистрибутивов IP Forwarding выключен, но форвардинг может понадобится если на сервере будет подниматься VPN или например это будет роутер. Проверить включен ли IP Forwarding можно так: sysctl net.ipv4.ip_forward cat /proc/sys/net/ipv4/ip_forward Включить можно так (действовать будет до перезагрузки): sysctl -w net.ipv4.ip_forward=1 или echo 1 &#62; /proc/sys/net/ipv4/ip_forward Или жётско включить (действовать будет и [...]]]></description>
			<content:encoded><![CDATA[<p>По умолчанию в большинстве дистрибутивов IP Forwarding выключен, но форвардинг может понадобится если на сервере будет подниматься VPN или например это будет роутер. </p>
<p>Проверить включен ли IP Forwarding можно так:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sysctl net.ipv4.ip_forward<br />
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>ip_forward</div></div>
<p>Включить можно так (действовать будет до перезагрузки):</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sysctl <span style="color: #660033;">-w</span> net.ipv4.ip_forward=<span style="color: #000000;">1</span><br />
или<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>ip_forward</div></div>
<p>Или жётско включить (действовать будет и после перезагрузки):</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># grep forward /etc/sysctl.conf</span><br />
net.ipv4.ip_forward = <span style="color: #000000;">1</span></div></div>
<p>В RedHat подобных:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># grep -i forward /etc/sysconfig/network</span><br />
<span style="color: #007800;">FORWARD_IPV4</span>=<span style="color: #c20cb9; font-weight: bold;">true</span></div></div>
<p>в Debian (Ubuntu):</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># grep -i forward /etc/network/options</span><br />
<span style="color: #007800;">ip_forward</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span></div></div>
<p>После правки конфигов (перманентное включение) необходимо перезапустить сеть. например, /etc/init.d/network restart</p>
<p>Note that: В OpenVPN используется первый способ (изменение на лету), это прописано в стартап скриптах.</p>
]]></content:encoded>
			<wfw:commentRss>http://itblog.su/vklyuchaem-ip-forwarding-v-linux.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>iptables start fails</title>
		<link>http://itblog.su/iptables-start-fails.html</link>
		<comments>http://itblog.su/iptables-start-fails.html#comments</comments>
		<pubDate>Thu, 19 Jun 2008 14:16:37 +0000</pubDate>
		<dc:creator>Артур Шакиров</dc:creator>
				<category><![CDATA[networking]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://itblog.su/?p=134</guid>
		<description><![CDATA[Linux rhca.ru 2.6.9-freevps-1.5-8smp #1 SMP Thu May 25 10:22:13 EEST 2006 x86_64 x86_64 x86_64 GNU/Linux При запуске /etc/init.d/iptables start получаем ошибку: Unloading iptables modules: [FAILED] Открываем для правки стартап скрипт /etc/init.d/iptables и строку: &#160;modprobe -r $mod &#62; /dev/null 2&#62;&#38;1 заменим на: &#160;modprobe -r $mod делаем /etc/init.d/iptables start и любуемся ошибками: Unloading iptables modules: FATAL: Could [...]]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Linux rhca.ru 2.6.9-freevps-<span style="color: #000000;">1.5</span>-8smp <span style="color: #666666; font-style: italic;">#1 SMP Thu May 25 10:22:13 EEST 2006 x86_64 x86_64 x86_64 GNU/Linux</span></div></div>
<p>При запуске /etc/init.d/iptables start получаем ошибку:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Unloading iptables modules: [FAILED]</div></div>
<p>Открываем для правки стартап скрипт /etc/init.d/iptables и строку:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;modprobe <span style="color: #660033;">-r</span> <span style="color: #007800;">$mod</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span></div></div>
<p>заменим на:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;modprobe <span style="color: #660033;">-r</span> <span style="color: #007800;">$mod</span></div></div>
<p>делаем /etc/init.d/iptables start и любуемся ошибками:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Unloading iptables modules: FATAL: Could not load <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>2.6.9-freevps-<span style="color: #000000;">1.5</span>-8smp<span style="color: #000000; font-weight: bold;">/</span>modules.dep: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory</div></div>
<p>лезем в /etc/sysconfig/iptables-config и правим строчку так:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">IPTABLES_MODULES_UNLOAD</span>=<span style="color: #ff0000;">&quot;no&quot;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://itblog.su/iptables-start-fails.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Полезные настройки для verlihub</title>
		<link>http://itblog.su/poleznye-nastrojjki-dlya-verlihub.html</link>
		<comments>http://itblog.su/poleznye-nastrojjki-dlya-verlihub.html#comments</comments>
		<pubDate>Mon, 26 May 2008 19:06:58 +0000</pubDate>
		<dc:creator>Артур Шакиров</dc:creator>
				<category><![CDATA[networking]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[df]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Verlihub]]></category>

		<guid isPermaLink="false">http://itblog.su/poleznye-nastrojjki-dlya-verlihub.html</guid>
		<description><![CDATA[Блокировка за рекламу хабов !addforbid dchub:// -f 1 -C 2 -r &#34;реклама_ban_1y&#34; Антиспам: !addforbid &#34;(?&#60;![кК][иИ])[пП]+[иИеЕeE]+[дД]+[оОoO0eEеЕaAаА]+[pPрР]&#34; -r &#34;_BAN_30m мат&#34; !addforbid &#34;[пП][иИеЕeEёЁ]+[зЗ3cCсС]+[дД]&#34; -r &#34;_BAN_30m мат&#34; !addforbid &#34;[зЗ3][aAаА]+[eEеЕёЁ]+[бБ6]&#34; -r &#34;_BAN_30m мат&#34; !addforbid &#34;^[eEеЕёЁ]+[бБ6]+$&#34; -r &#34;_BAN_30m мат&#34; !addforbid &#34;\s[eEеЕёЁ]+[бБ6]+$&#34; -r &#34;_BAN_30m мат&#34; !addforbid &#34;^[eEеЕёЁ]+[бБ6]+[\s\.\,\!]&#34; -r &#34;_BAN_30m мат&#34; !addforbid &#34;\s[eEеЕёЁ]+[бБ6]+[\s\.\,\!]&#34; -r &#34;_BAN_30m мат&#34; !addforbid &#34;(?&#60;![лЛ][оО]&#124;[лЛтТ][иИ]&#124;[сСлЛ][уУ]&#124;[рР][аА]&#124;[тТ][рР][иИ]&#124;[сС][иИ])[хХxX]+[yYуУ]+[йЙеЕeEёЁяЯюЮиИ]&#34; -r &#34;_BAN_30m мат&#34; !addforbid &#34;(?&#60;![тТ]&#124;[лЛ]&#124;[дД]&#124;[рР])[eEеЕёЁ]+[бБ6]+[aAаА]+[нНHpPрРтТTлЛ]&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Блокировка за рекламу хабов</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">!</span>addforbid dchub:<span style="color: #000000; font-weight: bold;">//</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-C</span> <span style="color: #000000;">2</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;реклама_ban_1y&quot;</span></div></div>
<p>Антиспам:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:700px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;(?&lt;![кК][иИ])[пП]+[иИеЕeE]+[дД]+[оОoO0eEеЕaAаА]+[pPрР]&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;[пП][иИеЕeEёЁ]+[зЗ3cCсС]+[дД]&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;[зЗ3][aAаА]+[eEеЕёЁ]+[бБ6]&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;^[eEеЕёЁ]+[бБ6]+$&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;\s[eEеЕёЁ]+[бБ6]+$&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;^[eEеЕёЁ]+[бБ6]+[\s\.\,\!]&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;\s[eEеЕёЁ]+[бБ6]+[\s\.\,\!]&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;(?&lt;![лЛ][оО]|[лЛтТ][иИ]|[сСлЛ][уУ]|[рР][аА]|[тТ][рР][иИ]|[сС][иИ])[хХxX]+[yYуУ]+[йЙеЕeEёЁяЯюЮиИ]&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;(?&lt;![тТ]|[лЛ]|[дД]|[рР])[eEеЕёЁ]+[бБ6]+[aAаА]+[нНHpPрРтТTлЛ]&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;(?&lt;![рРжЖлЛдДсС][оОаАуУ]|[тТгГлЛрР][уУюЮоОеЕ]|[оОаА][рРмМ])[бБ6]+[лЛ]+[яЯ](?![хХшШпП])&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;(?&lt;![кКгГтТсС][тТрР]|[нНмМ]|[оО][лЛ])[eEеЕёЁ]+[бБ]+[лЛ](?![аАиИ][гГзЗ]|[еЕ][дД][нН])&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;(?&lt;![кК][оО][лЛ]|[дД][цЦ]|[бБрРнНдД])[eEеЕёЁ]+[бБ6]+[иИ](?![уУ][сС])&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;\s[eEеЕёЁ]+[бБ6]+[лЛ]+&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span><br />
<span style="color: #000000; font-weight: bold;">!</span>addforbid <span style="color: #ff0000;">&quot;^[eEеЕёЁ]+[бБ6]+[лЛ]+&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;_BAN_30m мат&quot;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://itblog.su/poleznye-nastrojjki-dlya-verlihub.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

