centos cloud和 裸机均有次问题。
Centos clud and naked machines have a problem.
当centos有2个网卡,eth0是连公网,eth1是连内网,default route应该走eth0,系统启动后不能从公网链接。
When the centos have two web cards, eth0 is connected, eth1 is connected, default route should go eth0 and the system cannot be connected from the public web when it is activated.
原因是default route 配置到eth1了,找原因:
The reason is that it's configured to eth1 for the reason:
/etc/sysconfig/network-scripts/ifcfg-eth0:
/etc/sysconfig/network-scripts/ifcfg-eth1:
虽然有cloudinit 配置默认路由,但是后面还得network service再配置一把,最终改路由的脚本:
Although there is a default route for cludinit configuration, there is a script that will have to be reconfigured from the rest of the network service and eventually rerouted:
network service是按照eth0,eth1 的顺序配置网卡的,配置eth0的时候有DEFROUTE=yes,但是到了配置eth1的时候配置文件ifcfg-eth1里没有指定DEFROUTE,而脚本只判断了变量!="no",其实DEFROUTE这个变量没定义,这个条件也满足,后面也会把default route 替换成从eth1的。
Network service configures the net cards according to the order of eth0, eth1, with DEFROTE=yes at eth0, but the DFROUTE is not specified in the file ifcfg-eth1 at eth1, and the scripts only judge the variables! = "no", whereas the DEFROUTE variable is not defined, and that condition is met, and the latter replaces the default route from eth1.
解决办法很多,一个简单的就是echo "DEFROUTE=no" >> /etc/sysconfig/network-scripts/ifcfg-eth1
There are many solutions, and one simple one is "DEFROUTE=no" & gt; > /etc/sysconfig/network-scripts/ifcfg-eth1
这个还可以写在cloud环境的userdata里。
This can also be written in the userdata of the cloud environment.
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论