<?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; NAT</title>
	<atom:link href="http://www.187299.com/archives/tag/nat/feed" rel="self" type="application/rss+xml" />
	<link>http://www.187299.com</link>
	<description>寻觅生命中的那一片浅草......</description>
	<lastBuildDate>Wed, 16 Nov 2011 11:25:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Fedora 8下的NAT配置</title>
		<link>http://www.187299.com/archives/161</link>
		<comments>http://www.187299.com/archives/161#comments</comments>
		<pubDate>Fri, 11 Jul 2008 05:36:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[NAT]]></category>

		<guid isPermaLink="false">http://www.momati.net/archives/161</guid>
		<description><![CDATA[这个是在物理机环境下做的，系统有两块网卡，eth0用于ADSL拨号，eth1用于连接局域网内的主机，保持eth0,eth1为激活状态。 1、建立拨号连接 按照以下步骤操作： 系统 ---&#62; 管理 ----&#62; 网络 ---... ]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: small;">这个是在物理机环境下做的，系统有两块网卡，eth0用于ADSL拨号，eth1用于连接局域网内的主机，保持eth0,eth1为激活状态。</span></p>
<p><span style="font-size: small;">1、建立拨号连接<br />
按照以下步骤操作：<br />
系统 ---&gt; 管理 ----&gt; 网络 ---&gt; 新建 ---&gt; 添加新设备类型---&gt;选择xDSL 连接，输入用户名和密码，然后点击激活，文件 ---&gt; 保存<br />
此时，系统应该拨号成功并可以上网</span></p>
<p><span style="font-size: small;"><span id="more-161"></span><br />
</span></p>
<p><span style="font-size: small;">2、 修改eth1的IP地址为192.168.2.1，网关为192.168.2.1</span></p>
<p><span style="font-size: small;">3、开启系统的转发功能<br />
# echo 1 &gt; /proc/sys/net/ipv4/ip_forward</span></p>
<p><span style="font-size: small;">以上修改为临时性的，为使系统重启后，转发功能依然生效，需作如下修改</span></p>
<p><span style="font-size: small;"># vi /etc/sysctl.conf<br />
将net.ipv4.ip_forward = 0<br />
修改为 net.ipv4.ip_forward = 1</span></p>
<p><span style="font-size: small;">4、修改防火墙设置<br />
在filter表里接受来自192.168.2.0/24的转发<br />
# iptables -I FORWARD -p ip -s 192.168.2.0/24 -j ACCEPT<br />
伪装192.168.2.0/24网络的IP为拨号链接获得的公网IP<br />
# iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.2.0/24 -j MASQUERADE<br />
保存防火墙的规则<br />
# service iptables save<br />
查看filter表的规则<br />
# iptables -L<br />
查看nat表的规则<br />
# iptables -t nat -L</span></p>
<p><span style="font-size: small;">5、修改局域网计算机IP为192.168.2.123或其他192.168.2.0网段的IP，网关修改为192.168.2.1即可以上网。</span></p>
<p><span style="font-size: small;">6、已知问题<br />
当只有eth0为激活状态时，系统可以正常上网，而当激活了eth1时，系统无法上网，用route命令查看系统路由表，发现默认网关由原来的ADSL获得<br />
的IP转变为eth1的IP地址192.168.2.1<br />
解决办法<br />
查看路由表<br />
# route<br />
删除网关<br />
# route del default gw 192.168.2.1<br />
修改网关为<br />
# route add -net 0.0.0.0 dev ppp0</span></p>
<p><span style="font-size: small;">参考文章：http://www.fengnet.com/showart.asp?art_id=636&amp;cat_id=9</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/161/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

