Thursday, August 16, 2012

VMware Fusion 4 NAT Networking

MacBookPro:/ yapchinhoong$ cat /Library/Preferences/VMware\ Fusion/networking
VERSION=1,0
answer VNET_1_HOSTONLY_NETMASK 255.255.255.0
answer VNET_1_HOSTONLY_SUBNET 192.168.11.0
answer VNET_1_VIRTUAL_ADAPTER yes
answer VNET_8_HOSTONLY_NETMASK 255.255.255.0
answer VNET_8_HOSTONLY_SUBNET 192.168.18.0
answer VNET_8_NAT yes
answer VNET_8_VIRTUAL_ADAPTER yes
MacBookPro:/ yapchinhoong$ 
MacBookPro:/ yapchinhoong$ cat /Library/Preferences/VMware\ Fusion/vmnet8/nat.conf
# VMware NAT configuration file

[host]

# NAT gateway address
ip = 192.168.18.2
netmask = 255.255.255.0

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

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

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

# Controls if (TCP) connections should be reset when the adapter they are
# bound to goes down
resetConnectionOnLinkDown = 1

[tcp]

# Value of timeout in TCP TIME_WAIT state, in seconds
timeWaitTimeout = 30

[udp]

# Timeout in seconds. Dynamically-created UDP mappings will purged if
# idle for this duration of time 0 = no timeout, default = 60; real
# value might be up to 100% longer
timeout = 60

[netbios]
# Timeout for NBNS queries.
nbnsTimeout = 2

# Number of retries for each NBNS query.
nbnsRetries = 3

# Timeout for NBDS queries.
nbdsTimeout = 3

[incomingtcp]

# Use these with care - anyone can enter into your VM through these...
# The format and example are as follows:
# = :
#8080 = 172.16.3.128:80

[incomingudp]

# UDP port forwarding example
#6000 = 172.16.3.0:6001

MacBookPro:/ yapchinhoong$ 
MacBookPro:/ yapchinhoong$ cat /Library/Preferences/VMware\ Fusion/vmnet8/nat.mac
00:50:56:FC:1B:04
MacBookPro:/ yapchinhoong$ 
MacBookPro:/ yapchinhoong$ ifconfig vmnet8
vmnet8: flags=8863 mtu 1500
 ether 00:50:56:c0:00:08 
 inet 192.168.18.1 nroetmask 0xffffff00 broadcast 192.168.18.255
MacBookPro:/ yapchinhoong$ 

Run the following commands in sequence to update the changes without restarting Fusion 4.x and later.
This can be useful if you do not want to relaunch Fusion (if you have other Virtual Machines running).
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --configure
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start

[root@localhost ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:11:22:33  
          inet addr:192.168.18.123  Bcast:192.168.18.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe11:2233/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:400 (400.0 b)  TX bytes:6718 (6.5 KiB)

[root@localhost ~]# 
[root@localhost ~]# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.18.0    *               255.255.255.0   U         0 0          0 eth0
169.254.0.0     *               255.255.0.0     U         0 0          0 eth0
default         192.168.18.2    0.0.0.0         UG        0 0          0 eth0
[root@localhost ~]# 
[root@localhost ~]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=128 time=32.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=128 time=33.9 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=128 time=30.3 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 30.372/32.180/33.998/1.487 ms
[root@localhost ~]# 
[root@localhost ~]# ping 192.168.18.1
PING 192.168.18.1 (192.168.18.1) 56(84) bytes of data.
64 bytes from 192.168.18.1: icmp_seq=1 ttl=64 time=0.259 ms
64 bytes from 192.168.18.1: icmp_seq=2 ttl=64 time=0.161 ms
64 bytes from 192.168.18.1: icmp_seq=3 ttl=64 time=0.141 ms

--- 192.168.18.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.141/0.187/0.259/0.051 ms
[root@localhost ~]# 
[root@localhost ~]# ping 192.168.18.2
PING 192.168.18.2 (192.168.18.2) 56(84) bytes of data.
64 bytes from 192.168.18.2: icmp_seq=1 ttl=128 time=0.168 ms
64 bytes from 192.168.18.2: icmp_seq=2 ttl=128 time=0.149 ms
64 bytes from 192.168.18.2: icmp_seq=3 ttl=128 time=0.143 ms

--- 192.168.18.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.143/0.153/0.168/0.014 ms
[root@localhost ~]# 
[root@localhost ~]# arp -a
? (192.168.18.2) at 00:50:56:FC:1B:04 [ether] on eth0
? (192.168.18.1) at 00:50:56:C0:00:08 [ether] on eth0
[root@localhost ~]# 

No comments:

Post a Comment