运行环境
[[email protected] sbin]$ cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core) [[email protected] sbin]$ uname -a Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
成功安装完SVN服务器
[[email protected] sbin]$ netstat -lntup (No info could be read for "-p": geteuid()=1000 but you should be root.) Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN -
服务器端口打开正常。网上查询资料后发现以下原因因此有两种解决方案。
在CentOS7.0中默认使用firewall代替了iptables service。虽然继续保留了iptables命令,但已经仅是名称相同而已。除非手动删除firewall,再安装iptables,否则不能继续使用以前的iptables配置方法。
1)打开firewall的SVN的3690端口。执行以下语句,再重启firewall
[[email protected] sysconfig]# firewall-cmd --permanent --add-port=3690/tcp success [[email protected] sysconfig]# systemctl restart firewalld.service
2)卸载firewall,安装iptables service,再打开SVN的3690端口。
[[email protected] sysconfig]# systemctl stop firewalld.service [[email protected] sysconfig]# systemctl disable firewalld.service rm ‘/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service‘ rm ‘/etc/systemd/system/basic.target.wants/firewalld.service‘ [[email protected] sysconfig]# yum install iptables-services 已加载插件:fastestmirror base | 3.6 kB 00:00:00 Loading mirror speeds from cached hostfile 正在解决依赖关系 --> 正在检查事务 ---> 软件包 iptables-services.x86_64.0.1.4.21-13.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 =============================================================================================================== Package 架构 版本 源 大小 =============================================================================================================== 正在安装: iptables-services x86_64 1.4.21-13.el7 base 49 k 事务概要 =============================================================================================================== 安装 1 软件包 总下载量:49 k 安装大小:23 k Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : iptables-services-1.4.21-13.el7.x86_64 1/1 验证中 : iptables-services-1.4.21-13.el7.x86_64 1/1 已安装: iptables-services.x86_64 0:1.4.21-13.el7 完毕! [[email protected] sysconfig]# systemctl start iptables.service##记住打开iptables才能确定是否打开端口成功。 [[email protected] sysconfig]# cp iptables iptables_bak [[email protected] sysconfig]# ll iptables* -rw-------. 1 root root 550 6月 10 2014 iptables -rw-------. 1 root root 550 3月 16 22:24 iptables_bak -rw-------. 1 root root 1974 3月 16 21:38 iptables-config [[email protected] sysconfig]# vi /etc/sysconfig/iptables [[email protected] sysconfig]# iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 3690 -j ACCEPT ##一次修改 [[email protected] sysconfig]# vim iptables -A INPUT -m tcp -p tcp --dport 3690 -j ACCEPT ##我把这条命令添加的配置文件 [[email protected] sysconfig]# service iptables restart##重启iptables [[email protected] sysconfig]# /sbin/iptables -L -n##查看端口是否打开 参考: 按需要进行配置,切勿关闭防火墙造成安全隐患
时间: 2024-10-13 21:27:59