Linux Setup Network

Source: Internet
Author: User

Linux setup network.

The following actions are based on the NAT mode,

    1. Automatically obtain an IP address in the state after login

      # dhclient

    2. View your IP

# IP Addr

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/A5/FD/wKioL1nHOKejYlYtAAAjefNCieU957.png-wh_500x0-wm_ 3-wmp_4-s_2242903051.png "title=" Qq20170924124538.png "alt=" Wkiol1nhokejylytaaajefncieu957.png-wh_50 "/>

The Linux operating system is case-sensitive, and you can see that there are two IP addresses on this machine. The first address, 127.0.0.1, is a loopback address, and the network card name is lo, which is used for communication. The second address is 192.168.183.129 is automatically obtained automatically just the IP address, Ens33 is the name of the network card.


3. Press CTRL and ALT at the same time to release your mouse, then click "Edit" in the upper left corner of the VMware Virtual Machine menu bar, select "Virtual Network Editor", pop up the following interface

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/A5/FD/wKioL1nHPCzAPGiPAAByXM85N_E253.png-wh_500x0-wm_ 3-wmp_4-s_2976991847.png "style=" Float:none; "title=" Qq20170924125603.png "alt=" Wkiol1nhpczapgipaabyxm85n_ E253.png-wh_50 "/>


Check VMnet8 (NAT mode), below you can see the subnet IP 192.168.183.0, the subnet mask is 255.255.255.0, click on the "Nat settings" button on the right, pop up the following interface

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/07/4C/wKiom1nHPGaBd4XZAABKp1Fmg3E728.png-wh_500x0-wm_ 3-wmp_4-s_1722754039.png "style=" Float:none; "title=" Qq20170924125614.png "alt=" Wkiom1nhpgabd4xzaabkp1fmg3e728.png-wh_50 "/>

In this interface, we see that the gateway is 192.168.183.2, please remember this gateway address, a


Then test if CentOS7 can be networked.

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/A5/FD/wKioL1nHPCzA2nozAAA-tMSclwI750.png-wh_500x0-wm_ 3-wmp_4-s_3150816063.png "style=" Float:none; "title=" Qq20170924125723.png "alt=" Wkiol1nhpcza2nozaaa-tmsclwi750.png-wh_50 "/>


Next we need to manually set the IP address for the Linux system

# Vi/etc/sysconfig/network-script/ifcfg-ens33, then enter, enter the NIC configuration file,


650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/A5/FD/wKioL1nHPC3Cy47EAAAauW6tZqI520.png-wh_500x0-wm_ 3-wmp_4-s_3332044782.png "style=" Float:none; "title=" Qq20170924125942.png "alt=" Wkiol1nhpc3cy47eaaaauw6tzqi520.png-wh_50 "/>

We can use, up, down, left, right, arrow keys to move the cursor, but not directly to modify the file content, you need to press the letter I key, need to modify the content has, speak Onboot=no, changed to Onboot=yes, will bootproto=dhcp changed to bootproto= Static

and add a few lines of characters

ipaddr=192.168.183.128

netmask=255.255.255.0

gateway=192.168.183.2

dns1=119.29.29.29


Onboot is set to Yes to indicate that the NIC is started with the system, Bootproto is used to set the startup type of the network card, DHCP indicates that the IP address is automatically obtained, and static indicates that the IP address is set manually. IPAddr Specify the IP address, netmask Specify the subnet mask, gateway to specify the gateways, DNS1 specify the DNS IP address for the Internet, this 119.29.29.29 is a public DNS provided by the domestic Dnspod company, after the modification, click "ESC", Then press "Shift+enter" to enter ": Wq" and enter, exit the document, and then restart the network service

# systemctl Restart Network.service


Then look at the IP address

# IP Addr

If it's correct, ping the test network.

All the steps on these thank you!!!



Linux Setup Network

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.