The CentOS system installed on VM VMS, by default, uses the way DHCP automatically obtains IP addresses, and I myself want to use this CentOS in the LAN to build a small demo site, the way to automatically obtain IP address is obviously not good, then how to modify the IP address CentOS?
The author server is also using CentOS, are rented space business people are directly set up, and the Local has been using Windows rarely used in CentOS suddenly found themselves CentOS will not modify the IP address. Baidu Google search a lot of finally solved, this article here on a detailed description and CentOS network configuration is also explained in detail, I hope to help is needed in this area of netizens.
Application scope and demonstration system
Scope of application: Linux
Demo System: centos6.4
CentOS Modify IP Address method
1th Step: Successfully login to the CentOS system terminal.
2nd step: Execute "vi/etc/sysconfig/network-scripts/ifcfg-eth0" and enter OK.
3rd Step: Modify or add the appropriate code to your needs.
Copy CodeThe code is as follows:
Device= "Eth0"
Onboot=yes
Type=ethernet
Bootproto=static
ipaddr=192.168.1.65
gateway=192.168.1.9
dns1=8.8.8.8
dns2=8.8.4.4
Defroute=yes
Ipv4_failure_fatal=yes
Ipv6init=no
hwaddr=00:0c:29:e5:d3:3b
Networking=yes
4th step: After the modification is completed, enter ": wq!" in the VI command mode and enter OK to exit VI edit mode.
The 5th step: The author is on the VM virtual machine to do the test, after the modification is immediately effective, if you are on the host, you can perform "service Network restart" Restart network configuration.
Network Configuration Instructions
Copy CodeThe code is as follows:
Device= "Eth0" #网卡对应的设备别名
Onboot=yes #系统启动时激活网卡, no system does not activate the network card when booting up
Type=ethernet #链路类型, is generally written directly Ethernet
Bootproto=static #设置IP类型, this article is set up here is a static IP, or DHCP or BOOTP, respectively, corresponding to the static specified IP address, the IP address obtained through the DHCP protocol, the IP address obtained through the BOOTP protocol
ipaddr=192.168.1.65 #如果BOOTPROTO设置的是static, you need to specify a static IP address here.
gateway=192.168.1.9 #设置网关地址
dns1=8.8.8.8 #Google的公共DNS服务
dns2=8.8.4.4 #Google的公共DNS2服务
Defroute=yes #将该接口设置为默认路由, no do not set this interface as the default route
Ipv6init=no #不使用ipv6
hwaddr=00:0c:29:e5:d3:3b #网卡MAC真实地址
Networking=yes #是否启用网络, yes is enabled, no is not enabled.
Address: http://www.jb51.net/os/RedHat/220834.html
The CentOS system uses the configuration file to modify the IP address in detail tutorial