1.概述
由于etcd自身不提供ip白名单功能,当在生产环境运行etcd,且当该etcd简体监听外网时,应该通过ip白名单来允许能够访问的外网ip,拒绝非法的ip访问,从而提高生成环境etcd集群的安全性,这里将使用iptables来实现该功能。
2.iptables使用
在centos中,iptables可以通过服务方式进行运行,使用服务方式运行相对来说更加方便使用,除了可以更加方便控制iptables外,也提供了配置文件方式,更加便于配置添加及管理。
- 安装
yum install iptables-services
- 配置开机自启动
systemctl enable iptables.service
- 修改配置文件
安装iptables后如果默认启动,iptables会将除ssh的其他端口的数据包直接drop掉,这时如果是在有业务的服务器上进行启动的话是会业务产生影响的,解决方法是修改配置文件,将drop配置去掉再启动。
vi /etc/sysconfig/iptables
内容如下,去掉INPUT链中的REJECT
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEP