Linux manually set the network card IP

The network card configuration file is stored in /etc/sysconfig/network-scripts/

cd /etc/sysconfig/network-scripts/

Network card configuration file format enoxxxxxxxxx


Suppose, the experimental network card configuration file is as follows: 

vi ifcfg-eno16777736


Change the content inside to the following configuration

BOOTPROTO=static #represents the network card to choose which way to obtain ip, static represents manual setting, dhcp represents automatic setting
NAME=eno16777736 #NIC name
DEVICE=eno16777736 #device name
ONBOOT=yes #Whether the device is loaded at system startup
IPADDR=192.168.130.128 #Set ip address
NETMASK=255.255.255.0 #netmask subnet mask

In the virtual machine settings, network adapter selection: custom, VMnet8 (NAT mode)



Open the network adapter of the machine and set the VMnet8 properties (note: the ip segment here should be the same as the ip segment set above, 192.168.130.X)



Connect the above network card configuration file, save it, and exit vi

Restart the network service:

service network restart

Check network input: ifconfig


It can be found that the ip of the network card has become the ip manually set by yourself


Then you can start the ssh service and pull



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325854825&siteId=291194637