netstat
查看端口状况
1
netstat -apn
查看连接数
1
2
3
4// 80端口
netstat -nat|grep -i "80"|wc -l
// 已连接上的
netstat -na|grep ESTABLISHED|wc -l
ufw
(端口管理)
安装
1
sudo apt-get install ufw
开启,默认关闭所有
1
2sudo ufw enable
sudo ufw default deny查看端口状态
1
sudo ufw status
新增端口
1
sudo ufw allow 8080
删除端口
1
sudo ufw delete allow 8080
允许特定来源的访问
1
sudo ufw allow from 192.168.1.1
ssh翻墙
1 | 参考:[实战 SSH 端口转发](http://www.ibm.com/developerworks/cn/linux/l-cn-sshforward/) |