QEMU Windowsクライアントにはインターネットはありませんが、共有フォルダがあります。

QEMU Windowsクライアントにはインターネットはありませんが、共有フォルダがあります。

qemu/kvm 仮想化スタックで Windows 7 ゲストを実行する Debian システムを設定しています。 Windowsコンピュータは古いソフトウェアを実行していたので、インターネットに接続せずに仮想マシンにインストールすることにしました。ただし、仮想マシンの内外にファイルを移動する必要があります。

ホスト専用ネットワークを設定し、ホストを除くすべての人のアクセスを拒否するようにファイアウォールルールを変更できると聞きました。ただし、ホストシステムにはインターネットへのフルアクセスが必要です。

Linuxでファイアウォールを構成する経験はありません。上記の目標をどのように達成できますか?

ベストアンサー1

これにより、トリックを実行できます。

$ qemu-system-x86_64 -net nic -net user,restrict=on,smb=/path/to/shared/folder ...

~からマンページ:

-netdev user,id=id[,option][,option][,...]
-net user[,option][,option][,...]
    Use the user mode network stack which requires no administrator
    privilege to run. Valid options are:
    ...
    restrict=on|off
        If this option is enabled, the guest will be isolated, i.e. it
        will not be able to contact the host and no guest IP packets
        will be routed over the host to the outside. This option does
        not affect any explicitly set forwarding rules.
    ...              
    smb=dir[,smbserver=addr]
        When using the user mode network stack, activate a built-in SMB
        server so that Windows OSes can access to the host files in dir
        transparently. The IP address of the SMB server can be set to
        addr. By default the 4th IP in the guest network is used, i.e.
        x.x.x.4.
        In the guest Windows OS, the line:
                10.0.2.4 smbserver
        must be added in the file C:\WINDOWS\LMHOSTS (for windows
        9x/Me) or C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS (Windows
        NT/2000).
        Then dir can be accessed in \\smbserver\qemu.
        Note that a SAMBA server must be installed on the host OS.
        QEMU was tested successfully with smbd versions from Red Hat 9,
        Fedora Core 3 and OpenSUSE 11.x.

これを行うには、sambaホストシステムにインストールする必要があります。構成や実行は必要なく、smbdバイナリのみが必要で、権限なしで一時構成で実行されます。

ノート

Windows 7では、コンピュータ - >ネットワークの場所の追加 - >カスタムネットワークの場所の選択 - >\\ 10.0.2.4 \ qemuを介して共有フォルダに接続できます。

Windowsで「インターネットに接続」ウィザードを開くように求められたら、ただ閉じます。 「ネットワーク場所の追加」ウィザードは引き続き実行されているため、タスクバーのアイコンをクリックしてそのウィンドウを再度開くことができます。

おすすめ記事