Summary of CentOS method to set static IP

Summary of CentOS method to set static IP

1、 Modify network card configuration

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0         #Describe the device alias corresponding to the network card, such as ifcfg-It is eth0 in the eth0 file
BOOTPROTO=static       #Set the way the network card obtains the IP address. The possible options are static, dhcp or bootp, which correspond to the statically specified ip address, the ip address obtained through the dhcp protocol, and the ip address obtained through the bootp protocol.
BROADCAST=192.168.0.255   #Corresponding subnet broadcast address
HWADDR=00:07:E9:05:E8:B4   #The corresponding physical address of the network card
IPADDR=12.168.0.33      #If the method of setting the network card to obtain the ip address is statically specified, this field specifies the ip address corresponding to the network card
NETMASK=255.255.255.0    #Network mask corresponding to the network card
NETWORK=192.168.0.0     #Network address corresponding to the network card

2、 Modify gateway configuration

vi /etc/sysconfig/network

NETWORKING=yes     #(Indicates whether the system uses the network, generally set to yes. If set to no, the network cannot be used, and many system service programs will not start)
HOSTNAME=centos    #(Set the host name of the machine, the host name set here must be/etc/Corresponding to the host name set in hosts)
GATEWAY=192.168.0.1  #(Set the IP address of the gateway to which this machine is connected.)

Generally, the last line is added.

3、 Modify DNS configuration

vi /etc/resolv.conf

nameserver # is the DNS server IP address, the first is the first choice, the second is the backup.

4、 Restart network

service network restart

or

/etc/init.d/network restart

Thanks for reading, I hope to help you, thank you for your support to this site!

Recommended Posts

Summary of CentOS method to set static IP
ubuntu 18.04 set static ip method
Set static IP under Centos
How to set static IP in ubuntu14.04
Set static IP for CentOS in VMware
How to set static IP on Ubuntu 18.04 Server
ubuntu16.0.4 method to set a fixed IP address
How to set static IP on Ubuntu 18.04 Server
Explain how to set static IP on ubuntu14.04
Ubuntu18.04, Centos7 static IP
ubuntu16.04 set static ip
Explain the implementation of Centos8 static IP configuration
Centos7.6 method to install Tomcat-8.5.39
Configure static IP under CentOS 7
Summary of logarithm method in Python
Centos6 method steps to build gitlab
CentOS deployment method of flask project
CentOS 6.8 method steps to install vsftpd
Centos8 uses yum to install mongodb 4.2 method
CentOS8 yum/dnf configuration method of domestic sources
Analysis on the method of CentOS8 virtual machine to access Windows10 host folder
Summary of methods to use Evernote under Ubuntu 14.04
How to set up SSH keys on CentOS 8
ubuntu20.04 set static ip address (including different versions)
[Quick Start with Ubuntu] Two, Ubuntu set static IP
CentOS 8 complete steps to set up automatic updates
Centos7 uses LVM to achieve dynamic expansion method
IP and network settings of CentOS Linux 7 VMware
From installation to entry of FastDFS under Centos7
Centos7 to install the correct posture of Tomcat8 and set the boot self-start practice notes
Use Cobbler to automate batch deployment of CentOS / Ubuntu
Centos8 (minimal installation) a new installation of Python3.8+pip method tutorial
Summary of linux (centos) project deployment phase related commands
Example of how to modify ip address in Ubuntu20.04
How to set a fixed IP based on Ubuntu 16.04