Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the current set up for an embedded environment:

Embedded Target ( -----> Virtual Machine (VMWare) (2 NIC's - (Target Port) and (NAT Port to host)) ------> NAT on Windows PC ----> internet

What I would like to do is allow the Embedded target to access the internet.

  1. Is this possible?

The Virtual machine can access the internet fine through the NAT on the Virtual machine, I just do not know how to route the embedded target to the internet. There are also other devices on the 192.168.0.x network that access the virtual machine.


share|improve this question
up vote 2 down vote accepted

If I understand your question properly, I think you want your VM to act as any gateway/router would. You can do this with IP masquerading.

The necessary configuration for your boxes may vary, but here is a very general example:


Assuming eth0 is your external (NAT) interface with ip, you can enable IP masquerading as follows:

$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

$ echo 1 > /proc/sys/net/ipv4/ip_forward

Embedded Device

On the embedded device you can statically assign your IP, netmask, default gateway, and DNS resolver as follows:

$ ifconfig eth0 netmask
$ route add default gw
$ echo 'nameserver' > /etc/resolv.conf  

These configurations will not persist across reboots. In Ubuntu you will configure your network interface in /etc/network/interfaces and enable IP forwarding in /etc/sysctl.conf. For persisting iptables rules see the linked blog post below for some helpful information.


share|improve this answer
Thanks. The masquerading works fine. – user626201 Mar 15 '12 at 9:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.