<?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>服务器安全维护工作室 &#187; 阿里云VPC配置SNAT</title>
	<atom:link href="https://www.fuwuqiok.com/tag/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fuwuqiok.com</link>
	<description></description>
	<lastBuildDate>Sun, 01 Mar 2020 07:28:40 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.26</generator>
	<item>
		<title>阿里云VPC配置SNAT</title>
		<link>https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat-2/</link>
		<comments>https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat-2/#comments</comments>
		<pubDate>Fri, 10 Mar 2017 14:29:47 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[aliyun服务器代维]]></category>
		<category><![CDATA[linux代维]]></category>
		<category><![CDATA[阿里云VPC配置SNAT]]></category>

		<guid isPermaLink="false">https://www.fuwuqiok.com/?p=3141</guid>
		<description><![CDATA[<p>包括阿里云在内的很多云服务器classcal下都不支持SNAT，有幸拿到了阿里云VPC的测试权限，测试这个虚拟 [&#8230;]</p>
<p><a rel="nofollow" href="https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat-2/">阿里云VPC配置SNAT</a>，首发于<a rel="nofollow" href="https://www.fuwuqiok.com">服务器安全维护工作室</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>包括阿里云在内的很多云服务器classcal下都不支持SNAT，有幸拿到了阿里云VPC的测试权限，测试这个虚拟专用网模式下是支持SNAT的，大概列一下操作过程。<span id="more-498"></span></p>
<div id="crayon-58c254b23fd30056007282" class="crayon-syntax crayon-theme-familiar crayon-font-droid-sans-mono crayon-os-pc print-yes notranslate crayon-wrapped" data-settings=" minimize scroll-mouseover wrap">
<div class="crayon-plain-wrap"></div>
<div class="crayon-main">
<table class="crayon-table">
<tbody>
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content">
<div class="crayon-num" data-line="crayon-58c254b23fd30056007282-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-58c254b23fd30056007282-2">2</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre">
<div id="crayon-58c254b23fd30056007282-1" class="crayon-line">使用一台虚拟路由器，两台虚拟交换机用于连接内网局域网和外网机器所属的局域网，两台<span class="crayon-v">ECS</span><span class="crayon-o">:</span></div>
<div id="crayon-58c254b23fd30056007282-2" class="crayon-line crayon-striped-line">一台纯内网，一台绑定了<span class="crayon-i">EIP</span>作为<span class="crayon-i">NAT</span>网关，如下：</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>&nbsp;</p>
<p><a href="https://www.fuwuqiok.com/wp-content/uploads/2017/03/1.jpg"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2017/03/1.jpg" alt="1" width="674" height="502" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div id="crayon-58c254b23fd48492668838" class="crayon-syntax crayon-theme-familiar crayon-font-droid-sans-mono crayon-os-pc print-yes notranslate crayon-wrapped" data-settings=" minimize scroll-mouseover wrap">
<div class="crayon-plain-wrap"></div>
<div class="crayon-main">
<table class="crayon-table">
<tbody>
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content">
<div class="crayon-num" data-line="crayon-58c254b23fd48492668838-1">1</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre">
<div id="crayon-58c254b23fd48492668838-1" class="crayon-line">在虚拟路由器上配置路由</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>由于为了让内网服务器借助EIP访问公网，所以设置所有目标地址0.0.0.0/0下一跳都转发到绑定了公网IP的ECS实例上。这里的下一跳ECS不支持搜索，有点麻烦。</p>
<div id="crayon-58c254b23fd4f818319969" class="crayon-syntax crayon-theme-familiar crayon-font-droid-sans-mono crayon-os-pc print-yes notranslate crayon-wrapped" data-settings=" minimize scroll-mouseover wrap">
<div class="crayon-main">
<table class="crayon-table">
<tbody>
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content">
<div class="crayon-num" data-line="crayon-58c254b23fd4f818319969-1">1</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre">
<div id="crayon-58c254b23fd4f818319969-1" class="crayon-line">配置好之后，登陆外网机器配置<span class="crayon-v">SNAT</span></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="highlighter_374006" class="syntaxhighlighter  ">
<div class="lines">
<div class="line alt1">
<table>
<tbody>
<tr>
<td class="number"><code>1</code></td>
<td class="content"><code class="plain">iptables -t nat -I POSTROUTING -s 172.16.3.0/24 -j SNAT --to-</code><code class="functions">source</code> <code class="plain">172.16.1.2</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>其中3网段是内网局域网的网段，172.16.1.2是绑定了EIP的ECS自身IP，以便完成源地址转换</p>
<p><a href="https://www.fuwuqiok.com/wp-content/uploads/2017/03/31.jpg"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2017/03/31.jpg" alt="31" width="817" height="167" /></a></p>
<p>&nbsp;</p>
<div id="crayon-58c254b23fd56142569123" class="crayon-syntax crayon-theme-familiar crayon-font-droid-sans-mono crayon-os-pc print-yes notranslate crayon-wrapped" data-settings=" minimize scroll-mouseover wrap">
<div class="crayon-plain-wrap"></div>
<div class="crayon-main">
<table class="crayon-table">
<tbody>
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content">
<div class="crayon-num" data-line="crayon-58c254b23fd56142569123-1">1</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre">
<div id="crayon-58c254b23fd56142569123-1" class="crayon-line">然后修改内核参数允许<span class="crayon-i">IP</span>转发：</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="highlighter_29457" class="syntaxhighlighter  ">
<div class="lines">
<div class="line alt1">
<table>
<tbody>
<tr>
<td class="number"><code>1</code></td>
<td class="content"><code class="functions">sed</code> <code class="plain">-i </code><code class="string">'s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g'</code><code class="plain">/etc/sysctl.conf;sysctl -p</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>完成后测试，内网服务器已经可以访问外网了: <a href="https://www.fuwuqiok.com/wp-content/uploads/2017/03/5.jpg"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2017/03/5.jpg" alt="5" width="912" height="263" /></a></p>
<div class="wumii-hook">
<div id="wumiiBtnDiv">
<div id="wumiiRecommendBtnDiv"></div>
</div>
</div>
<p><a rel="nofollow" href="https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat-2/">阿里云VPC配置SNAT</a>，首发于<a rel="nofollow" href="https://www.fuwuqiok.com">服务器安全维护工作室</a>。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>阿里云VPC配置SNAT</title>
		<link>https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat/</link>
		<comments>https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat/#comments</comments>
		<pubDate>Mon, 14 Mar 2016 14:37:03 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[aliyun服务器代维]]></category>
		<category><![CDATA[代维]]></category>
		<category><![CDATA[服务器代维]]></category>
		<category><![CDATA[网站代维]]></category>
		<category><![CDATA[阿里云VPC配置SNAT]]></category>

		<guid isPermaLink="false">https://www.fuwuqiok.com/?p=3088</guid>
		<description><![CDATA[<p>包括阿里云在内的很多云服务器classcal下都不支持SNAT，有幸拿到了阿里云VPC的测试权限，测试这个虚拟 [&#8230;]</p>
<p><a rel="nofollow" href="https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat/">阿里云VPC配置SNAT</a>，首发于<a rel="nofollow" href="https://www.fuwuqiok.com">服务器安全维护工作室</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>包括阿里云在内的很多云服务器classcal下都不支持SNAT，有幸拿到了阿里云VPC的测试权限，测试这个虚拟专用网模式下是支持SNAT的，大概列一下操作过程。<span id="more-498"></span></p>
<div id="crayon-56e6bf780eee8884510290" class="crayon-syntax crayon-theme-familiar crayon-font-droid-sans-mono crayon-os-pc print-yes notranslate crayon-wrapped" data-settings=" minimize scroll-mouseover wrap">
<div class="crayon-plain-wrap"></div>
<div class="crayon-main">
<table class="crayon-table">
<tbody>
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content">
<div class="crayon-num" data-line="crayon-56e6bf780eee8884510290-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-56e6bf780eee8884510290-2">2</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre">
<div id="crayon-56e6bf780eee8884510290-1" class="crayon-line">使用一台虚拟路由器，两台虚拟交换机用于连接内网局域网和外网机器所属的局域网，两台<span class="crayon-v">ECS</span><span class="crayon-o">:</span></div>
<div id="crayon-56e6bf780eee8884510290-2" class="crayon-line crayon-striped-line">一台纯内网，一台绑定了<span class="crayon-i">EIP</span>作为<span class="crayon-i">NAT</span>网关，如下：</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>&nbsp;</p>
<p><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/03/11.jpg"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/03/11.jpg" alt="11" width="674" height="502" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div id="crayon-56e6bf780eef9637743723" class="crayon-syntax crayon-theme-familiar crayon-font-droid-sans-mono crayon-os-pc print-yes notranslate crayon-wrapped" data-settings=" minimize scroll-mouseover wrap">
<div class="crayon-plain-wrap"></div>
<div class="crayon-main">
<table class="crayon-table">
<tbody>
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content">
<div class="crayon-num" data-line="crayon-56e6bf780eef9637743723-1">1</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre">
<div id="crayon-56e6bf780eef9637743723-1" class="crayon-line">在虚拟路由器上配置路由</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>由于为了让内网服务器借助EIP访问公网，所以设置所有目标地址0.0.0.0/0下一跳都转发到绑定了公网IP的ECS实例上。这里的下一跳ECS不支持搜索，有点麻烦。</p>
<p><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/03/%EF%BC%92.jpg"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/03/%EF%BC%92.jpg" alt="%EF%BC%92" width="264" height="234" /></a></p>
<p>&nbsp;</p>
<div id="crayon-56e6bf780eeff662866795" class="crayon-syntax crayon-theme-familiar crayon-font-droid-sans-mono crayon-os-pc print-yes notranslate crayon-wrapped" data-settings=" minimize scroll-mouseover wrap">
<div class="crayon-plain-wrap"></div>
<div class="crayon-main">
<table class="crayon-table">
<tbody>
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content">
<div class="crayon-num" data-line="crayon-56e6bf780eeff662866795-1">1</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre">
<div id="crayon-56e6bf780eeff662866795-1" class="crayon-line">配置好之后，登陆外网机器配置<span class="crayon-v">SNAT</span></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="highlighter_631315" class="syntaxhighlighter  ">
<div class="lines">
<div class="line alt1">
<table>
<tbody>
<tr>
<td class="number"><code>1</code></td>
<td class="content"><code class="plain">iptables -t nat -I POSTROUTING -s 172.16.3.0/24 -j SNAT --to-</code><code class="functions">source</code> <code class="plain">172.16.1.2</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>其中3网段是内网局域网的网段，172.16.1.2是绑定了EIP的ECS自身IP，以便完成源地址转换</p>
<p><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/03/31.jpg"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/03/31.jpg" alt="31" width="817" height="167" /></a></p>
<p>&nbsp;</p>
<div id="crayon-56e6bf780ef06824747418" class="crayon-syntax crayon-theme-familiar crayon-font-droid-sans-mono crayon-os-pc print-yes notranslate crayon-wrapped" data-settings=" minimize scroll-mouseover wrap">
<div class="crayon-plain-wrap"></div>
<div class="crayon-main">
<table class="crayon-table">
<tbody>
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content">
<div class="crayon-num" data-line="crayon-56e6bf780ef06824747418-1">1</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre">
<div id="crayon-56e6bf780ef06824747418-1" class="crayon-line">然后修改内核参数允许<span class="crayon-i">IP</span>转发：</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="highlighter_17521" class="syntaxhighlighter  ">
<div class="lines">
<div class="line alt1">
<table>
<tbody>
<tr>
<td class="number"><code>1</code></td>
<td class="content"><code class="functions">sed</code> <code class="plain">-i </code><code class="string">'s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g'</code> <code class="plain">/etc/sysctl.conf;sysctl -p</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>完成后测试，内网服务器已经可以访问外网了: <a href="https://www.fuwuqiok.com/wp-content/uploads/2016/03/51.jpg"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/03/51.jpg" alt="51" width="912" height="263" /></a></p>
<p><a rel="nofollow" href="https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat/">阿里云VPC配置SNAT</a>，首发于<a rel="nofollow" href="https://www.fuwuqiok.com">服务器安全维护工作室</a>。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91vpc%e9%85%8d%e7%bd%aesnat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
