如何在Ubuntu Server中配置两个网络适配器?

我有两个网络适配器。 如何在Ubuntu Server中为鱿鱼设置两个适配器?

  • 适配器1(ip = 192.168.2.100子网255.255.255.0默认网关192.168.2.1)
  • 适用于我的网络交换机的适配器2,它连接到我的用户。

如果在Ubuntu 12.04上有两个/两个网络设备存在类似问题,而apt-get无法解析任何远程主机地址,那么我就能接受传入连接。 经过大量的搜索和阅读这篇文章后,我曾经尝试过以上一次并且似乎没有工作。

自从第一次尝试添加网关选项以来我不确定是否进行了其他更改,但是在尝试再次添加网关选项后,我无法连接到我的Webmin接口,该接口已分配/绑定(一个ip / one接口) ),但是能够获得apt-get更新以再次解析域并ping远程主机。

为了再次访问Webmin,我从/etc/network/interfaces文件中用于Webmin接口的网卡中删除了网关选项。

不确定我是否在其他地方有其他错误配置可能导致这种情况发生,但是现在它有效,如果我找到更好的解决方案,我会重新发布。

我的interfaces文件:

  # The loopback network interface auto lo eth1 etho iface lol inet loopback # The Primary network interface iface eth1 inet static address 192.168.0.3 netmask 255.255.255.0 network 192.168.0.0 gateway 192.168.0.1 dns-nameservers xx.xx.xx.xx xx.xx.xx.xx iface eth0 inet static address 192.168.0.4 netmask 255.255.255.0 broadcast 255.255.255.255 network 192.168.0.0 

eth1适用于Apache服务器,板载10/1000 Mb / s eth0是本地ssh,webmin等的附加卡10/100 Mb / s …

它们也按顺序出现。

谢谢!

这很难读,但我想你问过如何设置两张网卡。 这是静态寻址的一些帮助。 编辑interfaces文件并重启网络。 使用您喜欢的文本编辑器…

 sudo vim /etc/network/interfaces 

以及文件的内容:

 auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.2.100 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.2.255 gateway 192.168.2.1 auto eth1 iface eth1 inet static address 192.168.2.99 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.2.255 gateway 192.168.2.1 

保存并重新启动网络:

 sudo /etc/init.d/networking stop sudo /etc/init.d/networking start 

对于ubuntu 16.04 LTS服务器:两步

  1. 假设eno1是您的主要网络接口,也可以访问Internet,请通过“sudo nano / etc / network / interfaces”将您的interfaces文件更新为以下内容(将IP地址更改为您的第二个网络IP地址):

来源/etc/network/interfaces.d/*

 auto lo iface lo inet loopback auto eno1 iface eno1 inet dhcp auto enp2s0 iface enp2s0 inet static address 192.167.0.150 netmask 255.255.255.0 dns-nameservers 8.8.8.8 8.8.4.4 
  1. sudo重启