Ubuntu Server Edition 配置静态IP地址
来源:互联网 发布:文言文翻译器软件 编辑:程序博客网 时间:2024/05/17 02:56
转自:http://www.linuxidc.com/Linux/2009-09/21769.htm
Ubuntu Server Edition 配置静态IP地址学习笔记。
网卡配置文件位于
/etc/network/interface
假如要配置设备名为 eth0 的网卡则找到 eth0 原来的配置项
iface eth0 inet dhcp
将其注释掉然后修改其获取IP方式为静态IP
iface eth0 inet static #意思是将网卡0设置为静态网址
address 192.168.1.250 #IP地址
netmask 255.255.255.0 #子网掩码
gateway 192.168.1.1 #网关
如果原来是通过DHCP方式获取IP和 DNS 服务器的那么还可能需要修改DNS服务器的配置。
dns 服务器配置文件为
/etc/resolv.conf
nameserver 202.102.154.3
nameserver 202.102.152.3
然后重启这个网卡以便配置生效
sudo ifdown eth0
sudo ifup eth0
转自:http://www.howtogeek.com/howto/ubuntu/change-ubuntu-server-from-dhcp-to-a-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
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.
- Ubuntu Server Edition 配置静态IP地址
- ubuntu server 12.04配置静态IP地址
- ubuntu配置静态IP地址
- Ubuntu配置静态IP地址
- ubuntu配置静态ip地址
- ubuntu 配置静态ip地址
- Ubuntu server配置IP地址
- 解析网卡配置静态Ubuntu IP地址
- Ubuntu配置静态IP地址+上网
- Ubuntu下静态IP地址的配置
- ubuntu-15 x64 配置静态IP地址
- Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu Server 12.04 静态IP简洁配置
- ubuntu server 配置静态IP,无线上网
- Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu server中静态IP配置
- Ubuntu Server 12.04静态IP简洁配置
- 向Windows Phone 7手机部署应用程序
- nltk安装 linux
- 写自已的System.Web.Routing.dll提升性能和增加功能!
- CAN总线波特率计算及设置方法(STM32,SJA1000,LPC2292)
- Linux安装Nvidia显卡驱动:禁用The Nouveau kernel driver的方法!
- Ubuntu Server Edition 配置静态IP地址
- DDB和DIB的区别
- maven default lifecycle
- java设计模式-访问者模式
- 在Windows XP中安装Java SE
- 从access中读取数据
- Linux文件系统删除文件深入剖析
- ACE主动对象模式
- 去除使用log时的警告信息:"LOG_TAG" redefined 的方法