# 直接修改iptablesvim /etc/sysconfig/iptables
# 直接添加一行
-A INPUT -m state --state NEW -m tcp -p tcp --dport [端口号] -j ACCEPT
# 重启防火墙
/etc/init.d/iptables restart
3、远程端口测试
# ssh测试端口ssh -v -p port username@ip
`参数说明``-v 调试模式(会打印日志).``-p 指定端口``username:远程主机的登录用户``ip:远程主机`
4、多网卡数据转发设置
# 查看服务器IP转发
sysctl net.ipv4.ip_forward
# 0未开启,1开启
--
[root@VM-12-15-centos ~]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward =0
--
# 编辑`/etc/sysctl.conf`文件sudovi /etc/sysctl.conf
# 修改`net.ipv4.ip_forward = 1`
--
# sysctl settings are defined through files in# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.## Vendors settings live in /usr/lib/sysctl.d/.# To override a whole file, create a new file with the same in# /etc/sysctl.d/ and put new settings there. To override# only specific settings, add a file with a lexically later# name in /etc/sysctl.d/ and put new settings there.## For more information, see sysctl.conf(5) and sysctl.d(5).# Controls IP packet forwarding
net.ipv4.ip_forward =1# Controls source route verification"/etc/sysctl.conf" 49L, 1509C
--
# 重启网络service network restart