---
title: "centos查看端口占用及开启防火墙端口"
author: "欣水寓言"
date: "2014-07-23T13:35:19Z"
tags: []
categories: ["操作系统"]
slug: "centos"
draft: false
lastmod: "2014-07-23T13:35:19Z"
id: 2095442
url: "https://fableking.iteye.com/blog/2095442"
---

1.查看端口占用情况

```
#netstat -tunlp
```

 2.开启防火墙端口

```
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT 
```

 3.保存防火墙端口开启设置

```
#/etc/rc.d/init.d/iptables save 
```

 4.重启防火墙 

```
#/etc/init.d/iptables restart
```