VMware, Ubuntu, apt updateができない問題

目的

VMware上にインストールしたUbuntusudo apt updateができなかった. エラーとか、無視とか大量に出てorzって感じ.

解決策

やったことは以下の2点 - プロキシの設定 - DNSの設定

プロキシの設定

bashrc に以下を記入

...
HOST=<ホスト名を入力>
PORT=8080

export http_proxy=http://${HOST}:${PORT}
export https_proxy=https://${HOST}:${PORT}
...

DNSの設定

  1. DNSサーバーのゲートウェイを確認 以下の結果の場合は最後の行の10.0.2.3ゲートウェイとなる
$ sudo systemd-resolve --status
Global
         DNS Servers: 10.0.2.3
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 2 (enp0s3)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 10.0.2.3

2.DNSゲートウェイの設定

$ sudo vim /etc/systemd/resolved.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
DNS=10.0.2.3
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes