找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9607|回复: 0

CentOS开放80、22、3306端口操作

[复制链接]
发表于 2014-12-13 14:37:31 | 显示全部楼层 |阅读模式
开放80、22、3306端口操作iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/ Z8 p* A1 c% _+ q5 s. Diptables -I INPUT -p tcp --dport 22 -j ACCEPT
$ R/ H, Z, N6 r1 Aiptables -I INPUT -p tcp --dport 3306 -j ACCEPT
. }+ f1 k1 v- d: \5 \+ {2 M% ]然后保存:& y3 c% _! J- G: N8 ?& l' f
/etc/rc.d/init.d/iptables save$ C5 e$ H9 ]6 j% l+ ]9 n% S3 A: w
% f6 X& r2 E$ U( K
查看打开的端口:
5 w3 ]1 s  B& z( e) V* B/etc/init.d/iptables status
5 ?- R3 a. @& z3 C( m8 j% \. N) C% {. |/ G
-------------------------------------------------------3 U% S; F$ ^% p5 @; j0 Z3 e, B+ F
补充说明:# B3 ?; H/ U8 a- V" ]

9 O( b6 h9 b, H. @8 Z7 L#关闭防火墙
/ {! W# @2 t" G1 ^+ l/etc/init.d/iptables stop
$ [* i- a( p; a3 G6 Aservice iptables stop # 停止服务. r+ S4 u+ I6 A( N" \$ S9 J
#查看防火墙信息
1 ^" S# `3 B" k' W8 _$ w/etc/init.d/iptables status! k6 A- f0 x) Z7 j. t0 e
- K+ N( K6 @8 c+ L' i
#开放端口:8080$ [9 u, E. \0 m
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT. Q2 o4 P  k, n, _, ^
#重启防火墙以便改动生效或者直接重启系统)
$ h8 ^8 U* B7 \" `/etc/init.d/iptables restart, h; u! K: k& e8 P; {7 t( S
#将更改进行保存
% W, ~/ {8 d: h7 q, {/etc/rc.d/init.d/iptables save
1 t) ^2 [( D4 f' x" K% P* M' p
& p0 _7 j& d! m; i% d0 I另外直接在/etc/sysconfig/iptables中增加一行:
8 k0 O0 ]$ F# a5 X" b-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 8080 -j ACCEPT
2 w5 f) }9 s2 Q0 X- |6 J, O#永久关闭防火墙7 n) o1 S* F3 H
chkconfig –level 35 iptables off
4 b& `( S& D/ e0 M! |7 _& ~5 b" |3 E7 ^. C# `" t
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|第一站论坛 ( 蜀ICP备06004864号-6 )

GMT+8, 2026-2-4 20:16 , Processed in 0.062119 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表