Mic*_*Mic 17 networking ifconfig interface ethernet
我是 ubuntu 的新手,需要安装 ubuntu xenial 服务器(16.04)版本才能将 MongoDB 安装到 VirtualBox 中。安装后,我尝试从 dhcp 更改为静态 ipv4 地址。所以我改变了 /etc/network/interfaces :
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static
address 192.168.56.5
netmask 255.255.255.0
gateway 192.168.56.1
Run Code Online (Sandbox Code Playgroud)
并重新启动服务器
# but ifconfig -a shows only an enp0s3 interface without any IP address
and
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
up loopback running MTU: ...
Run Code Online (Sandbox Code Playgroud)
(对不起,复制和粘贴不起作用,所以我必须全部输入)
did a reboot once more and tried sudo ifdown and afterwards ifup eth0
# but it gives allways :
Cannot find device "eth0"
Failed to bring up eth0
Run Code Online (Sandbox Code Playgroud)
VirtualBox 网络适配器设置为 Host-only Adapter,我已经在 192,168.56.4 上运行了另一个带有 Debian8 的 VirtualBox。
有没有人对我有帮助?
小智 22
您可以通过以下命令找到网络设备逻辑名称:
sudo lshw -C network
Run Code Online (Sandbox Code Playgroud)
就我而言,我的逻辑网络设备名称是 enp3s0。所以我从eth0
to替换了设备名称enp3s0
,它可以工作。
L. *_*mes 15
您的网络接口是enp0s3
. eth0
用此接口替换条目。
更改自:
自动低速 iface lo inet环回 允许热插拔eth0 iface eth0 inet 静态 地址 192.168.56.5 网络掩码 255.255.255.0 网关 192.168.56.1
改成:
自动低速 iface lo inet环回 允许热插拔enp0s3 iface enp0s3 inet 静态 地址 192.168.56.5 网络掩码 255.255.255.0 网关 192.168.56.1