CentOS Modify IP Address

Source: Internet
Author: User
Tags nameserver

First, CentOS modified IP address
Modify the configuration file for the IP address of the corresponding network card

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

# vi/etc/sysconfig/network-scripts/ifcfg-eth0:1 netcom

Modify the following contentDevice=eth0#描述网卡对应的设备别名, for example, in a Ifcfg-eth0 file, it is eth0bootproto=static#设置网卡获得ip地址的方式, the possible options are static,dhcp or BOOTP, corresponding to statically specified IP addresses, IP addresses obtained through the DHCP protocol, IP addresses obtained through the BOOTP protocolbroadcast=192.168.0.255#对应的子网广播地址HWADDR=00:07:E9:05:E8:B4#对应的网卡物理地址ipaddr=12.168.1.2#如果设置网卡获得 IP address is statically specified, this field specifies the IP address of the NICIpv6init=noIpv6_autoconf=nonetmask=255.255.255.0#网卡对应的网络掩码network=192.168.1.0#网卡对应的网络地址Onboot=yes#系统启动时是否设置此网络接口, when set to Yes, this device is activated when the system starts
Second, CentOS modify the gateway to modify the corresponding network card gateway configuration file[[Email protected]]# vi/etc/sysconfig/network
Modify the following contentNetworking=yes(Indicates whether the system uses a network and is generally set to Yes.) If set to no, the network cannot be used, and many system services programs will not start.Hostname=centos(Set the hostname of this machine, and the host name set here should correspond to the hostname set in/etc/hosts)gateway=192.168.1.1(Set the IP address of the gateway for the native connection.) For example, the gateway is 10.0.0.2)
third, CentOS modified DNS
Modify the configuration file for the DNS of the corresponding NIC # vi/etc/resolv.conf modify the followingnameserver 8.8.8.8 #google域名服务器nameserver 8.8.4.4 #google域名服务器
Iv. Restarting the network configuration# Service Network restart or #/etc/init.d/network restart
Modify IP Address immediate effect:# ifconfig eth0 192.168.0.2 netmask 255.255.255.0Start Effective: Modify/etc/sysconfig/network-scripts/ifcfg-eth0
Modify the gateway to Default gateways immediate effect: #route add default GW 192.168.0.1 dev eth0Start Effective: Modify/etc/sysconfig/network
Modify the DNS modification/etc/resolv.conf can take effect immediately after modification, start the same effective
Modify host name to take effect immediately: #hostname centos1Start Effective: Modify/etc/sysconfig/network

CentOS Modify IP Address

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.