前提・実現したいこと
先ほどVirtual Box
で CentOS
を用いてサーバーを作りました。
固定ipアドレスを取得したかったので、enp0s3
というイーサネットのデバイスを選択し、DHCP
を手動に切り替えてipアドレスを設定しました。
ホストOSのipアドレスのホスト部が4
だったので、CentOS
のホスト部は5
にして設定を完了しました。
その後、ホストOSから仮想サーバーを起動させるためにコマンドプロンプトでログインしようとしたところconnection out
と表示され失敗したため、CentOS
の方でip a
と入力しIPアドレスを確認したところenp0s8
という設定した覚えのないデバイスが現れ、そのデバイスのIPアドレスのホスト部は12
でした。
(ちなみにenp0s3
の方には設定したはずのIPアドレスが表示されていませんでした。)
そのホスト部が12
のIPアドレスでログインしたところ、成功しました。
私が手動でIPアドレスを設定したデバイスはenp0s3
という名前だったので、なぜenp0s8
という別のデバイスが現れて、しかもそのデバイスのIPアドレスでないとログインできないのかがわかりません。
調べたところ、virtual Box
のネットワークアダプタ2にホストオンリーアダプタを設定した場合にenp0s8
が出現するらしいのですが、アダプタ2にはホストオンリーではなくブリッジアダプターを設定しています。
何故enp0s8
というデバイスが出現したのか、何故そのデバイスのIPアドレスでないとログインできないのか原因を教えていただきたいです。
追記
sh
[root@centos ~]# systemctl status NetworkManager.service --no-pager NetworkManager.service - Network Manager Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled; vendor preset: enabled) Active: active (running) since 土 2022-02-26 21:35:47 JST; 26min ago Docs: man:NetworkManager(8) Main PID: 1026 (NetworkManager) CGroup: /system.slice/NetworkManager.service ├─1026 /usr/sbin/NetworkManager --no-daemon └─1813 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp0s8.pid -lf /var/lib/... 2月 26 22:00:59 centos.renhome.com NetworkManager[1026]: <info> [1645880459.0590] device (enp0s3): state chang...ed') 2月 26 22:00:59 centos.renhome.com NetworkManager[1026]: <info> [1645880459.0711] audit: op="device-disconnect...ess" 2月 26 22:00:59 centos.renhome.com NetworkManager[1026]: <info> [1645880459.0712] device (enp0s3): state chang...ed') 2月 26 22:00:59 centos.renhome.com dhclient[1823]: XMT: Info-Request on enp0s8, interval 6940ms. 2月 26 22:01:06 centos.renhome.com dhclient[1823]: XMT: Info-Request on enp0s8, interval 14470ms. 2月 26 22:01:20 centos.renhome.com dhclient[1823]: XMT: Info-Request on enp0s8, interval 29750ms. 2月 26 22:01:37 centos.renhome.com NetworkManager[1026]: <warn> [1645880497.0382] dhcp6 (enp0s8): request timed out 2月 26 22:01:37 centos.renhome.com NetworkManager[1026]: <info> [1645880497.0393] dhcp6 (enp0s8): state change...eout 2月 26 22:01:37 centos.renhome.com NetworkManager[1026]: <info> [1645880497.0442] dhcp6 (enp0s8): canceled DHC...1823 2月 26 22:01:37 centos.renhome.com NetworkManager[1026]: <info> [1645880497.0442] dhcp6 (enp0s8): state change...done Hint: Some lines were ellipsized, use -l to show in full.
sh
[root@centos ~]# nmcli device status DEVICE TYPE STATE CONNECTION enp0s8 ethernet 接続済み enp0s8 enp0s3 ethernet 接続済み enp0s3 lo loopback 管理無し --
↑こちらはenp0s8でログインした後ifup enp0s3
で接続しました。
(enp0s8を切断し、接続をenp0s3のみにしてsshしてもログインできない)
sh
[root@centos ~]# nmcli connection show NAME UUID TYPE DEVICE enp0s8 911a062e-1bcd-4c93-9c12-3a0ac3a3213c ethernet enp0s8 enp0s3 ff45e772-2c14-4602-89d8-32c0aa7c936b ethernet enp0s3
sh
[root@centos ~]# nmcli connection show enp0s3 connection.id: enp0s3 connection.uuid: ff45e772-2c14-4602-89d8-32c0aa7c936b connection.stable-id: -- connection.type: 802-3-ethernet connection.interface-name: enp0s3 connection.autoconnect: はい connection.autoconnect-priority: 0 connection.autoconnect-retries: -1 (default) connection.multi-connect: 0 (default) connection.auth-retries: -1 connection.timestamp: 1645882576 connection.read-only: いいえ connection.permissions: -- connection.zone: -- connection.master: -- connection.slave-type: -- connection.autoconnect-slaves: -1 (default) connection.secondaries: -- connection.gateway-ping-timeout: 0 connection.metered: 不明 connection.lldp: default connection.mdns: -1 (default) connection.llmnr: -1 (default) 802-3-ethernet.port: -- 802-3-ethernet.speed: 0 802-3-ethernet.duplex: -- 802-3-ethernet.auto-negotiate: いいえ 802-3-ethernet.mac-address: -- 802-3-ethernet.cloned-mac-address: -- 802-3-ethernet.generate-mac-address-mask:-- 802-3-ethernet.mac-address-blacklist: -- 802-3-ethernet.mtu: 自動 802-3-ethernet.s390-subchannels: -- 802-3-ethernet.s390-nettype: -- 802-3-ethernet.s390-options: -- 802-3-ethernet.wake-on-lan: default 802-3-ethernet.wake-on-lan-password: -- ipv4.method: manual ipv4.dns: 192.168.3.1 ipv4.dns-search: -- ipv4.dns-options: "" ipv4.dns-priority: 0 ipv4.addresses: 192.168.3.5/24 ipv4.gateway: 192.168.3.1 ipv4.routes: -- ipv4.route-metric: -1 ipv4.route-table: 0 (unspec) ipv4.routing-rules: -- ipv4.ignore-auto-routes: いいえ ipv4.ignore-auto-dns: いいえ ipv4.dhcp-client-id: -- ipv4.dhcp-timeout: 0 (default) ipv4.dhcp-send-hostname: はい ipv4.dhcp-hostname: -- ipv4.dhcp-fqdn: -- ipv4.never-default: いいえ ipv4.may-fail: はい ipv4.dad-timeout: -1 (default) ipv6.method: auto ipv6.dns: -- ipv6.dns-search: -- ipv6.dns-options: "" ipv6.dns-priority: 0 ipv6.addresses: -- ipv6.gateway: -- ipv6.routes: -- ipv6.route-metric: -1 ipv6.route-table: 0 (unspec) ipv6.routing-rules: -- ipv6.ignore-auto-routes: いいえ ipv6.ignore-auto-dns: いいえ ipv6.never-default: いいえ ipv6.may-fail: はい ipv6.ip6-privacy: -1 (unknown) ipv6.addr-gen-mode: stable-privacy ipv6.dhcp-duid: -- ipv6.dhcp-send-hostname: はい ipv6.dhcp-hostname: -- ipv6.token: -- proxy.method: none proxy.browser-only: いいえ proxy.pac-url: -- proxy.pac-script: --
まだ回答がついていません
会員登録して回答してみよう