linux下设置ip地址 gw网关,dns的方法
本文介绍下,在linux中设置IP地址、网关、dns的方法,有需要的朋友作个参考吧。
设置linux网络的方法有两种:
第一种:使用命令修改(直接即时生效)
ip and netmask:
# ifconfig eth0 192.168.30.197 netmask 255.255.255.0
gateway:
# route add default gw 192.168.30.1 eth0
dns:
# vi etc/resolv.conf
nameserver 202.131.80.1
nameserver 202.131.80.5
第二种:修改配置文档(需要重启网络配置)
一、修改IP地址
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.30.197
NETMASK=255.255.255.0
GATEWAY=192.168.30.1
二、修改网关
vi /etc/sysconfig/network
HOSTNAME=Aaron
GATEWAY=192.168.30.1
三、修改DNS
nameserver 202.131.80.1
nameserver 202.131.80.5
(一般现在这样设置以后都要重启network,所以还涉及到网络重启配置)
四、重新启动网络配置
方法有多种:
2:# /etc/init.d/network restart
3:# ifdown eth0
# ifup eth0
4:# ifconfig eth0 down
# ifconfig eth0 up
五、启动和关闭防火墙
即时生效:
#service iptables stop
重启系统生效:
#service iptables off
linux下设置ip地址 gw网关,dns的方法的更多相关文章
- CentOS/Linux下设置IP地址
CentOS/Linux下设置IP地址 1:临时修改:1.1:修改IP地址# ifconfig eth0 192.168.100.100 1.2:修改网关地址# route add default g ...
- Linux网络配置:设置IP地址、网关DNS、主机名
查看网络信息 1.ifconfig eth0 2.ifconfig -a 3.ip add 设置主机名需改配置文件: /etc/hosts /etc/sysconfig/network vim /et ...
- Linux CentOS7中 设置IP地址、网关DNS
cd /etc/sysconfig/network-scripts/ #进入网络配置文件目录 vi ifcfg-eno16777736 #编辑配置文件,此处eno后边的编号因电脑而易 TYPE ...
- LINUX (centos)设置IP地址,网关,DNS
首先:备份原始配置文件: [logonmy@logon ~]$ cd /etc/sysconfig/network-scripts/ [logon@logon network-scripts]$ pw ...
- CentOS/Linux 网卡设置 IP地址配置
CentOS/Linux下设置IP地址 1:临时修改:1.1:修改IP地址# ifconfig eth0 192.168.100.100 1.2:修改网关地址# route add default g ...
- CentOS/Linux 网卡设置 IP地址配置永久生效
CentOS/Linux下设置IP地址 1.临时生效设置 1.1修改IP地址 #ifconfig eth0 192.168.100.100 1.2修改网关地址 #route add default g ...
- IP:192.168.21.173 子网掩码:255.255.255.0 网关:192.168.21.2 DNS:8.8.8.8 8.8.4.4 1、设置IP地址、网关 ee /etc/rc.conf #编辑 ifconfig_em0="inet 192.168.21.173 netmask 255
IP:192.168.21.173子网掩码:255.255.255.0网关:192.168.21.2DNS:8.8.8.88.8.4.41.设置IP地址.网关ee /etc/rc.conf #编辑if ...
- Ubuntu Linux下设置IP的配置命令
Ubuntu Linux下设置IP的配置命令 今天装了Ubuntu,但是发现不能上网,开始排查问题: 1.首先确定网络连接是否正确,所用的网线是否可以正常工作 2.查看网卡是否能正常工作,检测的方法如 ...
- linux下修改IP地址的方法
linux下修改IP地址的方法 1.网卡的命名规则 在centos7中,en表示着:ethernet以太网,即现在所用的局域网,enX(X常见有以下3种类型) 2.IP地址的临时修改(重启后失效) 查 ...
随机推荐
- C# json Helper
using System; using System.Collections.Generic; using System.Data; using System.Text; namespace Comm ...
- C++ 11学习(1):lambda表达式
转载请注明,来自:http://blog.csdn.net/skymanwu #include <iostream> #include <vector> #include &l ...
- Windows多线程同步系列之一-----互斥对象
多线程同步之互斥对象 作者:vpoet mail:vpoet_sir@163.com 对卖票问题进行线程间同步,本文将在上文的基础上,使用互斥对象对线程进行同步. 首先看看windows API ...
- A Bug's Life
#include<stdio.h> #include<string.h> ],num[]; int find(int x){ int r=x; while(r!=bug[r]) ...
- ZOJ问题(坑死了)
ZOJ问题 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- css设置
box-size允许您以特定的方式定义匹配某个区域的特定元素. content-box(默认):宽度和高度分别应用到元素的内容框.在宽度和高度之外绘制元素的内边距和边框.border-box:为元素设 ...
- Intent中的重要属性详解
Intent中的四个重要属性主要有四个,分别是Action.Data.Category.Extras. Intent作为联系各Activity,BroadcaseReciver,Service之间的纽 ...
- 搭建discuz论坛(2)
修改host文件: 使用ab做性能测试: E:\Apache2.2\bin>ab -n1000 -c100 http://bbs.ct.gd/
- CentOS 7 U盘安装解决找不到U盘问题
在使用U盘进入CentOS7系统安装选项时,按下Tab键,在屏幕下方出现:vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x ...
- E - The King
Description Once upon a time in a country far away lived a king and he had a big kingdom. He was a v ...