ubuntu 15.10 设置静态ip 分配固定ip 设置dns 设置网关 命令行配置ip 固定ip不生效怎么办
要用到的文件:
配置接口信息
/etc/network/interfaces
配置内容:
auto eth0
iface eth0 inet static
address 192.168.216.188
gateway 192.168.216.2
netmask 255.255.255.0
配置dns
/etc/resolvconf/resolv.conf.d/base
配置内容:nameserver 192.168.216.2
查看dns:
/etc/resolv.conf
命令:
查看系统网络信息
ifconfig
重启网络服务
/etc/init.d/networking restart
查看一下自己本机的信息(辅助而已)





可用的IP


现在自动分配的ip192.168.216.130
掩码是255.255.255.0
以0.0.0.0 开头的这行,他的gateway就是默认网关

查看dns
cat /etc/resolv.conf

这样我们就找到了一个可用的ip地址范围
:
网关

掩码

DNS

原来我们的网卡是自动分配的ip
修改为如下内容:

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.216.188
gateway 192.168.216.2
netmask 255.255.255.0
#是注释的意思
address 是ip地址,选择前请ping一下,看是否能够ping通,不通的话说明可用
gateway和netmask根据我们上面得到的即可
注意:如果配置了静态ip信息之后,不能上网,先来校验下dns是否配置,以及是否配置正确
还需要配置dns

看到这个地方的注释了吗?
这个文件其实是自动生成的,相当于一个连接,并不是真正的文件
即使你修改了这个地方,重启后,dns又会消失的,你可以试一下
它指向的其实是这个文件

我们只需要把我们的dns填写到这个地方即可
重启后就不会消失了
另外我们还可以在

这里面添加:
dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx
的方式添加
那么现在我们的interfaces为

dns的配置为:

设置好了,重启下服务
/etc/init.d/networking restart
需要root用户权限

如果还没生效就重启下ubuntu

互ping都是通的了

而且,也是可以上网的了


ubuntu 15.10 设置静态ip 分配固定ip 设置dns 设置网关 命令行配置ip 固定ip不生效怎么办的更多相关文章
- Ubuntu 15.10搭建IPSec L2TP服务器
以下步骤完全使用于Ubuntu 14.04版本 首先安装以下所需包 sudo apt-get install openswan xl2tpd ppp lsof!注意!Ubuntu 15.10会提示无法 ...
- 安装Ubuntu 15.10后要做的事
Ubuntu 15.10发布了,带来了很多新特性,同样也依然带着很多不习惯的东西,所以装完系统后还要进行一系列的优化. 1.删除libreoffice libreoffice虽然是开源的,但是Java ...
- 【转】安装Ubuntu 15.10后要做的事
Ubuntu 15.10发布了,带来了很多新特性,同样也依然带着很多不习惯的东西,所以装完系统后还要进行一系列的优化. 1.删除libreoffice libreoffice虽然是开源的,但是Java ...
- Ubuntu 15.10 下Tachyon安装
1 系统环境 Ubuntu 15.10, Java 1.7, Hadoop 2.6.0 HA, Spark-1.4.0 三台机器 spark-1423-0001: Master, Worker spa ...
- 转载:安装Ubuntu 15.10后要做的事
转载:安装Ubuntu 15.10后要做的事 原文转载于:http://blog.csdn.net/skykingf/article/details/45267517 Ubuntu 15.10发布了, ...
- Ubuntu 15.10 x64 安装 Android SDK
操作系统:Ubuntu 15.10 x64 目标:安装 Android SDK 本文最后更新时间:2015-11-3 安装32位库文件 2013年9月的iPhone 5s是第一款64位手机,而Andr ...
- Ubuntu 15.10安装elementary desktop
elementaryOS的风格类似于macos,基于Ubuntu改造,个人比较喜欢其界面理念,简单清晰.因此下载了elementaryOS Freya使用,使用过程中,各个软件版本的升级比较落后,比如 ...
- Ubuntu 15.10 x64 安装 Android SDK(转)
操作系统:Ubuntu 15.10 x64 目标:安装 Android SDK 本文最后更新时间:2015-11-3 安装32位库文件 2013年9月的iPhone 5s是第一款64位手机,而Andr ...
- ubuntu 15.10 安装swift开发环境 2016/4/17
ubuntu 15.10 64位 下载地址 https://swift.org/download/#using-downloads 1.首先在ubuntu终端上 (ctl+alt+t打开) 下载cla ...
随机推荐
- 如何解决PeopleSoft Process Scheduler发布问题
常见PeopleSoft进程调度程序发布问题 此发布问题中遇到的一些常见错误是: 将HTTP响应转换为UCS2时出错 XML文档对象创建失败. 无法处理来自Report Repository的HTTP ...
- sortable的基本属性
所有的事件回调函数都有两个参数:event和ui,浏览器自有event对象,和经过封装的ui对象 ui.helper - 表示sortable元素的JQuery对象,通常是当前元素的克隆对象 ...
- 动态规划-LIS1
https://vjudge.net/contest/297216?tdsourcetag=s_pctim_aiomsg#problem/J #include<bits/stdc++.h> ...
- Linux服务器之间进行文件目录映射/挂载(总结)
Linux服务器之间进行文件目录映射/挂载(总结) 需要实现的功能为:将192.168.10.10服务器下的 /home/要映射的目录/ ,映射为192.168.10.90服务器下的 /home/被映 ...
- Web前端-Vue.js必备框架(四)
Web前端-Vue.js必备框架(四) 计算属性: <div id="aaa"> {{ message.split('').reverse().join('') }} ...
- [Swift]LeetCode242. 有效的字母异位词 | Valid Anagram
Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: ...
- [Swift]LeetCode486. 预测赢家 | Predict the Winner
Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from eith ...
- [Swift]LeetCode718. 最长重复子数组 | Maximum Length of Repeated Subarray
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arra ...
- [Swift]LeetCode770. 基本计算器 IV | Basic Calculator IV
Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {&q ...
- [Swift]LeetCode893. 特殊等价字符串组 | Groups of Special-Equivalent Strings
You are given an array A of strings. Two strings S and T are special-equivalent if after any number ...