VMWare NAT and static IP in linux guest - destination host unreachable
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
VMWare NAT and static IP in linux guest - destination host unreachable
Hi everybody,
I am new to the Linux world and networking, so i decided to buy a book and download VMWare Workstation 30-day trial and CentOS 6.
I am following the book and i want to assign static ip addresses to my linux VMs. The book uses the subnet IP 192.168.122.0/24 and as i want to keep everything the same, i changed the NAT (VMNet 8) IP subnet in VMWare Workstation to 192.168.122.0 netmask 255.255.255.0 Under the NAT Settings in the Virtual Network Editor for VMNet8 (NAT) it shows the gateway being 192.168.122.2
In my Linux VM (CentOS), i configured the /etc/sysconfig/network-scripts/ifcfg-eth0 and added:
IPADDR: 192.168.122.20
NETMASK: 255.255.255.0
GATEWAY: 192.168.122.2
DNS1: 192.168.122.2
I also changed the /etc/sysconfig/network file and added:
GATEWAY: 192.168.122.2
I then did a 'service network restart' and everything restarted fine. When i tried to ping the gateway (192.168.122.2) i get a Destination Host Unreachable. When i use DHCP in the CentOS image, i get an ip address of 192.168.122.130 (random but the DHCP scope starts at .128-/254) and everything is working fine. I can ping the gateway and the outside world (google.com for example).
What am i doing wrong in my settings for the static ip address that i cannot get any networking connectivity? I read somewhere that i must use Bridged networking mode instead of NAT (which i am using) to use static ip address? But i do not understand why, when using DHCP everything works fine.
Can someone please help and let me know where i am going wrong so i can learn from my mistake?
I use VMWare Server 2. I always use Bridged networking. It allows VMs to see each other as well as to get to the Internet. I assign static IPs.
To see some of the differences among the 3 modes pf networking in VMWare, do a Google search for vmware server bridged versus nat -- the first hit -- Blog Rat-- and a few of the many VMWare hits provide some comparisons.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.