Linux virtual machines access the Internet through NAT

Source: Internet
Author: User
Tags dns forwarder
Linux virtual machines access the Internet through NAT-Linux general technology-Linux technology and application information. The following is a detailed description. VMware Workstation 6.0.1 build-55017
Host OS is Windows XP Guest OS is Fedora 4

Network Structure:
1. The host IP address and DNS address are dynamically obtained through DHCP in the LAN and domain environment.

2. access the Internet through ADSL, connect to the Wireless Broadband Router below, enable DHCP to dynamically obtain the Host IP address and DNS address

Follow these steps:
1. Enable the shutdown status of VMware and Fedora 4. In the Devices area, double-click Ethernet and select "NAT ".



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.xuniji.com/upload/forum/200803/20080303215051v7.jpg'); ">

2. in VMware, Edit-> Virtual Network Settings. The Settings shown in the following two figures indicate that VMnet8 is enabled. When VMnet8 is enabled, the VMware software virtualizes a network switch with a DHCP function and serves as a NAT server.
Note the Gateway IP Address in the second figure VMnet8.



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.xuniji.com/upload/forum/200803/20080303215150bl.jpg'); ">



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.xuniji.com/upload/forum/200803/20080303215208vi.jpg'); ">

3. Open the ora 4 Vm and log on to the system as the root account. If the GUI is used, press Ctrl + Alt + F1 to switch to the terminal command line mode.

4. Set the Host Name and default gateway (open the/etc/sysconfig/network file in the vi editor)

[Root @ hostname root] # vi/etc/sysconfig/network

Follow the settings. Note that the HOSTNAME is set to daquan.wang.com. After the configuration is complete, the hostname is changed to daquan after the machine is restarted.



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.xuniji.com/upload/forum/200803/20080303215354ij.jpg'); ">

5. Set Nic parameters (open the/etc/sysconfig/network-scripts/ifcfg-eth0 file in the vi editor)

[Root @ hostname root] # vi/etc/sysconfig/network-scripts/ifcfg-eth0

Follow the settings.



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.xuniji.com/upload/forum/200803/20080303215441v5.jpg'); ">

6. Set the IP address of the DNS host (open the/etc/resolv. conf file in the vi editor)

[Root @ hostname root] # vi/etc/resolv. conf

You do not need to set the IP Address. If the IP Address is not set as follows, the IP Address of VMnet8 is automatically set to DHCP when the machine is restarted, nameserver acts as the DNS Server in Windows. This setting is similar to the DNS forwarder in Windows Domain environment. It means that this address will automatically forward DNS queries to the host's DNS.



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.xuniji.com/upload/forum/200803/200803032155457e.jpg'); ">

7. Restart network settings
Because the/etc/sysconfig/network file has been changed, restart the VM according to the following three commands. If not, reboot the VM.

See


(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.xuniji.com/upload/forum/200803/20080303215637ll.jpg'); ">
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.