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:以太网 硬 ...
随机推荐
- MVC 知识点学习1
1.@Scripts.Render("~/bundles/kindeditor");@Styles.Render("~/Css/") //(加载)引用bun ...
- MongoDB初学笔记
http://www.cnblogs.com/huangxincheng/archive/2012/02/18/2356595.html
- 一键编译go文件命令.bat
一键编译go文件命令.bat , 请新建 一键编译go文件命令.bat 文件,放到你的xxx.go文件目录下 ( 欢迎加入go语言群: 218160862 , 群内有实践) 点击加入 @e ...
- C语言拾遗
1. 没C++那么恶心的const C语言中的const修饰符用于修饰一个变量是const属性的.被C语言的const修饰的变量具有只读属性,并且不能被修改. const修饰的变量 != 常量,con ...
- IIS 发布 异常信息 AspNetInitClrHostFailureModule 的解决办法
昨天在一个客户那里使用Server 2008服务器配置IIS,都配置好之后竟然出现了错误信息,以前没有遇到过 "AspNetInitClrHostFailureModule",于是 ...
- 记账类APP竞品分析-挖财与随手记
注:本文更新中. 一.概览 1. 产品名称及版本 l 挖财11.2.0.0 免费版(2016/9/6发布) l 随手记10.2.8免费版(2016/8/22发布) 2. 设备信息 设备型号:i ...
- 【转】oracle内存分配和调优总结
转自 http://blog.itpub.net/12272958/viewspace-696834/ 一直都想总结一下oracle内存调整方面的知识,最近正好优化一个数据库内存参数,查找一些资料并且 ...
- Python selenium执行多个测试脚本时,浏览器多次打开登录账户
当类里面定义了 setUp() 方法的时候,测试程序会在执行每条测试项前先调用此方法:同样地,在全部测试项执行完毕后,tearDown() 方法也会被调用. 所以当在setUp()中执行打开浏览器后, ...
- C#的数组
一维数组: 定义数组 int[] 变量名=new int [n]; 例一:输入班级人数,再输入每个人的姓名. 例二:输入班级人数,输入每个人的分数,求平均分 冒泡排序: 二维数组: 定义二维数组 in ...
- Hot code replace failed
今天在eclipses中 修改代码,保存时会出时不时出现Hot code replace failed 对话框,谷歌提示是在debug模式下保存修改源代码会出现此类问题.确实,刚刚在用debug功能, ...