****** VMWare ****** Static IP on Linux Host (VMWare, NAT) ===================================== - Linux host running Ubuntu 9.10 - Linux guest *tsvm* running Ubuntu 8.04 server Mission: 1. make tsvm (guest) accessible **to host only** via a static IP 2. be able to copy tsvm to another host and repeat 1) Set Static MAC Address ---------------------- Edit `tsvm.vmx`, delete those lines:: ethernet[n].generatedAddress ethernet[n].addressType ethernet[n].generatedAddressOffset Add this line:: ethernet0.address = "00:50:56:00:13:37" You can set another MAC address. It must have the form "00:50:56:XX:YY:ZZ" with XX between 00 and 3F and YY and ZZ between 00 and FF. (hex of course) From http://www.vmware.com/support/gsx3/doc/network_macaddr_gsx.html Set Static Device Name ---------------------- Problem: Different MAC addresses for the same VM result in different device names. Those are not configured (see /etc/network/interfaces) and thus cannot get an IP address. In a VM where we have **EXACTLY ONE** MAC address, so we can set **any** device to ``eth0``:: find /etc/udev/rules.d/ -name "*-net.rules" -exec rm {} \; cat <<'EOF' > /etc/udev/rules.d/70-persistent-net.rules SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" EOF For a specific MAC-address:: find /etc/udev/rules.d/ -name "*-net.rules" -exec rm {} \; echo 'KERNEL=="eth*", SYSFS{address}=="00:50:56:00:13:37", NAME="eth"' > /etc/udev/rules.d/10-net.rules vim /etc/network/interfaces:: auto lo iface lo inet loopback auto eth iface eth inet dhcp Set Static IP Address --------------------- In vmware go to :menuselection:`Edit --> Virtual Network Editor`. Set vmnet8 to NAT, tick both :guilabel:`Use local DHCP service to distribute IP addresses to VMs` and :guilabel:`Connect a host virtual adapter (vmnet8) to this network`. Set subnet IP to ``10.0.0.0``. The changes you made are saved to ``/etc/vmware/vmnet8/dhcpd/dhcpd.conf``. Edit this file and append:: host tsvm { hardware ethernet 00:50:56:00:13:37; fixed-address 10.0.0.23; } Now restart vmware networking services:: /etc/init.d/vmware restart From http://www.vmware.com/support/ws55/doc/ws_net_advanced_ipaddress.html and http://www.stereoplex.com/two-voices/vmware-fusion-guests-with-a-static-ip Set Hostname on Host -------------------- On host, edit:: sudo vim /etc/hosts and add:: 10.0.0.23 tsvm