EDIT The first version of instructions I posted caused conflicts with the nameserver and gateway that VMware put on vmnet8. This version corrects the issue.
Software versions:
- MAC OS X Version 10.6.3
- VMware Fusion Version 3.1.0 (261058)
- Ubuntu 10.04 LTS
What I have done:
During creation of the VM, set networking to NAT.
On Linux Guest: Run ifconfig to get the hardware address
HWaddr
, broadcast addressBcast
, IPv4 internet addressinet addr
, and maskMask
being used.UbuntuGuest$ifconfig eth0 Link encap:Ethernet HWaddr 00:0c:29:53:bf:e5 inet addr:192.168.213.129 Bcast:192.168.213.255 Mask:255.255.255.0 <snip>
On Linux Guest: Lookup the nameserver information
UbuntuGuest$cat /etc/resolv.conf nameserver 192.168.213.2 domain localdomain search localdomain
On Linux Guest: Lookup the gateway address: (Listed in the Gateway column of the line with 0.0.0.0 as Destination.)
UbuntuGuest$route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.213.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.213.2 0.0.0.0 UG 100 0 0 eth0
On OS X Host: Edit the
dhcpd.conf
file forvmnet8
(The NAT virtual switch) to assign a static IP address to the Linux Guest. (Use your editor of choice on the fourth line)OSXHost$cd /Library/Application\ Support/VMware\ Fusion/vmnet8/ OSXHost$sudo chmod u+w dhcpd.conf OSXHost$sudo cp dhcpd.conf dhcpd.conf.bak.20100619 OSXHost$sudo emacs dhcpd.conf
On OS X Host: The file will start out looking something like:
# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8. # # This file was automatically generated by the VMware configuration program. # See Instructions below if you want to modify it. # # We set domain-name-servers to make some DHCP clients happy # (dhclient as configured in SuSE, TurboLinux, etc.). # We also supply a domain name to make pump (Red Hat 6.x) happy. # ###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" ##### # Modification Instructions: This section of the configuration file contains # information generated by the configuration program. Do not modify this # section. # You are free to modify everything else. Also, this section must start # on a new line # This file will get backed up with a different name in the same directory # if this section is edited and you try to configure DHCP again. # Written at: 12/26/2009 10:35:10 allow unknown-clients; default-lease-time 1800; # default is 30 minutes max-lease-time 7200; # default is 2 hours subnet 192.168.213.0 netmask 255.255.255.0 { range 192.168.213.128 192.168.213.254; option broadcast-address 192.168.213.255; option domain-name-servers 192.168.213.2; option domain-name localdomain; default-lease-time 1800; # default is 30 minutes max-lease-time 7200; # default is 2 hours option routers 192.168.213.2; } host vmnet8 { hardware ethernet 00:50:56:C0:00:08; fixed-address 192.168.213.1; option domain-name-servers 0.0.0.0; option domain-name ""; option routers 0.0.0.0; } ####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
Things to note:
The
subnet
section should match the IP information gathered on the Linux Guest. Theinet addr
will be withinrange
,netmask
will matchMask
,option broadcast-address
will matchBcast
,option domain-name-servers
andoption domain-name
will match the information gathered withcat /etc/resolv.conf
andoption routers
will matchGateway
from theroute -n
command.We want to assign a static IP address, so that we can add an entry to the OS X Host's
hosts
file. The address must be within thesubnet
defined. Addresses that are not available to assign are the ones withinrange
in subnet section, the broadcast address, thefixed-address
forhost vmnet8
, the DNS server and the gateway. And I think the address equal to subnet is not allowed. In this example, the subnet is192.168.213.0
So the available addressees are from192.168.213.1 to 192.168.213.255
less192.168.213.128 to 192.168.213.245
(range) less192.168.213.255
(broadcast) less192.168.213.1
(host vmnet8) less192.168.213.2
(gateway and DNS server). The net is that addresses192.168.213.3 to 192.168.213.127
are available.
ON OS X Host: Create a new
host
entry below the DO NOT MODIFY SECTION. This entry will assign a static IP to the Linux Guest.hardware ethernet
needs to matchHWaddr
fromifconfig
on the Linux Guest. Pick an available static address forfixed-address
.option broadcast-address
,option domain-name-servers
,option domain-name
andoption routers
need to match the options given in thesubnet
section ofdhcpd.conf
. (Which we have already matched against information gathered on the Linux Guest.) In this example the host entry is:####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" ####### host serpents-hold { hardware ethernet 00:0c:29:53:bf:e5; fixed-address 192.168.213.3; option broadcast-address 192.168.213.255; option domain-name-servers 192.168.213.2; option domain-name localdomain; option routers 192.168.213.2; }
On OS X Host Save
dhcpd.conf
and close your editor.On OS X Host and all Guests: Shutdown all VMs and VMware.
On OS X Host: Restart the VMware services:
OSXHost$cd /Library/Application\ Support/VMware\ Fusion/ OSXHost$sudo ./boot.sh --restart
On OS X Host: Look in
Activity Monitor
and make sure that two processes each namedvmnet-dhcpd
are running. (One is for thevmnet8
, the NAT network, the other is for the host only network.) If you don't see both, there is probably a problem with thevmnet8/dhcpd.conf
file on the OS X Host. Fix that and repeat the restart of VMware services.On OS X Host: Start VMware and the Linux Guest VM.
On Linux Guest On the guest VM check that settings are as expected:
UbuntuGuest$ifconfig eth0 Link encap:Ethernet HWaddr 00:0c:29:53:bf:e5 inet addr:192.168.213.3 Bcast:192.168.213.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe53:bfe5/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:103 errors:0 dropped:0 overruns:0 frame:0 TX packets:71 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:10961 (10.9 KB) TX bytes:9637 (9.6 KB) lo <snip> UbuntuGuest$cat /etc/resolv.conf nameserver 192.168.213.2 domain localdomain search localdomain UbuntuGuest$route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.213.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.213.2 0.0.0.0 UG 100 0 0 eth0 UbuntuGuest$
On Linux Guest: Check that the outside world is reachable:
UbuntuGuest$ping google.com PING google.com (72.14.213.104) 56(84) bytes of data. 64 bytes from pv-in-f104.1e100.net (72.14.213.104): icmp_seq=1 ttl=128 time=47.6 ms 64 bytes from 2.bp.blogspot.com (72.14.213.104): icmp_seq=2 ttl=128 time=48.7 ms 64 bytes from 2.bp.blogspot.com (72.14.213.104): icmp_seq=3 ttl=128 time=48.2 ms ^C --- google.com ping statistics --- 4 packets transmitted, 3 received, 25% packet loss, time 3093ms rtt min/avg/max/mdev = 47.687/48.223/48.714/0.491 ms UbuntuGuest$
On OS X Host: Add a mapping for the hostname to the
hosts
file:OSXHost$cd /etc OSXHost$sudo emacs hosts
Add a line to the end of the hosts file using the Linux Guest's hostname and the IP address assigned above.
192.168.213.2 serpents-hold
On OS X Host: Save file and exit emacs.
On OS X Host: Test that the Linux Guest is reachable by hostname:
OSXHost$ping serpents-hold PING serpents-hold (192.168.213.3): 56 data bytes 64 bytes from 192.168.213.3: icmp_seq=0 ttl=64 time=0.169 ms 64 bytes from 192.168.213.3: icmp_seq=1 ttl=64 time=0.244 ms ^C --- serpents-hold ping statistics --- 2 packets transmitted, 2 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.169/0.207/0.244/0.037 ms OSXHost$