解决VM中配置多网卡多IP只能有一个网卡工作

2020-07-29  本文已影响0人  娄德晶

VM Server 已经配置好了多个网卡,可以连接多个不同的IP段,但是创建的VM如果配置了多个网卡,只能有一个网卡连能ping通。

国内的百度搜了不少的答案根本没有用,Google到了这篇文章解决了我的问题:

https://stackoverflow.com/questions/14583984/multiple-ip-configuration-on-multiple-nic-on-same-server

简略说重点:

1) edit the file "/etc/sysctl.conf"

change the value from 1 to 2 in the following line:

net.ipv4.conf.default.rp_filter = 1

2)Add this line:

net.ipv4.conf.all.rp_filter = 2

After edit, it should look like this:

net.ipv4.conf.default.rp_filter = 2

net.ipv4.conf.all.rp_filter = 2

3)reload the configuration by typing

sysctl -p

Now you should be able to ping both IPs

上一篇 下一篇

猜你喜欢

热点阅读