ubuntu - 如何在 ubuntu 服务器上设置多个网络接口(interface)。 [RTNETLINK 回答 : File exists]

标签 ubuntu configuration routing gateway ubuntu-server

接口(interface)文件

auto eth0
iface eth0 inet dhcp
        up route add 192.168.11.2 dev eth0
        up route add default gw 192.168.11.2 dev eth0

auto eth1
iface eth1 inet static
        address 10.95.163.14
        netmask 255.255.255.0
        up route add 172.16.0.0/16 via 10.95.163.1 dev eth1

问题
sudo /etc/init.d/networking restart 

RTNETLINK answers: File exists

Failed to bring up eth1.

用法
eth0 is used for internet access
eth1 is used for communicate within 2 internal networks

解决方法 现在我需要使用手动添加路线
sudo ip route add 172.16.0.0/16 via 10.95.163.1 dev eth1

问题
  • 我的配置有问题吗
  • 有没有更好的解决方案
  • 最佳答案

    您应该使用以下方式重新启动每个界面:

    ifdown -v ethX
    ifup -v ethX
    

    这样,您将看到失败的确切命令。

    通过快速阅读您的配置,我可以想象一个问题是您的 DHCP 服务器正在向您发送这些路由之一,然后您尝试再次添加它。

    关于ubuntu - 如何在 ubuntu 服务器上设置多个网络接口(interface)。 [RTNETLINK 回答 : File exists],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25805628/

    相关文章:

    ruby-on-rails - 在 Ubuntu 下无法再创建 rails 应用程序

    configuration - 从 Biztalk BTSNTSvc.exe.config 访问 webreference appSettings

    configuration - 用于应用程序配置的单例

    html - Angular 和 Node JS 中的路由问题 [angular]

    bash -/.profile与/.bashrc在ubuntu14.04上的hadoop变量

    python - Ubuntu 将目录添加到 Python 路径

    c - 使用路由套接字需要安装什么包?

    python - 将 Python3 传递给 virtualenvwrapper 会抛出 ImportError

    hadoop - 毛线错误:无法在任何已配置的本地目录中初始化应用程序日志目录