歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> Centos網絡配置,centos網絡

Centos網絡配置,centos網絡

日期:2017/3/3 18:05:47   编辑:學習Linux

Centos網絡配置,centos網絡

Centos網絡配置,centos網絡


網上搜索:centos網絡配置的方法,主要包括dns、網關、IP地址,主要是配置resolv.conf\network\ifcfg-eth0這些網絡配置文件。

稍後我會就centos7的網絡配置進行實際操作。

centos網絡配置實例

1、配置DNS:
vi /etc/resolv.conf
加入:

nameserver 192.168.0.1 
nameserver 8.8.8.8
nameserver 8.8.4.4

2、配置網關:

vi /etc/sysconfig/network
加入:
GATEWAY=192.168.0.1
內容如下:

NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.168.0.1

3、配置ip地址:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
內容如下:

DEVICE="eth0"
HWADDR="00:0C:29:6C:BB:E6"
NM_CONTROLLED="yes"
ONBOOT="no"
NETMASK=255.255.255.0
IPADDR=192.168.0.8
GATEWAY=192.168.0.1
BOOTPROTO=static
ONBOOT=yes
PEERDNS=yes

4、重新啟動服務:

/etc/init.d/network restart
或:
service network restart
或:
ifdown eth0 and ifup eth0

配置完成後,ping一下網關,檢查是否能ping通或在用ifconfig eth0,檢查下實際配置的ip地址。

http://xxxxxx/Linuxjc/1175368.html TechArticle

Copyright © Linux教程網 All Rights Reserved