linux 修改IP, DNS 命令 http://www.cnblogs.com/fighter/archive/2010/03/04/1678007.html

修改DNS

[root@localhost network-scripts]# vi /etc/sysconfig/network-scripts/resolv.conf
nameserver 202.98.96.68
nameserver 61.139.2.69

重新启动网络配置  

/etc/init.d/network restart

linux 下 ifcfg-eth0 配置 http://www.cnblogs.com/iixiaowei/articles/2300084.html

网络接口配置文件
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
TYPE=Ethernet #网卡类型
DEVICE=eth0 #网卡接口名称
ONBOOT=yes #系统启动时是否自动加载
BOOTPROTO=static #启用地址协议 --static:静态协议 --bootp协议 --dhcp协议
IPADDR=192.168.1.11 #网卡IP地址
NETMASK=255.255.255.0 #网卡网络地址
GATEWAY=192.168.1.1 #网卡网关地址
DNS1=10.203.104.41 #网卡DNS地址
HWADDR=00:0C:29:13:5D:74 #网卡设备MAC地址
BROADCAST=192.168.1.255 #网卡广播地址
重新导入ifcfg-eth0网络配置文件
[root@localhost ~]# /etc/init.d/network reload
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ] 网卡接口关闭与激活
[root@localhost ~]# ifdown eth0 #关闭网络
[root@localhost ~]# ifup eth0 #启动网络 网络服务启动与关闭
方法一:
[root@localhost ~]# service network stop #关闭网络服务
[root@localhost ~]# service network start #启动网络服务
[root@localhost ~]# service network restart #重启网络服务
方法二:
[root@localhost ~]# /etc/init.d/network stop
[root@localhost ~]# /etc/init.d/network start
[root@localhost ~]# /etc/init.d/network restart
网卡状态查询
[root@localhost ~]# service network status
Configured devices:
lo eth0
Currently active devices:
lo eth0
查看当前路由及网关信息
[root@localhost ~]# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

linux 修改IP, DNS 命令的更多相关文章

  1. Linux修改IP,DNS和网关

    以Red Hat Enterprise Linux 5.2为例1.最常用的给网卡配置ip的命令为 #ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up ...

  2. linux 修改IP, DNS -(转自fighter)

    linux下修改IP.DNS.路由命令行设置 ubuntu 版本命令行设置IP cat /etc/network/interfaces # This file describes the networ ...

  3. 让Linux修改IP、DNS等可以更简单

    修改IP: 可以用 netconfig,可惜每次都得输入完整的IP.掩码.网关和DNS. 不如直接 vi /etc/sysconfig/network-scripts/ifcfg-eth0 再 /et ...

  4. linux修改IP

     linux命令行修改IP的2个方法 2010-12-30 10:25:50 分类: LINUX 方式一: ifconfig eth0 192.168.1.18 netmask 255.255.255 ...

  5. Linux学习(一):linux更改ip地址命令_更改DNS_更改默认网关_更改子网掩码_主机名

    如何使用命令来更改linux的IP .DNS .子网掩码,在虚拟机(vitrualBox)上添加一个Linux的虚拟机; 安装方法:http://pan.baidu.com/s/1sjJPhP7 安装 ...

  6. Linux修改IP永久生效

    修改IP永久生效按以下方法: 1)修改配置文件vi /etc/sysconfig/network-scripts/ifcfg-eth0(eth0,第一块网卡,如果是第二块则为eth1) 按如下修改ip ...

  7. linux 修改ip 地址

    1./etc/sysconfig/network-scripts/ifcfg-网卡 如果是新网卡 自己写配置文档 ip a 即可查看网卡名字 (这是eno16777736) BOOTPROTO= dh ...

  8. Linux 修改 IP地址 和 网关

    修改IP地址和网关是很常见的操作,在做相关实验的时候,如果没有设置好,会带来很多不必要的麻烦.. 1. 修改IP地址vi /etc/sysconfig/network-scripts/ifcfg-et ...

  9. LINUX修改IP地址

    以前都是使用自动IP动态分配获取IP的,虽然每次获得的ip都是相同的,但我还是决定自己设置一个IP.输入命令:[root@localhost ~]# ifconfig eth0 219.246.177 ...

随机推荐

  1. pprint模块解析

    pprint模块提供了打印任意python数据结构的方法,如果这个数据结构不是python的基本类型,则可能无法打印结果.         pprint模块定义了一个类:         pprint ...

  2. Linux 网络编程: echo Service

    前言 大病初愈,感谢某人的陪伴,感谢王乐庆同学和赵攀同学的细心照顾.原以为过了第八周就不忙了,却没想到还有明天的党章考试.还是写代码比背党章有意思~趁着服务器还没过期,赶紧把 echo 完成了.关于错 ...

  3. 整理一些常用函数库PHP版本

    function msubstr($str, $start=0, $length, $charset="utf-8", $suffix=true) { if(function_ex ...

  4. [LeetCode]题解(python):128-Longest Consecutive Sequence

    题目来源: https://leetcode.com/problems/longest-consecutive-sequence/ 题意分析: 给定一个没有排好序的数组,找到最长的连续序列的长度.要求 ...

  5. 转: Nodejs概述

    目录 简介 安装与更新 版本管理工具nvm 基本用法 REPL环境 异步操作 全局对象和全局变量 模块化结构 概述 核心模块 自定义模块 fs模块 Stream模式 http模块 实例:搭建一个HTT ...

  6. Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

    2016-07-18 16:08:20 [main:53] - [WARN] Exception encountered during context initialization - cancell ...

  7. HDU 2202 最大三角形

    题解:先算出凸包,然后枚举凸包上的点计算即可 #include <cstdio> #include <cmath> #include <cstdlib> #incl ...

  8. 转载Spring IntrospectorCleanupListener

    "在服务器运行过程中,Spring不停的运行的计划任务和OpenSessionInViewFilter,使得Tomcat反复加载对象而产生框架并用时可能产生的内存泄漏,则使用Introspe ...

  9. Sicily-1438

    一.      题意 买二送一.排序之后隔三求和,求折扣的最大值. 二.      代码 // // main.cpp // sicily-1438 // // Created by ashley o ...

  10. Sicily-1156

    一.      模仿树的的先序遍历.范围是1000个节点.用数组存储节点的信息. 二.      要注意的是,头结点是不确定的,所以在前序遍历之前要找出头结点,除了头结点的下标值出现一次之外,其他结点 ...