Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up static IP by CentOS

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "CentOS how to set static IP", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "CentOS how to set static IP" this article.

Summary of the methods of setting static IP by CentOS

1. Modify the configuration of network card

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

DEVICE=eth0 # describes the device alias corresponding to the network card. For example, in the ifcfg-eth0 file, it sets the way for the network card to obtain the ip address for eth0BOOTPROTO=static #. The possible options are static,dhcp or bootp, corresponding to the statically specified ip address, respectively, and the ip address obtained through the dhcp protocol. The ip address obtained through the bootp protocol BROADCAST=192.168.0.255 # corresponds to the subnet broadcast address HWADDR=00:07:E9:05:E8:B4 # the physical address of the network card IPADDR=12.168.0.33 # if the network card is set to obtain the ip address, it is statically specified This field specifies the ip address of the network card, the network address of the NETMASK=255.255.255.0 # network card, the network mask of the NETWORK=192.168.0.0 # network card, and the network address of the network card.

2. Modify the gateway configuration

Vi / etc/sysconfig/network

NETWORKING=yes # (indicates whether the system uses a network, which is generally set to yes. If set to no, the network cannot be used, and many system servers will not be able to start) HOSTNAME=centos # (set the host name of this machine, which corresponds to the host name set in / etc/hosts) GATEWAY=192.168.0.1 # (set the IP address of the gateway connected to this machine.)

Typically, the last line is added.

3. Modify DNS configuration

Vi / etc/resolv.conf

Nameserver # is the IP address of the DNS server, the first is the preferred, and the second is the standby.

4. Restart the network

Service network restart

Or

/ etc/init.d/network restart above is all the content of the article "how to set up static IP in CentOS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report