前提・実現したいこと
先ほど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
1[root@centos ~]# systemctl status NetworkManager.service --no-pager 2 NetworkManager.service - Network Manager 3 Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled; vendor preset: enabled) 4 Active: active (running) since 土 2022-02-26 21:35:47 JST; 26min ago 5 Docs: man:NetworkManager(8) 6 Main PID: 1026 (NetworkManager) 7 CGroup: /system.slice/NetworkManager.service 8 ├─1026 /usr/sbin/NetworkManager --no-daemon 9 └─1813 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp0s8.pid -lf /var/lib/... 10 11 2月 26 22:00:59 centos.renhome.com NetworkManager[1026]: <info> [1645880459.0590] device (enp0s3): state chang...ed') 12 2月 26 22:00:59 centos.renhome.com NetworkManager[1026]: <info> [1645880459.0711] audit: op="device-disconnect...ess" 13 2月 26 22:00:59 centos.renhome.com NetworkManager[1026]: <info> [1645880459.0712] device (enp0s3): state chang...ed') 14 2月 26 22:00:59 centos.renhome.com dhclient[1823]: XMT: Info-Request on enp0s8, interval 6940ms. 15 2月 26 22:01:06 centos.renhome.com dhclient[1823]: XMT: Info-Request on enp0s8, interval 14470ms. 16 2月 26 22:01:20 centos.renhome.com dhclient[1823]: XMT: Info-Request on enp0s8, interval 29750ms. 17 2月 26 22:01:37 centos.renhome.com NetworkManager[1026]: <warn> [1645880497.0382] dhcp6 (enp0s8): request timed out 18 2月 26 22:01:37 centos.renhome.com NetworkManager[1026]: <info> [1645880497.0393] dhcp6 (enp0s8): state change...eout 19 2月 26 22:01:37 centos.renhome.com NetworkManager[1026]: <info> [1645880497.0442] dhcp6 (enp0s8): canceled DHC...1823 20 2月 26 22:01:37 centos.renhome.com NetworkManager[1026]: <info> [1645880497.0442] dhcp6 (enp0s8): state change...done 21Hint: Some lines were ellipsized, use -l to show in full.
sh
1[root@centos ~]# nmcli device status 2DEVICE TYPE STATE CONNECTION 3enp0s8 ethernet 接続済み enp0s8 4enp0s3 ethernet 接続済み enp0s3 5lo loopback 管理無し --
↑こちらはenp0s8でログインした後ifup enp0s3
で接続しました。
(enp0s8を切断し、接続をenp0s3のみにしてsshしてもログインできない)
sh
1[root@centos ~]# nmcli connection show 2NAME UUID TYPE DEVICE 3enp0s8 911a062e-1bcd-4c93-9c12-3a0ac3a3213c ethernet enp0s8 4enp0s3 ff45e772-2c14-4602-89d8-32c0aa7c936b ethernet enp0s3
sh
1[root@centos ~]# nmcli connection show enp0s3 2connection.id: enp0s3 3connection.uuid: ff45e772-2c14-4602-89d8-32c0aa7c936b 4connection.stable-id: -- 5connection.type: 802-3-ethernet 6connection.interface-name: enp0s3 7connection.autoconnect: はい 8connection.autoconnect-priority: 0 9connection.autoconnect-retries: -1 (default) 10connection.multi-connect: 0 (default) 11connection.auth-retries: -1 12connection.timestamp: 1645882576 13connection.read-only: いいえ 14connection.permissions: -- 15connection.zone: -- 16connection.master: -- 17connection.slave-type: -- 18connection.autoconnect-slaves: -1 (default) 19connection.secondaries: -- 20connection.gateway-ping-timeout: 0 21connection.metered: 不明 22connection.lldp: default 23connection.mdns: -1 (default) 24connection.llmnr: -1 (default) 25802-3-ethernet.port: -- 26802-3-ethernet.speed: 0 27802-3-ethernet.duplex: -- 28802-3-ethernet.auto-negotiate: いいえ 29802-3-ethernet.mac-address: -- 30802-3-ethernet.cloned-mac-address: -- 31802-3-ethernet.generate-mac-address-mask:-- 32802-3-ethernet.mac-address-blacklist: -- 33802-3-ethernet.mtu: 自動 34802-3-ethernet.s390-subchannels: -- 35802-3-ethernet.s390-nettype: -- 36802-3-ethernet.s390-options: -- 37802-3-ethernet.wake-on-lan: default 38802-3-ethernet.wake-on-lan-password: -- 39ipv4.method: manual 40ipv4.dns: 192.168.3.1 41ipv4.dns-search: -- 42ipv4.dns-options: "" 43ipv4.dns-priority: 0 44ipv4.addresses: 192.168.3.5/24 45ipv4.gateway: 192.168.3.1 46ipv4.routes: -- 47ipv4.route-metric: -1 48ipv4.route-table: 0 (unspec) 49ipv4.routing-rules: -- 50ipv4.ignore-auto-routes: いいえ 51ipv4.ignore-auto-dns: いいえ 52ipv4.dhcp-client-id: -- 53ipv4.dhcp-timeout: 0 (default) 54ipv4.dhcp-send-hostname: はい 55ipv4.dhcp-hostname: -- 56ipv4.dhcp-fqdn: -- 57ipv4.never-default: いいえ 58ipv4.may-fail: はい 59ipv4.dad-timeout: -1 (default) 60ipv6.method: auto 61ipv6.dns: -- 62ipv6.dns-search: -- 63ipv6.dns-options: "" 64ipv6.dns-priority: 0 65ipv6.addresses: -- 66ipv6.gateway: -- 67ipv6.routes: -- 68ipv6.route-metric: -1 69ipv6.route-table: 0 (unspec) 70ipv6.routing-rules: -- 71ipv6.ignore-auto-routes: いいえ 72ipv6.ignore-auto-dns: いいえ 73ipv6.never-default: いいえ 74ipv6.may-fail: はい 75ipv6.ip6-privacy: -1 (unknown) 76ipv6.addr-gen-mode: stable-privacy 77ipv6.dhcp-duid: -- 78ipv6.dhcp-send-hostname: はい 79ipv6.dhcp-hostname: -- 80ipv6.token: -- 81proxy.method: none 82proxy.browser-only: いいえ 83proxy.pac-url: -- 84proxy.pac-script: --

回答1件
あなたの回答
tips
プレビュー