---
title: "centos 6.4 minimal 静态IP配置"
author: "5xnl"
date: "2013-08-16T15:56:05Z"
tags: ["CentOS", "Linux", "网络配置"]
categories: ["操作系统"]
slug: "centos-6-4-minimal-ip"
draft: false
lastmod: "2013-08-16T18:13:08Z"
id: 1926163
url: "https://5xnl.iteye.com/blog/1926163"
---

**1、设置静态IP和DNS**

```shell

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"

BOOTPROTO="static"

HWADDR="00:0C:29:86:3D:16"

IPV6INIT="yes"

NM_CONTROLLED="yes"

ONBOOT="yes"

TYPE="Ethernet"

UUID="dcf18d86-45ea-4b5c-9627-e75b19b3b6e7"

IPADDR=192.168.1.88

NETMAST=255.255.255.0

DNS1=61.139.2.69

```

**2、网关设置**

```shell

在文件 vi /etc/sysconfig/network最后一行加入：

GATEWAY=192.168.1.1
```

**
3.网络命令**

```shell
ifdown eth0 //关闭网络
ifconfig eth0 down //关闭网络
ifup eth0 //开启网络
ifconfig eth0 up //开启网络
service network start //启动网络服务
service network stop //停止网络服务
service network restart //重启网络服务
service network status //查看网络服务状态
ifconfig -a //查看所有网卡的参数
 
```