コンピュータメモ - VMwareメモ

Linux版

ゲストOSでアンダースコアが入力できない

Linux版のVMWare Serverで、日本語キーボード(106)を利用している場合、ゲストOS上でアンダースコア"_"が入力できないことがある。

ホスト側で以下の通り設定ファイルを修正すると解決する。
/etc/vmware/config に下記の1行を追加
xkeymap.keycode.211 = 0x073

ゲストOSで時計が速く進む

ゲストOSの起動時、カーネルオプション clock=pit(32bit), notsc(64bit) を指定する。

(1.1) ゲストOSが32bit、ブートローダーがliloのとき
/etc/lilo.confを編集する
  • 設定例
image=/boot/vmlinuz
label="linux"
root=/dev/hda1
initrd=/boot/initrd.img
append="resume=/dev/hda6 splash=silent clock=pit"
read-only
編集完了後、/sbin/liloを実行して、変更を反映させる。


(1.2) ゲストOSが32bit、ブートローダーがgrubのとき
/boot/grub/grub.conf あるいは、/boot/grub/menu.lst を編集する。
  • 設定例
title Fedora Core (2.6.9-1.667)
root (hd0,0)
kernel /vmlinuz-2.6.9-1.667 ro root=/dev/hda2 clock=pit

(2.1) ゲストOSが64bit、ブートローダーがliloのとき
/etc/lilo.confを編集する
  • 設定例
image=/boot/vmlinuz
label="linux"
root=/dev/hda1
initrd=/boot/initrd.img
append="resume=/dev/hda6 splash=silent notsc"
read-only

(2.2) ゲストOSが64bit、ブートローダーがgrubのとき
/boot/grub/grub.conf あるいは、/boot/grub/menu.lst を編集する。
  • 設定例
title Fedora Core (2.6.9-1.667)
root (hd0,0)
kernel /vmlinuz-2.6.9-1.667 ro root=/dev/hda2 notsc

ホストOS外からのゲストOSへのアクセス

(1) ゲストOS側のIPアドレスを固定させる。
NAT設定時、ゲストOSはホストOS上のVMwareのDHCPサーバーからIPアドレスを取得するため、VMwareのDHCPサーバー設定ファイルを編集する。
書式は、通常のDHCPサーバーと同様。
(1.1) NAT設定時
DHCPサーバー設定ファイル(/etc/vmware/vmnet8/dhcp/dhcp.conf)を編集。


  • 設定例
#
# Configuration file for ISC 2.0b6pl1 vmnet-dhcpd operating on vmnet8.
#
# This file was automatically generated by the VMware configuration program.
# If you modify it, it will be backed up the next time you run the
# configuration program.
#
# We set domain-name-servers to make some DHCP clients happy
# (dhclient as configued in SuSE, TurboLinux, etc.).
# We also supply a domain name to make pump (Red Hat 6.x) happy.
#
allow unknown-clients;
default-lease-time 1800; # 30 minutes
max-lease-time 7200; # 2 hours

subnet 172.16.68.0 netmask 255.255.255.0 {
 range 172.16.68.128 172.16.68.254;
 option broadcast-address 172.16.68.255;
 option domain-name-servers 172.16.68.2;
 option domain-name "localdomain";
 option routers 172.16.68.2;

 host geo-dev-db {
  hardware ethernet 00:15:60:0F:0D:15;
  fixed-address 172.16.68.128;
 }
}
Macアドレスが"00:15:60:0F:0D:15"であるマシンをホスト名"geo-dev-db"とし、固定IPアドレス"172.16.68.128"に固定している。


(2) NAT構成ファイルの編集
ホストOS上にあるVMware独自のNAT構成ファイル(/etc/vmware/vmnet8/nat/nat.conf)を編集して、ホストOSの特定のポート番号へのアクセスをゲストOSの特定のポート番号へ転送させる。


設定例(インストール時にサンプルが作成されている。サンプルを少し編集するだけで問題ない。)
#configport = 33445

# VMnet device if not specified on command line
device = /dev/vmnet8

# Allow PORT/EPRT FTP commands (they need incoming TCP stream...)
activeFTP = 1

# Allows the source to have any OUI. Turn this one if you change the OUI
# in the MAC address of your virtual machines.
#allowAnyOUI = 1

[udp]
# Timeout in seconds, 0 = no timeout, default = 60; real value might
# be up to 100% longer
timeout = 60

[incomingtcp]
# Use these with care - anyone can enter into your VM through these...

# FTP (both active and passive FTP is always enabled)
# ftp localhost 8887
8887 = 172.16.68.128:21

# WEB (make sure that if you are using named webhosting, names point to
# your host, not to guest... And if you are forwarding port other
# than 80 make sure that your server copes with mismatched port
# number in Host: header)
# lynx http://localhost:8888~~ 8888 = 172.16.68.128:80

# SSH
# ssh -p 8889 root@localhost
8889 = 172.16.68.128:22

[incomingudp]
# UDP port forwarding example
6000 = 172.16.68.128:6001

[incomingtcp]セクションでNATのTCPポート転送を記述している。設定例のファイルでは、
(1) ホスト上のポート番号8887からIPアドレス 172.16.68.128の仮想マシンのポート番号21にパケットが転送される。(21はftpのwell knownポート)
(2) ホスト上のポート番号8888からIPアドレス 172.16.68.128の仮想マシンのポート番号80にパケットが転送される。(80はhttpのwell knownポート)
(3) ホスト上のポート番号8889からIPアドレス 172.16.68.128の仮想マシンのポート番号22にパケットが転送される。(22はsshのwell knownポート)


[incomingudp]セクションでNATのUDPポート転送を記述している。設定例のファイルでは、
ホスト上のポート番号6000からIPアドレス 172.16.68.128の仮想マシンのポート番号22にパケットが転送される。
(Xサーバのトラフィックを転送している)


※ホストOS側でファイアーウォールを使用している場合、必要なポートは通すようにしておくこと