在Ubuntu 12.04.1中设置静态IP
来源:互联网 发布:警察男友那个很大 知乎 编辑:程序博客网 时间:2024/06/07 10:57
原址:http://www.cnblogs.com/objectorl/archive/2012/09/27/vmware-ubuntu-nat-static-ip-settings.html
还有一种方法:system setting-》Newwork-》右下角Option-》IPv4 Settings-》Method: 选择Manual;Address选择Add,然后添加IP,Netmask,Gateway。
在Ubuntu 12.04.1中设置静态IP
1. 启动虚拟机Ubuntu系统,打开终端,利用如下命令打开并编辑网络接口配置文件:
sudo vi /etc/network/interfaces
2. 编辑文件如下:
auto loiface lo inet loopback# Assgin static IP by eric on 26-SEP-2012iface eth0 inet staticaddress 192.168.91.200 #change to your static IPnetmask 255.255.255.0 #change to your netmaskgateway 192.168.91.2 #change to your getway#We must specify dns-nameserver here#in order to get internet access from hostdns-nameservers 192.168.91.2auto eth0
说明
address是你要分配给你虚拟机的静态IP地址,可以从刚才我们找到的可用的子网IP范围中随便选择一个放在此处。
netmask是子网掩码
gateway是网关
注意:在相对较早的版本中,你需要设置/etc下的resolv.conf文件,并加入nameserver,这样才可以连接互联网。但在Ubuntu 12.04之后,已经不推荐这种方式了,因为无论你想该配置文件中设置什么值,重新启动之后都会被还原为初始状态。推荐的做法是直接在interfaces配置文件中加入dns-nameserver <网关IP>这一行。
3. 重启ubuntu的网卡
sudo /etc/init.d/networking restart
4. ping测试互联网连通性
ping www.baidu.com
如果ping有响应,那么恭喜你,你已经成功将虚拟机设置为静态IP,并且也已连入互联网。
0 0
- 在Ubuntu 12.04.1中设置静态IP
- 在Ubuntu 12.04.1中设置静态IP
- 在Ubuntu Linux中设置静态IP
- ubuntu server 12.04中设置静态IP
- ubuntu中设置静态IP
- ubuntu中设置静态IP
- 虚拟机中设置ubuntu为静态ip
- 虚拟机中ubuntu设置静态IP
- Ubuntu中设置静态IP和DNS
- ubuntu中nat模式设置静态ip
- Ubuntu中设置静态IP和DNS
- ubuntu设置静态IP
- Ubuntu设置静态IP
- Ubuntu设置静态 IP
- ubuntu ip静态设置
- Ubuntu设置静态IP
- ubuntu 设置静态IP
- Ubuntu静态IP设置
- varchar和char的区别
- PHP关键字
- 关于java中Map排序问题
- markdown编辑器使用
- sleep与wait的区别
- 在Ubuntu 12.04.1中设置静态IP
- eclipse使用教程系列一:配置环境变量和jdk以及集成tomcat_maven_svn图文详解
- 使用maven构建java项目
- 搜索专题总结
- iOS获取App版本号
- 第五届ACM大学生程序设计竞赛:angry_birds_again_and_again
- FTP协议笔记
- VC++采集txt文本中的两列数据
- linux网络编程基础(二)