如何在centos上配置网络

时间:2016-11-03 11:53:20

标签: linux networking centos

我试图设置使用分操作系统的自动拨号,我对分操作系统全新,并且不知道如何在其上配置网络,没有网络我无法访问go auto CE门户网站。

我尝试使用我的WiFi IP子网掩码和默认网关,但当我尝试访问给定的IP时,它会显示:

enter image description here

1 个答案:

答案 0 :(得分:1)

要显示所有网络接口(要检查您的接口名称,请参见以下示例中的eth0,请从以下命令的结果中替换eth0 par您的接口名称):

[root@localhost]# ifconfig -a

如果使用eth0接口,则应配置如下:

[root@localhost]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
## Configure eth0
#
# /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0" # interface name
NM_CONTROLLED="no"
ONBOOT=yes # launch network in Linux boot
HWADDR=AA:BB:CC:DD:EE:FF # your mac address
TYPE=Ethernet 
BOOTPROTO=static # static or dhcp
NAME="System eth0"
IPADDR=X.X.X.X # your ip address if static is chosen
NETMASK=255.255.255.0 # your netmask if static is chosen


[root@localhost]# vi /etc/sysconfig/network
## Configure Default Gateway
#
# /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=centos6
GATEWAY=192.168.1.1

重新启动网络接口

[root@localhost]# /etc/init.d/network restart

配置DNS服务器

[root@localhost]# vi /etc/resolv.conf
nameserver 8.8.8.8      # Replace with your nameserver ip
nameserver 8.8.4.4      # Replace with your nameserver ip