Set and modify CentOS system IP address details

Source: Internet
Author: User
Setting and modifying the IP address of the CentOS system when we use the CentOS system, we may feel that some settings are not suitable for ourselves. although they do not cause large errors, they do cause us a lot of trouble, next I will give you some suggestions to modify your DNS, Gateway, and IP address ....
Setting and modifying the IP address of the CentOS system when we use the CentOS system, we may feel that some settings are not suitable for ourselves. although they do not cause large errors, they do cause us a lot of trouble, next I will give you some suggestions to modify your DNS, Gateway, and IP address. Let's explain how to modify it! Www.2cto.com 1. modify the DNS of the CentOS system to modify the DNS configuration file of the corresponding Nic # vi/etc/resolv. conf modify the following content: nameserver 8.8.8.8 # google domain name server nameserver 8.8.4.4 # google domain name server 2. CentOS system modify gateway modify the gateway configuration file of the corresponding Nic [root @ centos] # vi/etc/ sysconfig/network modify the following content NETWORKING = yes (indicates whether the system uses the network, it is generally set to yes. If it is set to no, the network cannot be used, and many system service programs cannot start) HOSTNAME = centos (set the host name of the local machine, the host name set here corresponds to the host name set in/etc/hosts) GATEWAY = 192.168.1.1 (set the IP address of the GATEWAY connected to the local machine. For example, the gateway is 10.0.0.2) 3. CentOS system modify the IP address to modify the corresponding nic ip address configuration file # vi/etc/sysconfig/network-scripts/ifcfg-eth0 modify the following content DEVICE = eth0 # Description of the network adapter corresponding to the DEVICE alias, for example, in the ifcfg-eth0 file, it is eth0BOOTPROTO = static # set the way the Nic gets the IP address, the possible option is static, dhcp or bootp, respectively corresponding to the static specified IP address, IP address obtained through dhcp protocol, IP address obtained through bootp protocol BROADCAST = 192.168.0.255 # corresponding subnet BROADCAST address HWADDR = 00: 07: E9: 05: E8: b4 # The physical IP address of the corresponding Nic, IPADDR = 12.168.1.2 # if the IP address obtained by The NIC is set to static, This field specifies the IP address of the NIC, IPV6INIT = no1_6_autoconf = NoNETMASK = 255.255.255.0 # NETWORK mask for the NETWORK adapter NETWORK = 192.168.1.0 # NETWORK address of the NETWORK adapter ONBOOT = yes # whether to set this NETWORK interface when the system starts. if it is set to yes, activate the device www.2cto.com 4 when the system starts. restart the network to configure service network restart or/etc/init. d/network restart modify IP address effective immediately: ifconfig eth0 192.168.0.2 netmask 255.255.255.255.0 effective start: modify/etc/sysconfig/network-scripts/ifcfg-eth0 modify Gateway Default Gateway effective immediately: route add default gw 192.168.0.1 dev eth0 start effective: modify/etc/sysconfig/network DNS modification/etc/resolv. the change of conf takes effect immediately, and the change of host name also takes effect immediately: hostname centos1 takes effect immediately: Modification of/etc/sysconfig/network CentOS system, we have modified the DNS, Gateway, and IP address. after restarting the network configuration, we can see the effect.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.