Ubuntu setup Static IP Address
Change Ubuntu Server from DHCP to a Static IP Address
If the Ubuntu Server installer has set your server to use DHCP, you will want to change it to a static IP address so that people can actually use it.
Changing this setting without a GUI will require some text editing, but that’s classic linux, right?
Let’s open up the /etc/network/interfaces file. I’m going to use vi, but you can choose a different editor
sudo vi /etc/network/interfaces
For the primary interface, which is usually eth0, you will see these lines:
auto eth0
iface eth0 inet dhcp
As you can see, it’s using DHCP right now. We are going to change
dhcp to static, and then there are a number of options that should be
added below it. Obviously you’d customize this to your network.
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1
Now we’ll need to add in the DNS settings by editing the resolv.conf file:
sudo vi /etc/resolv.conf
On the line ‘name server xxx.xxx.xxx.xxx’ replace the x with the IP
of your name server. (You can do ifconfig /all to find out what they
are)
You need to also remove the dhcp client for this to stick (thanks to
Peter for noticing). You might need to remove dhcp-client3 instead.
sudo apt-get remove dhcp-client
Now we’ll just need to restart the networking components:
sudo /etc/init.d/networking restart
Ping www.google.com. If you get a response, name resolution is working(unless of course if google is in your hosts file).
Really pretty simple.
Updated Thanks to Nickname007 in the comments for noting that I forgot the DNS entries in the guide.
http://blog.163.com/howl_prowler/blog/static/26619715201011225642570/
Ubuntu setup Static IP Address的更多相关文章
- 给ubuntu设置静态ip —— How to set static IP Address in Ubuntu Server 16.04
原文: http://www.configserverfirewall.com/ubuntu-linux/ubuntu-set-static-ip-address/ ----------------- ...
- Config Static IP Address manually in Ubuntu
The process of the configuration of static IP address in Ubuntu is as follows: ``` $ sudo vim /etc/n ...
- How to configure a static IP address on CentOS 7(CentOS7静态IP地址设置)
Question: On CentOS 7, I want to switch from DHCP to static IP address configuration with one of my ...
- Setting up a static IP address in Ubuntu
sudo gedit /etc/network/interfaces Change the line iface eth0 inet dhcp to iface eth0 inet static an ...
- ubuntu使用git的时:Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
1:问题现象: hlp@hlp:~/code/github_code/catch_imooc1$ git push origin master Warning: Permanently added t ...
- ubuntu 修改静态IP和DNS
1.修改配置文件/etc/network/interfacesroot@ubuntu:~# sudo vi /etc/network/interfaces 添加以下内容:auto eth0 ...
- ubuntu无线上网静态ip配置以及配置静态IP 之后无法正常上网的解决方案
一. 配置无线网络的静态IP 编辑/etc/network/interfaces文件如下: auto lo wlan0 iface lo inet loopback iface wlan0 inet ...
- 给 Virtualbox 中 Ubuntu 系统设置静态 IP ,让 DNS 配置信息不会在重启后被清除
虚拟机网络选择 桥接网卡 模式. 主要涉及两个步骤: 1. 修改 /etc/network/interfaces 文件: 2. 修改 dns : 第一步,修改 interfaces 文件: sudo ...
- Linux - ubuntu 设置固定ip和设置dns
ubuntu 设置固定ip和设置dns 1.ifconfig 查看网卡名称 root@jiqing-virtual-machine:~# ifconfig ens32 Link encap:以太网 硬 ...
随机推荐
- Java数组和C++异同
一.定义和初始化 1.Jave定义和初始化: Java:两种方式 Type[] A; Type A[]; 定义时不能指定数组的长度 静态初始化: A = new Type[][Ele1,Ele2 ...
- Windows多网卡上网设置
http://blog.tianya.cn/blogger/post_show.asp?BlogID=1566293&PostID=12984307
- 自增序号,而且默认变量就是$i,也就是说在你的volist标签之内,可以直接使用$i
<volist name="vlist" id="v"> <{$i}> // 直接使用$i </volist>
- input点击链接另一个页面,各种操作
1.链接到某页<input type="button" name="Submit" value="确 定" class="b ...
- 用户管理-------userManage
mysql的登录用户密码修改 step1: kill 系统了的mysql进程 step2: 用以下命令启动mysql,以不检查权限的方式启动 #mysqld_safe -skip-grant-ta ...
- day05 java JDBC案例—Android小白的学习笔记
1.要从键盘录入用户名与密码我们需要使用Scanner类完成操作 2.接收到用户名与密码后,我们需要调用jdbc程序根据用户名与密码查询数据库 User.java package com.superg ...
- linux git 推送空文件夹
/********************************************************************************* * linux git 推送空文件 ...
- C++类大小
对于C++中类的大小,主要针对于无成员的空类大小,编译器会对该类进行优化,情况主要分为是否有虚表(虚函数)两种类型,对于无虚函数的类,该类大小均为1个字节(编译器插入一个char表示该类的存在),而出 ...
- iOS 统计App 的代码总行数
打开Terminal,cd 到项目的根目录下,输入以下命令 find . -name "*.m" -or -name "*.mm" -or -name &quo ...
- js 获取小数点位数方法及 字符串与数字之间相互转换方法
1.获取小数点位数方法 a. 使用 js 中 subsrting,indexOf,parseFloat三个函数,代码如下: var s = "22.127456" ;//s 为 字 ...