I. Introduction
In Linux, you sometimes need to configure the network to a specified IP address. I have encountered this problem several times, and I cannot think of any details each time. I would like to write it down here. Next time I forget to go through it, I don't need to keep Baidu.
Ii. Problems
Set the network IP address to 172.25.10.24, static IP address, and subnet mask to 255.255.255.0.
Iii. Operation Process
This process is implemented in the vmwarevm.
1. Click Edit in the VMware menu bar and select "Virtual Machine network Editor" to open the following window.
2. Select vmnet8, click Change settings in the lower right corner, obtain permissions, select Nat mode, and modify the subnet IP address and subnet mask.
3. view the Network Gateway and click Nat settings in the middle. View the gateway and use it later when configuring the network in the virtual machine. For example.
4. Click OK to apply the application. Return to the Linux system. First, we need to edit the network configuration file. In this directory, add the network adapter name, starting with ifcfg-, in/etc/sysconfig/network-scripts.
5. Use VI/etc/sysconfig/network-scripts/ifcfg-ens33 to edit the configuration file. After editing, save and exit.
Note: The Gateway should be the same as the gateway we mentioned earlier, otherwise it will not be able to access the Internet.
The above is what I have modified. Basically, you can access the Internet with these parameters. There are still many parameters in the source file, and none of them are deleted.
6. The last step is to use the network restart command to make the configuration take effect.
Systemctl restart Network
Iv. Summary
There are several questions:
1. the Linux gateway must correspond to the Virtual Machine network editor;
2. In the bridging mode, you can directly assign an IP address to Linux. In this way, you can directly access the Internet on an independent host. However, if you work on a Local Area Network, the IP address of your virtual machine may conflict with the IP address of other hosts, causing unnecessary problems. Therefore, we recommend that you use the NAT mode. In Nat mode, you can access the Internet through your host.
Centos 7 network configuration, static IP