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 modify ip address in centos

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

Share

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

Centos how to modify the ip address, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

1. Modify DNS in CentOS system

Modify the configuration file of the DNS of the corresponding network card

# vi / etc/resolv.conf

Modify the following

Nameserver 8.8.8.8 # google Domain name Server

Nameserver 8.8.4.4 # google Domain name Server

2. CentOS system modification gateway

Modify the configuration file of the gateway of the corresponding network card [root@centos] # vi / etc/sysconfig/network

Modify the following

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 services will not start)

HOSTNAME=centos (set the hostname of this machine, which corresponds to the hostname set in / etc/hosts)

GATEWAY=192.168.1.1 (sets the IP address of the gateway connected locally. For example, the gateway is 10.0.0.2)

3. CentOS system modifies IP address

Modify the configuration file of the IP address of the corresponding network card

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

Modify the following

DEVICE=eth0 # describes the device alias corresponding to the Nic, for example, it is eth0 in the file of ifcfg-eth0

BOOTPROTO=static # sets the way the network card obtains the ip address. The possible options are static,dhcp or bootp, corresponding to the statically specified ip address, the ip address obtained through the dhcp protocol, and the ip address obtained through the bootp protocol.

Subnet broadcast address corresponding to BROADCAST=192.168.0.255 #

Physical address of the network card corresponding to HWADDR=00:07:E9:05:E8:B4 #

IPADDR=12.168.1.2 # if you set the way for the Nic to obtain the ip address statically, this field specifies the ip address corresponding to the Nic

IPV6INIT=no

IPV6_AUTOCONF=no

The network mask for the NETMASK=255.255.255.0 # Nic

NETWORK=192.168.1.0 # Network address corresponding to the Nic

ONBOOT=yes # whether to set this network interface when the system starts. If it is set to yes, the device will be activated when the system starts.

4. Restart the network configuration

Service network restart or / etc/init.d/network restart

Modify IP address

Effective immediately:

Ifconfig eth0 192.168.0.2 netmask 255.255.255.0

Start to take effect:

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

Modify gateway Default Gateway

Effective immediately:

Route add default gw 192.168.0.1 dev eth0

Start to take effect:

Modify / etc/sysconfig/network

Modify DNS

Modify / etc/resolv.conf

The modification can take effect immediately, and the startup is also effective.

Modify host name

Effective immediately:

Hostname centos1

Start to take effect:

Modify / etc/sysconfig/network

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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