Skip to content

Instantly share code, notes, and snippets.

@shui
Created June 25, 2018 05:47
Show Gist options
  • Save shui/574cb195bb3f3aff250fac741efed6a5 to your computer and use it in GitHub Desktop.
Save shui/574cb195bb3f3aff250fac741efed6a5 to your computer and use it in GitHub Desktop.
VirtualBox双网卡虚拟机LinuxNAT不能上网

今天解决了一个困扰了我两个多月的问题:VirtualBox安装CentOS时,如果配置了两块网卡(一块NAT和一块Host-Only),无法连接Internet。

linux双网卡默认路由问题

在安装第二块网卡后出现无法上网问题,使用route发现是默认路由出现问题,经过多发查证,才晓得原来linux在加载网卡配置文件的时候是先加载eth0,再加载eht1的,这样,如果eth1设置了gateway项,则会覆盖掉 eth0中的gateway设置,因此解决方法就是删除eth1的gateway设置,文件位置在/etc/sysconfig/networking /devices目录下,删除eth1中的gateway设置。

Ref.:《VirtualBox双网卡虚拟机LinuxNAT不能上网》

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment