ubuntu server静态IP和DNS服务器设置

Ubuntu的网络参数保存在文件 /etc/network/interfaces中,

默认设置使用dhcp,动态IP获取。

设置静态ip的方法如下:

1) 编辑 /etc/network/interfaces

1.1)将dhcp 一行屏蔽

# The primary network interface

auto eth0

#iface eth0 inet dhcp

1.2)添加和静态ip有关的参数

# The primary network interface

iface eth0 inet static

address 192.168.1,151

netmask 255.255.255.0

gateway 192.168.1.1

2)编辑 /etc/resolv.conf,设置dns,如果重启还原,则还需要修改
/etc/resolvconf/resolv.conf.d/base文件,两个内容一样

nameserver 192.168.1.1 #路由网关

nameserver 8.8.8.8 #google的dns服务器

3)执行下面两个命令,启用新设置

$sudo ifdown eth0

$sudo ifup eth0

时间: 2024-08-12 14:55:40

ubuntu server静态IP和DNS服务器设置的相关文章

ubuntu下静态IP、DNS配置

一.配置ip ubuntu的网络配置信息放在 /etc/network/interfaces 中, 如果配置动态获取ip,则在上述文件中加入以下内容: auto eth0 iface eth0 inet dhcp 如果配置静态ip,则添加如下内容: auto eth0 iface eth0 inet static address 192.168.33.201 netmask 255.255.255.0 gateway 192.168.33.1 要是配置生效,需要重启网卡: ifconfig et

Ubuntu 12.04 中自定义DNS服务器设置

首先我们需要创建一个文件/etc/resolvconf/resolv.conf.d/tail: #vim /etc/resolvconf/resolv.conf.d/tail 然后我们在这个文件里写入自己要添加的DNS服务器,格式与以前的/etc/resolv.conf文件一致: nameserver 8.8.8.8nameserver 8.8.4.4 然后输入wq保存退出.接下来我们重启下resolvconf程序,让配置生效: #/etc/init.d/resolvconf restart

[Ubuntu] 如何设置静态 IP 和 DNS

要设置 IP 和 DNS 解析服务器,编辑 /etc/network/interfaces: # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.6 gateway 192.168.1.1 netmask 255.255.255.0 dns-nameservers 192.168.1.

CentOS7修改设置静态IP和DNS

当前位置: 主页 > CentOS入门 > 系统配置 > CentOS7修改设置静态IP和DNS 时间:2016-02-22 00:55来源:blog.csdn.net 作者:get_set的专栏 举报 点击:4048次 最近因为学习Puppet,用虚拟机装了个CentOS,使用的NAT的网络模式,为了防止再次启动系统的时候网络IP发生变化,因此设置静态IP和DNS. 由于CentOS是最小化安装,没有ifconfig命令,因此可以采用ip命令查看. 查看IP分配情况: # ip add

CentOS7 修改设置静态IP和DNS

最近因为学习Puppet,用虚拟机装了个CentOS,使用的NAT的网络模式,为了防止再次启动系统的时候网络IP发生变化,因此设置静态IP和DNS. 由于CentOS是最小化安装,没有ifconfig命令,因此可以采用ip命令查看. 查看IP分配情况: # ip addr 发现里边只有一个LOOPBACK的127.0.0.1的回环地址,原来CentOS刚安装后默认是不启动网络连接的. 设置IP和DNS主要在下面的配置文件中修改: # vi /etc/sysconfig/network-scrip

ubuntu无线上网静态ip配置以及配置静态IP 之后无法正常上网的解决方案

一. 配置无线网络的静态IP 编辑/etc/network/interfaces文件如下: auto lo wlan0 iface lo inet loopback iface wlan0 inet static address 192.168.1.120 #(根据具体情况填写) netmask 255.255.255.0 #(根据具体情况填写) gateway 192.168.1.1 #(根据具体情况填写) dns-nameservers 8.8.8.8 8.8.4.4 #(根据具体情况填写)

Ubuntu配置静态IP

Ubuntu配置静态IP 静态IP配置 Ubuntu 的网络配置信息放在 /etc/network/interfaces 中,如果配置动态获取ip,则在上述文件中加入以下内容:使用如下命令打开网络配置信息文件: sudo gedit /etc/network/interfaces 编辑文件(注意检察你的getway是否正确.): auto eth0iface eth0 inet staticaddress 192.168.8.119netmask 255.255.255.0gateway 192

Ubuntu Server 12.04 安装 Jabberd2 服务器

本篇文章由:http://xinpure.com/install-ubuntu-server-12-04-jabberd2-server/ Ubuntu Server 12.04 安装 Jabberd2 服务器 安装 Jabberd2 在终端输入以下命令安装 Jabberd2: sudo apt-get install jabberd2 配置 修改 /etc/jabberd2/sm.xml 文件 1.修改服务器地址 ( 第6行 ): 6 <id>localhost.localdomain<

Ubuntu中设置静态IP和DNS(转载)

原文地址:http://blog.sina.com.cn/s/blog_669421480102v3bb.html VMware 中使用网络,对虚拟机设置静态IP: 在Ubuntu中设置静态IP共两步:1>设置IP:2>设置DNS 1>设置IP    编辑 /etc/network/interface文件:       sudo vi /etc/network/interface auto eth0    iface eth0 inet static              //  指