使用docker的时候,出现如下的错误,但是无法连接到rancher的master
WARNING: IPv4 forwarding is disabled. Networking will not work.
INFO: Running Agent Registration Process, CATTLE_URL=http://192.168.223.131:8080/v1
INFO: Attempting to connect to: http://192.168.223.131:8080/v1
ERROR: http://192.168.223.131:8080/v1 is not accessible (Connection timed out after 15005 milliseconds)
ERROR: http://192.168.223.131:8080/v1 is not accessible (Connection timed out after 15001 milliseconds)
ERROR: http://192.168.223.131:8080/v1 is not accessible (Connection timed out after 15002 milliseconds)
解决方法
vim /etc/sysctl.conf
或者
vi /usr/lib/sysctl.d/00-system.conf
添加如下代码:
net.ipv4.ip_forward=1
重启network服务
systemctl restart network
查看是否修改成功
sysctl net.ipv4.ip_forward
如果返回为“net.ipv4.ip_forward = 1”则表示成功了 重启容器即可。