Ubuntu 16.04 - インターネットに接続できない

Ubuntu 16.04 - インターネットに接続できない
root@ubuntu:/# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback


# Liveliness Interface
auto ens3
iface ens3 inet static
address 192.0.2.100/24

dns nameservers 8.8.8.8 192.0.2.1 1.1.1.1

Please check /etc/network/interfaces.d before changing this file
# as interfaces may have been defined in /etc/network/interfaces.d
# See LP: #1262951
source /etc/network/interfaces.d/*.cfg

root@ubuntu:/# cat /etc/network/interfaces.d/50-cloud-init.cfg

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback

auto ens3
iface ens3 inet static
 address 192.0.2.100
 netmask 255.255.255.0
 network 192.0.2.0
 broadcast 192.0.2.255
 gateway 192.0.2.1
dns nameservers 8.8.8.8 192.0.2.1

Systemctl がロードされ、ステータスがアクティブです!!

root@ubuntu:~# systemctl status networking.service
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor prese
  Drop-In: /run/systemd/generator/networking.service.d
           └─50-insserv.conf-$network.conf
   Active: active (exited) since Fri 2020-04-03 09:24:56 UTC; 59s ago
     Docs: man:interfaces(5)
  Process: 1485 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=
  Process: 1479 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [
 Main PID: 1485 (code=exited, status=0/SUCCESS)

Apr 03 09:24:56 ubuntu systemd[1]: Starting Raise network interfaces...
Apr 03 09:24:56 ubuntu systemd[1]: Started Raise network interfaces.

インターネットに接続できません

root@ubuntu:/# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3022ms

答え1

アップデート

(実際にはdns nameserversまたは を持つことができるのでdns-nameservers、その部分は重要ではありません)。

systemctl status networking.service重要なのは、ファイルに関する出力のエラーに注意してください/etc/network/interfaces

:に構文エラーがあります/etc/network/interfaces:

これを変える:

source

/etc/network/interfaces.d/*.cfg

これに:

source /etc/network/interfaces.d/*.cfg

そしてサービスを開始します。

関連情報