<?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>梁剑的Blog &#187; 转载 suse  防火墙</title>
	<atom:link href="http://icomes.net/tag/%e8%bd%ac%e8%bd%bd-suse-%e9%98%b2%e7%81%ab%e5%a2%99/feed/" rel="self" type="application/rss+xml" />
	<link>http://icomes.net</link>
	<description>做有趣的事，做有用的人</description>
	<lastBuildDate>Sat, 05 Nov 2011 18:23:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Suse下打开端口的方法</title>
		<link>http://icomes.net/2008/11/17/suse%e4%b8%8b%e6%89%93%e5%bc%80%e7%ab%af%e5%8f%a3%e7%9a%84%e6%96%b9%e6%b3%95/</link>
		<comments>http://icomes.net/2008/11/17/suse%e4%b8%8b%e6%89%93%e5%bc%80%e7%ab%af%e5%8f%a3%e7%9a%84%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 06:13:14 +0000</pubDate>
		<dc:creator>梁剑</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[转载 suse  防火墙]]></category>

		<guid isPermaLink="false">http://tridot.cn/?p=197</guid>
		<description><![CDATA[1.首先查看端口状态，可以使用命令 -&#62;# netstat -an   (若查看某个端口，后面可接端口号) 2.检查服务状态使用chkconfig，如检查SSH， -&#62;# chkconfig sshd 如为off,则需要打开系统服务的端口，可用chkconfig on命令，如打开SSH， -&#62;# chkconfig ssh on service xinetd restart 3.防火墙开放端口: （方法一：） i. 进入 /etc/sysconfig/ 目录，用 vi 命令编辑 SuSEfirewall2 文件， -&#62;# vi SuSEfirewall2 在文件中找到FW_SERVICES_EXT_TCP，在其后面加上服务名或者是服务对应的端口，如SSH, FW_SERVICES_EXT_TCP=”ssh” 或 FW_SERVICES_EXT_TCP=”22&#8243; 保存之后退出。 ii. 重启防火墙，以使配置生效， -&#62;# rcSuEfirewall2 restart （方法二：） i. 进入 /etc/sysconfig/ 目录, 查找 iptables 文件。若不存在，则新建一个名为iptables文件， -&#62;# touch iptables ii. 在iptables文件中添加如下，以便打开端口,如： -A [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="什么是Nginx" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2011%2F02%2F24%2F%25E4%25BB%2580%25E4%25B9%2588%25E6%2598%25AFnginx%2F&from=http%3A%2F%2Ficomes.net%2F2008%2F11%2F17%2Fsuse%25E4%25B8%258B%25E6%2589%2593%25E5%25BC%2580%25E7%25AB%25AF%25E5%258F%25A3%25E7%259A%2584%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15014208.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">什么是Nginx</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="阅读空间的GM脚本" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2009%2F01%2F17%2F%25E9%2598%2585%25E8%25AF%25BB%25E7%25A9%25BA%25E9%2597%25B4%25E7%259A%2584gs%25E8%2584%259A%25E6%259C%25AC%2F&from=http%3A%2F%2Ficomes.net%2F2008%2F11%2F17%2Fsuse%25E4%25B8%258B%25E6%2589%2593%25E5%25BC%2580%25E7%25AB%25AF%25E5%258F%25A3%25E7%259A%2584%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015260.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">阅读空间的GM脚本</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Second Screenshot" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2009%2F09%2F03%2Fsecond-screensho%2F&from=http%3A%2F%2Ficomes.net%2F2008%2F11%2F17%2Fsuse%25E4%25B8%258B%25E6%2589%2593%25E5%25BC%2580%25E7%25AB%25AF%25E5%258F%25A3%25E7%259A%2584%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015227.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Second Screenshot</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Ubuntu 8.04 Server在VMWare中无法启动的解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2008%2F06%2F29%2Fubuntu-804-server%25E5%259C%25A8vmware%25E4%25B8%25AD%25E6%2597%25A0%25E6%25B3%2595%25E5%2590%25AF%25E5%258A%25A8%25E7%259A%2584%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%2F&from=http%3A%2F%2Ficomes.net%2F2008%2F11%2F17%2Fsuse%25E4%25B8%258B%25E6%2589%2593%25E5%25BC%2580%25E7%25AB%25AF%25E5%258F%25A3%25E7%259A%2584%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15017346.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Ubuntu 8.04 Server在VMWare中无法启动的解决办法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<div class="blog_content">
<p>1.首先查看端口状态，可以使用命令<br />
-&gt;# netstat -an   (若查看某个端口，后面可接端口号)</p>
<p>2.检查服务状态使用chkconfig，如检查SSH，<br />
-&gt;# chkconfig sshd</p>
<p>如为off,则需要打开系统服务的端口，可用chkconfig on命令，如打开SSH，<br />
-&gt;# chkconfig ssh on service xinetd restart</p>
<p>3.防火墙开放端口:</p>
<p>（方法一：）</p>
<p>i. 进入 /etc/sysconfig/ 目录，用 vi 命令编辑 SuSEfirewall2 文件，<br />
-&gt;# vi SuSEfirewall2<br />
在文件中找到FW_SERVICES_EXT_TCP，在其后面加上服务名或者是服务对应的端口，如SSH,<br />
FW_SERVICES_EXT_TCP=”ssh” 或 FW_SERVICES_EXT_TCP=”22&#8243;<br />
保存之后退出。</p>
<p>ii. 重启防火墙，以使配置生效，<br />
-&gt;# rcSuEfirewall2 restart</p>
<p>（方法二：）</p>
<p>i. 进入 /etc/sysconfig/ 目录, 查找 iptables 文件。若不存在，则新建一个名为iptables文件，</p>
<p>-&gt;# touch iptables</p>
<p>ii. 在iptables文件中添加如下，以便打开端口,如：</p>
<p>-A RH-Firewall-1-INPUT -p tcp -m state -m tcp &#8211;dport 22 &#8211;state NEW -j ACCEPT<br />
-A RH-Firewall-1-INPUT -p tcp -m state -m tcp &#8211;dport 80 &#8211;state NEW -j ACCEPT</p>
<p>iii. 重起iptalbes服务：service iptables restart  或重启机器。</p>
<p>iptables命令详解：<a href="http://www.diybl.com/course/6_system/linux/Linuxjs/200888/135058.html">http://www.diybl.com/course/6_system/linux/Linuxjs/200888/135058.html</a></p>
<p>（方法三：）</p>
<p>引自：<a href="http://hi.baidu.com/wzj423/blog/item/81e8d2f9525b995d242df23a.html">http://hi.baidu.com/wzj423/blog/item/81e8d2f9525b995d242df23a.html</a> 部分内容</p>
<p>创建/etc/init.d/firewall文件：</p>
<p>vi /etc/init.d/firewall</p>
<p>放到/etc/init.d下的原因是方便自动启动。</p>
<p>脚本如下：</p>
<p>#!/bin/bash<br />
# This program is used to use start my iptables.<br />
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:~/bin<br />
export PATH</p>
<p>case “$1&#8243; in<br />
start)<br />
echo -n “Staring FireWall …”<br />
# /sbin/iptables -P INPUT DROP<br />
/sbin/iptables -P OUTPUT ACCEPT<br />
/sbin/iptables -A INPUT -i lo -j ACCEPT</p>
<p>/sbin/iptables -A INPUT -p tcp -m tcp &#8211;dport 22 -j ACCEPT<br />
/sbin/iptables -A INPUT -p tcp -m tcp &#8211;dport 80 -j ACCEPT<br />
/sbin/iptables -A INPUT -p all -m state &#8211;state ESTABLISHED,RELATED -j ACCEPT<br />
/sbin/iptables -A INPUT -p all -m state &#8211;state INVALID,NEW -j DROP<br />
echo “OK”</p>
<p>;;<br />
stop)<br />
echo -n “Stop FireWall … ”<br />
/sbin/iptables -F<br />
/sbin/iptables -X<br />
/sbin/iptables -Z<br />
echo “OK”<br />
;;<br />
restart)<br />
/etc/init.d/firewall stop<br />
/etc/init.d/firewall start</p>
<p>echo “Restart FireWall OK”<br />
;;<br />
*)<br />
echo “Usage: $0 {start|stop|restart}”<br />
esac</p>
<p>exit 0</p>
<p>如果想新开端口，直接修改start部分即可。</p>
<p>测试firewall是否能正常工作：</p>
<p>/etc/init.d/firewall restart</p>
<p>没有问题。</p>
<p>配置firewall随系统自动启动：</p>
<p>cd /etc/init.d<br />
update-rc.d firewall defaults 01</p>
<p>01表示启动优先级，让系统刚启动时就立即启动防火墙规则，可修改所有的K01为K99，在关机或重启服务器时最后停止防火墙服务。</p>
<p>另：<br />
ubuntu 下开发端口：<a href="http://wiki.ubuntu.org.cn/IptablesHowTo">http://wiki.ubuntu.org.cn/IptablesHowTo</a></div>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Ubunt9.04终于发布了" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2009%2F04%2F06%2Fubunt904%25E7%25BB%2588%25E4%25BA%258E%25E5%258F%2591%25E5%25B8%2583%25E4%25BA%2586%2F&from=http%3A%2F%2Ficomes.net%2F2008%2F11%2F17%2Fsuse%25E4%25B8%258B%25E6%2589%2593%25E5%25BC%2580%25E7%25AB%25AF%25E5%258F%25A3%25E7%259A%2584%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015339.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Ubunt9.04终于发布了</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Second Screenshot" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2009%2F09%2F03%2Fsecond-screensho%2F&from=http%3A%2F%2Ficomes.net%2F2008%2F11%2F17%2Fsuse%25E4%25B8%258B%25E6%2589%2593%25E5%25BC%2580%25E7%25AB%25AF%25E5%258F%25A3%25E7%259A%2584%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015227.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Second Screenshot</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="新主题iBlog2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2009%2F09%2F15%2F%25E6%2596%25B0%25E4%25B8%25BB%25E9%25A2%2598iblog2%2F&from=http%3A%2F%2Ficomes.net%2F2008%2F11%2F17%2Fsuse%25E4%25B8%258B%25E6%2589%2593%25E5%25BC%2580%25E7%25AB%25AF%25E5%258F%25A3%25E7%259A%2584%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15014886.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">新主题iBlog2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Ubuntu 8.04 Server在VMWare中无法启动的解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2008%2F06%2F29%2Fubuntu-804-server%25E5%259C%25A8vmware%25E4%25B8%25AD%25E6%2597%25A0%25E6%25B3%2595%25E5%2590%25AF%25E5%258A%25A8%25E7%259A%2584%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%2F&from=http%3A%2F%2Ficomes.net%2F2008%2F11%2F17%2Fsuse%25E4%25B8%258B%25E6%2589%2593%25E5%25BC%2580%25E7%25AB%25AF%25E5%258F%25A3%25E7%259A%2584%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15017346.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Ubuntu 8.04 Server在VMWare中无法启动的解决办法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://icomes.net/2008/11/17/suse%e4%b8%8b%e6%89%93%e5%bc%80%e7%ab%af%e5%8f%a3%e7%9a%84%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

