Centos Virtual Machine NAT static IP settings

Source: Internet
Author: User

The NAT static IP address of the centos virtual machine sets the host machine to centos 6.3 64-bit, and the three virtual machines to centos 6.3 64-bit. The Virtual Machine network connection mode is the default NAT mode. By default, virtual machines dynamically obtain IP addresses through DHCP. To build hadoop on three virtual machines, you need to build these three virtual institutions into a LAN that can access each other. Therefore, all three virtual machines are set as static IP addresses. The specific settings are as follows: 1. Run the command on the host: ifconfig-a: eth0 Link encap: Ethernet HWaddr 00: 0B: 2F: XX inet addr: XXX. XXX. XXX. XXX Bcast: XXX. XXX. XXX.255 Mask: 000000000000128 inet6 addr: xxxxxxxxxxxxxxxx/64 Scope: Global inet6 addr: XXXXXXXXXX/64 Scope: Link up broadcast running multicast mtu: 1500 Metric: 1 RX packets: 335991 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 19935 errors: 0 dropped: 0 overruns: 0 carrier: 0 co Llisions: 0 txqueuelen: 1000 RX bytes: 54399176 (51.8 MiB) TX bytes: 2590997 (2.4 MiB) eth1 Link encap: Ethernet HWaddr 3F: 3F: 3F: 3F: 3F: 3F: 3F broadcast multicast mtu: 1500 Metric: 1 RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 1000 RX bytes: 0 (0.0 B) TX bytes: 0 (0.0 B) lo Link encap: Local Loopback inet addr: 127.0.0.1 Mask: 255. 0.0.0 inet6 addr: 1/128 Scope: Host up loopback running mtu: 16436 Metric: 1 RX packets: 41128 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 41128 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 0 RX bytes: 138218445 (131.8 MiB) TX bytes: 138218445 (131.8 MiB) virbr0 Link encap: ethernet HWaddr 52: 54: 00: 75: 98: B4 inet addr: 192.168.122.1 Bcast: 192.168.122.255 Mask: 255.255.255.0 UP BROA Dcast running multicast mtu: 1500 Metric: 1 RX packets: 1319 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 539 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 0 RX bytes: 99958 (97.6 KiB) TX bytes: 453583 (442.9 KiB) virbr0-nic Link encap: Ethernet HWaddr 52: 54: 00: 75: 98: b4 broadcast multicast mtu: 1500 Metric: 1 RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 0 errors: 0 dr Opped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 500 RX bytes: 0 (0.0 B) TX bytes: 0 (0.0 B) vnet0 Link encap: Ethernet HWaddr FE: 54: 00: 17: 67: 42 inet6 addr: fe80: fc54: ff: fe17: 6742/64 Scope: Link up broadcast running multicast mtu: 1500 Metric: 1 RX packets: 904 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 4557 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 500 RX bytes: 76846 (75. 0 KiB) TX bytes: 472213 (461.1 KiB) vnet1 Link encap: Ethernet HWaddr FE: 54: 00: 4B: 93: 57 inet6 addr: fe80: fc54: ff: fe4b: 9357/64 Scope: Link up broadcast running multicast mtu: 1500 Metric: 1 RX packets: 1443 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 5320 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 500 RX bytes: 132821 (129.7 KiB) TX bytes: 547440 (534.6 KiB) vnet2 Link encap: Eth Ernet HWaddr FE: 54: 00: 05: B1: D6 inet6 addr: fe80: fc54: ff: fe05: b1d6/64 Scope: Link up broadcast running multicast mtu: 1500 Metric: 1 RX packets: 1120 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 5152 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 500 RX bytes: 115229 (112.5 KiB) TX bytes: 327311 (319.6 KiB) 2. Run: ifconfig-a in the terminal command window of each virtual machine to display eth0, eth1, or eth2, and HWaddr 3. Run vim. /Etc/sysconfig/network-scripts/ifcfg-eth0 (or ifcfg-eth1, The ifcfg-eth2 depends on the result seen in step 2) edit the content as follows: DEVICE = "eth1" # (or eth0, eth2 depends on the result shown in step 2) HWADDR = "52: 54: 00: 75: 98: b4 "# The HWaddr value obtained in step 2 is ONBOOT =" yes "BOOTPROTO =" static "IPADDR =" 192.168.122.10 "# NETMASK =" 255.255.255.0 "GATEWAY =" 192.168.122.1 "# (depending on the virbr0 inet addr obtained in Step 1: 192.168.122.1) TYPE = "Ethernet" so far, the three virtual machines and the host machine can access each other. You can use ping + IP to test. 4. enable various virtual machines to access the Internet.

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.