<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title>Parallels knowledgebase (KB)</title>
<link>http://kb.parallels.com/</link>
<description>Parallels knowledgebase (KB)</description>
<language>en</language>
<copyright>Copyright 2008 Parallels</copyright>
<pubDate>Wed, 10 Sep 2008 00:00:00 +0600</pubDate>
<lastBuildDate>Wed, 10 Sep 2008 00:00:00 +0600</lastBuildDate>
<webMaster>rt-team@parallels.com</webMaster>

<item>
<title><![CDATA[How do I enable firewall in a Container?]]></title>
<link>http://kb.parallels.com/en/746</link>
<description><![CDATA[<div id="article">
	




	<div id="kb" class="kb">
		<div class="article-container">
			<h2 class="title">How do I enable firewall in a Container?</h2>
			<div class="ab-frame"><div class="bl"><div class="br"><div class="tl"><div class="tr"><!-- frame -->
				<div class="articleProperty">
					<div>Article ID: 746&nbsp;</div>
					<div>Last Review: Oct,26 2009</div>
					<tr>
						<td>Author: </td>
						<td>Kolomoets Alexey</td>
					</tr>
					<br/>
					<tr>
						<td>Last updated by: </td>
						<td>Kolomoets Alexey</td>
					</tr>
					<strong>APPLIES TO:</strong>
					<div class="articleApplies">
						<ul>
							<li>Virtuozzo Containers for Linux 4.0</li>
							<li>Virtuozzo for Linux 3.x</li>
						</ul>
					</div>
				</div><!-- articleProperty -->
			</div></div></div></div></div><!-- frame -->

			<div class="article-internal-flag"></div>

			<div id="article-content">
				<div class="article-part">
					<h2>Resolution</h2>
					First of all you should define which <strong>iptables</strong> modules are available for Containers.<br /><br />Edit <span style="font-family: courier new,courier,monospace;">/etc/sysconfig/iptables-config</span> and <span style="font-family: courier new,courier,monospace;">/etc/sysconfig/vz</span> on the hardware node. Add modules you need into <span style="font-family: courier new,courier,monospace;">IPTABLES_MODULES=</span> and <span style="font-family: courier new,courier,monospace;">IPTABLES=</span> lines correspondingly. Please note that all <strong>iptables</strong> modules in<span style="font-family:Courier New;"> /etc/sysconfig/vz</span> file in IPTABLES parameter should be listed in one single line, no linebreaks are allowed in this parameter.<br /><br />For example, typical firewall configuration requires the following modules:<br /><div class="commandline"><code><span style="font-family: courier new,courier,monospace;"><span style="font-family: impact;"><span style="font-family: courier new,courier,monospace;">ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp</span></span></span></code></div><br />The changes will be applied after you load required modules and restart Virtuozzo service (all Containers will be restarted):&nbsp;<span style="font-family: courier new,courier,monospace;"><span style="font-family: impact;"><br /><span style="font-family: courier new,courier,monospace;"><div class="commandline"><code># service vz stop<br /># service iptables restart<br /># service vz start</span></span></span></code></div><span style="font-family: courier new,courier,monospace;"><span style="font-family: impact;"><br /></span></span>Modules you defined will be available for all Containers.  However, you can also define a list of <strong>iptables</strong> modules for each Container using <span style="font-family:Courier New;">--iptables</span> option of <strong>vzctl</strong> utility, e.g.:<p><span style="font-family: courier new,courier,monospace;"><span style="font-family: impact;"><span style="font-family: courier new,courier,monospace;"><div class="commandline"><code> vzctl set 101 </span></span>--iptables ipt_REJECT </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ipt_tos </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ipt_TOS </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ipt_LOG </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ip_conntrack </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ipt_limit </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ipt_multiport </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">iptable_filter </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">iptable_mangle </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ipt_TCPMSS </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ipt_tcpmss </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ipt_ttl </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ipt_length </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ipt_state </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">iptable_nat </span><span style="font-family: courier new,courier,monospace;">--iptables </span><span style="font-family: courier new,courier,monospace;">ip_nat_ftp<span style="font-family: impact;"><span style="font-family: courier new,courier,monospace;">&nbsp;</span><span style="font-family: courier new,courier,monospace;">--save </code></div><br />You will probably need to increase the barrier of <span style="font-family:Courier New;">numiptent</span> parameter in <span style="font-family:Courier New;">/proc/user_beancounters</span> using <strong>vzctl</strong> utility. This parameter limits amount of <strong>iptables</strong> rules which Container owner is allowed to create. For example, this is how you allow to enter 400 <strong>iptables</strong> rules on Container 101:<br /><div class="commandline"><code># vzctl set 101 --numiptent 400 --save</code></div><br /></span></span></span><span style="font-family: impact;"><br /></span></p>
				</div>
				<div class="keywords"><strong>Keywords:</strong> firewall, virtuozzo, iptables modules, filter, kernel, iptables, numiptent</div>
			</div>
		</div><!-- article-container -->


			<br/><br/>

			<div id="SubscriptionLink24Article" class="subscriptionLink2">
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=746&ArticleLanguage=en&Product=&Category="><img src="http://kb.parallels.com/images/mail.png" width="15" height="15" alt="Subscription for changes to this article"></a>
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=746&ArticleLanguage=en&Product=&Category=">Subscription for changes to this article</a>

<script type="text/javascript">

$(document).ready(function() {
	$('#SubscriptionLink24Article a').each(function(){
		$(this).click(function(event) {
			event.preventDefault();
			MainPageContentHide();
			$('#subscription').html('');
			$.get('/Stuff/Subscription', {
													'Type' : 'Article',
													'ArticleID' : '746',
													'ArticleLanguage' : 'en',
													'Product' : '',
													'Category' : ''
												}, function(data) {
																	$('#subscription').html(data);
																	$('#subscription').show();
																	SUBbuildsubmenus_product();
																});
		});
	});
});

</script>

</div>





	</div><!-- kb -->

</div><!-- article -->


]]></description>
<author>Kolomoets Alexey</author>
<guid isPermaLink="false">409 LastUpdated: 2009-10-26 11:11:05</guid>
<pubDate>2008-10-06 09:10:41</pubDate>
</item>
</channel>
</rss>



