PS:很长时间没使用Ubuntu了,刚才安装个Ubuntu Server 12.04做测试。Ubuntu的网络设置跟Redhat系是不一样的,配置IP时发现跟以前的Ubuntu桌面版本也有所不同,记录如下:

1、配置静态IP地址:

# vim /etc/network/interfaces

原内容有如下4行:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

以上表示默认使用DHCP分配IP,修改为如下:


auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp

iface eth0 inet static
address 192.168.80.129
netmask 255.255.255.0
gateway 192.168.80.2

保存退出。
注意:只需要设置address(IP地址)、netmask(子网掩码)、gateway(网关)这三项就OK,network和broadcast这两项参数是可以不写的。

2、手动设置DNS服务器:

# vim /etc/resolv.conf

添加如下内容(这点所有Linux发行版都通用):

nameserver 192.168.80.2
nameserver 8.8.8.8

保存退出。

注意:重启Ubuntu后发现又不能上网了,问题出在/etc/resolv.conf。重启后,此文件配置的dns又被自动修改为默认值。所以需要永久性修改DNS。方法如下:

# vim /etc/resolvconf/resolv.conf.d/base
nameserver 192.168.80.2
nameserver 8.8.8.8

3、重启networking服务使其生效:

# /etc/init.d/networking restart

这样网络配置就永久生效。

Ubuntu Server 12.04 静态IP简洁配置的更多相关文章

  1. 【转】Ubuntu Server 12.04 静态IP简洁配置

    原文网址:http://blog.csdn.net/njchenyi/article/details/8715417 1.配置静态IP地址: # vim /etc/network/interfaces ...

  2. Ubuntu Server 12.04(14.04) 静态IP简洁配置

    1.配置静态IP地址: # vim /etc/network/interfaces 原内容有如下4行:auto loiface lo inet loopback auto eth0iface eth0 ...

  3. ubuntu server 18.04的安装 以及配置网络还有ssh服务

    ubuntu server 18.04的安装 以及配置网络还有ssh服务   服务器是 dell T420 安装过程中规中矩,其中最关键的是分区部分,由于是服务器,如果磁盘比较大的话,一定要用 uef ...

  4. ubuntu Server 设置主机静态 ip地址

    ubuntu Server 设置主机静态 ip地址 1:先输入 ifconfig 查看当前网络配置 2:然后关闭 eth0 网卡 sudo ifdown eth0 3:配置静态ip sudo vim ...

  5. 安装Drupal7.12+Postgresql9.1(Ubuntu Server 12.04)

    怀揣着为中小企业量身定做一整套开源软件解决方案的梦想开始了一个网站的搭建.http://osssme.org/ OS环境准备 这次是从OS开始安装的.最开始装Ubuntu12.04这里就不再赘述, 唯 ...

  6. [Linux] Ubuntu Server 12.04 LTS 平台上搭建WordPress(Nginx+MySql+PHP) Part II

    接着上一节继续搭建我们的LNMP平台,接下来我们安装PHP相关的服务 sudo apt-get install php5-cli php5-cgi php5-fpm php5-mcrypt php5- ...

  7. Ubuntu Server 12.04安装图解教程

                                                                                                Ubuntu S ...

  8. Ubuntu Server 16.04修改IP、DNS、hosts

    本文记录下Ubuntu Server 16.04修改IP.DNS.hosts的方法 -------- 1. Ubuntu Server 16.04修改IP sudo vi /etc/network/i ...

  9. Ubuntu Server 12.04 安装 Jabberd2 服务器

    本篇文章由:http://xinpure.com/install-ubuntu-server-12-04-jabberd2-server/ Ubuntu Server 12.04 安装 Jabberd ...

随机推荐

  1. 【Quick 3.3】资源脚本加密及热更新(三)热更新模块

    [Quick 3.3]资源脚本加密及热更新(三)热更新模块 注:本文基于Quick-cocos2dx-3.3版本编写 一.介绍 lua相对于c++开发的优点之一是代码可以在运行的时候才加载,基于此我们 ...

  2. matlab安装和入门

    下载iso镜像: ISO镜像下载地址链接: http://pan.baidu.com/s/1i31bu5J 密码: obo1 单独破解文件下载链接: http://pan.baidu.com/s/1c ...

  3. C#实现多国语言的界面切换

    在PictureStudio中,我需要实现多国语言的界面切换,而且切换各种语言版本的时候希望程序是动态的加载语言,不希望切换语言后重新启动程序. 实现这样的功能可以有很愚蠢的方法,比如说你可以在程序中 ...

  4. BZOJ3230: 相似子串

    3230: 相似子串 Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 913  Solved: 223[Submit][Status]Descripti ...

  5. activemq-5.13 在windows下部署应用

    一.下载windows压缩包 解压并双击F:\server\activemq-5.13.2\bin\win64\activemq.bat 启动,32位的系统为F:\server\activemq-5. ...

  6. import project后,出现Unable to get system library for the project

    import project 后,出现Unable to get system library for the project. 这是因为在import 一个项目的时候,没有指定android sdk ...

  7. Bootstrap基本使用[转]

    Bootstrap是Twitter推出的一个由动态CSS语言Less写成的开源CSS/HTML框架(同时提供Sass 移植版代码).Bootstrap提供了全面的基本及组件样式并自带了13个jQuer ...

  8. CentOS+Nginx一步一步开始配置负载均衡

    Nginx负载均衡的理解 http://www.linuxdiyf.com/linux/10205.html Nginx是一个轻量级的.高性能的WebServer,他主要可以干下面两件事: 作为htt ...

  9. 【JS】Intermediate1:The DOM

    1.DOM(The Document Object Model) A way to manipulate the structure and style of an HTML page. It rep ...

  10. 【CSS】Intermediate8:Page Layout

    1.Layout with CSS is easy. You just take a chunk of your page and shove it wherever you choose 2.pos ...