---
title: "关闭liunx防火墙操作"
author: "bjameng"
date: "2015-04-30T10:29:53Z"
tags: []
categories: ["操作系统"]
slug: "liunx"
draft: false
lastmod: "2015-04-30T10:29:14Z"
id: 2207475
url: "https://bjameng.iteye.com/blog/2207475"
---

1. 关闭liunx防火墙（不需要重启，立即生效。重启后失效）：
   
   ```
   关闭：service iptables stop
   开启：service iptalbles start
   ```
2. 关闭liunx防火墙（需要重启才能生效，重启系统对此没有影响）
   
   ```
   关闭：chkconfig iptables off
   开启：chkconfig iptables on 
   ```
3. 在防火墙中开启某个端口，在/etc/sysconfig/iptables中加入以下代码
   
   ```
   -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
   ```
   
    注意： 加入以上代码请不要加入到最后行，请加入到22端口号后面即可。