ablog

不器用で落着きのない技術者のメモ

VMware Workstation 7 上のゲストOSからホストOSの外のネットワークに接続する方法

結論としては、ゲストOSの設定がダメダメだっただけでしたw

環境

  • VMware Workstation 7.0.0 build-203739
  • ゲストOS
# cat /etc/issue
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
Kernel \r on an \m

# uname -a
Linux db101 2.6.18-128.el5 #1 SMP Wed Dec 17 11:42:39 EST 2008 i686 i686 i386 GNU/Linux

現象

  • インターネット上のホストに ping が届かない。
# ping www.google.com
ping: unknown host www.google.com
# ping 208.73.210.50
connect: Network is unreachable
  • VMware Workstation の仮想ネットワークの設定は無問題な感じ。


  • ゲストOSのルーティング設定を確認する。
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.233.0   *               255.255.255.0   U     0      0        0 eth1
192.168.153.0   *               255.255.255.0   U     0      0        0 eth0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1

おや、デフォルトゲートウェイがない気が。。。

  • ゲストOSの /etc/resolv.conf を確認する。
# cat /etc/resolv.conf
search ablog.co.jp

だめだこりゃw

対処

VMware Workstation の設定を確認する。
  • [編集]-[仮想ネットワークの設定]-[VMNet8]-[VMnet情報]-[NAT]-[NAT設定]

ゲストOSのネットワーク設定を変更する。
# vi /etc/sysconfig/static-routes 
any net default gw 192.168.153.2
  • /etc/resoflv.conf を設定する。
# cat /etc/resolv.conf 
nameserver 192.168.1.11
  • ネットワークを再起動する。
# service network restart
  • ルーティングテーブルを確認する。
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.233.0   *               255.255.255.0   U     0      0        0 eth1
192.168.153.0   *               255.255.255.0   U     0      0        0 eth0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1
default         192.168.153.2   0.0.0.0         UG    0      0        0 eth0
  • インターネット上のホストに ping が通るか確認する。
# ping www.google.com
PING www.l.google.com (66.249.89.147) 56(84) bytes of data.
64 bytes from nrt04s01-in-f147.1e100.net (66.249.89.147): icmp_seq=1 ttl=128 time=4.94 ms
64 bytes from nrt04s01-in-f147.1e100.net (66.249.89.147): icmp_seq=2 ttl=128 time=2.84 ms
64 bytes from nrt04s01-in-f147.1e100.net (66.249.89.147): icmp_seq=3 ttl=128 time=2.71 ms
...

おk。