<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ptman</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ptman"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Ptman"/>
	<updated>2026-06-13T19:26:39Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Source_based_routing&amp;diff=5780</id>
		<title>Source based routing</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Source_based_routing&amp;diff=5780"/>
		<updated>2008-04-16T12:01:05Z</updated>

		<summary type="html">&lt;p&gt;Ptman: Added some info that helped me recently&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sometimes you have more than one router in your network, and want different [[container]]s to use different routers. For that, you need to set up source-based routing on the host system. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# /sbin/ip rule add from $IP table $TBL&lt;br /&gt;
# /sbin/ip route add default dev $ETH via $GW table $TBL&lt;br /&gt;
# /sbin/ip route add $NET dev $ETH table $TBL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
* &amp;lt;code&amp;gt;$IP&amp;lt;/code&amp;gt; is an IP address which should use non-default gateway. You can also use netmask here, e.g. &amp;lt;code&amp;gt;10.9.8.0/24&amp;lt;/code&amp;gt; will mean that all containers with addresses like 10.9.8.x will be routed through the given gateway.&lt;br /&gt;
* &amp;lt;code&amp;gt;$NET&amp;lt;/code&amp;gt; is an IP network which should be routed straight, that is, not through the gateway. E.g. &amp;lt;code&amp;gt;10.9.8.0/24&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;$ETH&amp;lt;/code&amp;gt; is the network interface to route to, e.g. &amp;lt;code&amp;gt;eth0&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;$GW&amp;lt;/code&amp;gt; is a gateway for this IP address.&lt;br /&gt;
* &amp;lt;code&amp;gt;$TBL&amp;lt;/code&amp;gt; is any free table number, I use numbers from 6 upwards. Note that tables 250-255 are usually reserved (see &amp;lt;code&amp;gt;/etc/iproute2/rt_tables&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Note that every new non-standard gateway will require another table number.&lt;br /&gt;
&lt;br /&gt;
For more details on routing rules, see &amp;lt;code&amp;gt;man ip&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* {{Forum|268}}&lt;br /&gt;
* {{Forum|492}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Ptman</name></author>
		
	</entry>
</feed>