> CentOS > CentOS入门 >

CentOS 6网络配置

[1] 以root用户登陆到CentOS系统
 

image


[2] 打开一个终端
 

image

[3] 终端中输入setup命令,弹出配置窗口,选择“Network configuration”进行配置

[root@localhost ~]# setup

image

[4] 取消 User DHCP, 并输入要配置的IP信息,点击OK后,Save保存配置。
 

image

 

 

 

[5]命令行方式进行网络配置 (其实更简单)

 

编辑配置文件
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
 

 

 
DEVICE=eth0 
BOOTPROTO=none 
HWADDR=00:0c:29:45:0c:2b 
NM_CONTROLLED=yes 
ONBOOT=yes 
TYPE=Ethernet 
UUID="1115b32b-3afe-40ac-a036-542c34f65065" 
IPADDR=192.168.49.56 
NETMASK=255.255.255.0 
GATEWAY=192.168.49.2 
DNS1=192.168.49.2 
IPV6INIT=no 
USERCTL=no
 


 

重启network服务
[root@localhost ~]# service network restart

 

Shutting down interface eth0:  Device state: 3 (disconnected)
                                                           [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/3 




(责任编辑:IT)