ubuntu 12.04 静态ip的设置方法
来源:互联网 发布:三坐标编程工资待遇 编辑:程序博客网 时间:2024/04/29 05:26
原文 http://blog.csdn.net/phpdata/article/details/12655733
ubuntu 12.04的网络设置文件是/etc/network/interfaces,打开文件,会看到
auto loiface lo inet loopback
这边的设置是本地回路。在后面加上
auto eth0iface eth0 inet staticaddress 192.168.1.230(ip地址)netmask 255.255.255.0(子网掩码)gateway 192.168.1.1(网关)
其中eth0就是电脑的网卡,如果电脑有多块网卡,比如还会有eth1,都可以在这里进行设置。iface eth0 inet 设置为dhcp是动态获取IP,设置为static则用自定义的IP。这边要自定义IP地址,所以选择static选项。
重新启动网络服务
sudo /etc/init.d/networking restart
重启好后,用ifconfig看下eth0,是不是改成自己需要的IP地址了。
设置dns
ip设置好后,如果直接ping www.baidu.com会发现ping不通,因为dns还没设置,编辑/etc/resolv.conf,加上dns服务器地址。
nameserver 8.8.8.8nameserver 8.8.4.4
这两个是Google提供的免费DNS服务器的IP地址。
(因为每次重启电脑后他系统都自动修改DNS配置文件 /etc/resolv.conf,所以每次都要重新设置,特别麻烦; 解决方案:
/etc/resolv.conf中的DNS配置是从/etc/resolvconf/resolv.conf.d/head中加载而来
所以可以直接修改 /etc/resolvconf/resolv.conf.d/head文件,即把
nameserver 8.8.8.8nameserver 8.8.4.4
两行追加到文件中
)
0 0
- ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- ubuntu 12.04 静态ip的设置方法
- Ubuntu设置静态IP的方法
- ubuntu设置静态IP的方法
- ubuntu设置静态ip的方法
- Ubuntu静态ip的设置方法
- ubuntu linux设置静态ip的方法
- Ubuntu设置静态ip方法
- Ubuntu的静态IP设置
- ubuntu静态IP的设置
- 虚拟机中ubuntu设置静态IP的方法
- Ubuntu Linux系统下设置静态IP的方法
- 操作系统知识点总结
- 2017 C4天梯 L2-017. 人以群分
- java设计模式之中介者模式
- 有序链表合并&有序数组合并
- The Triangle
- ubuntu 12.04 静态ip的设置方法
- MySql的语法
- linux网络编程之epoll模型
- URLDecoder.decode与URLEncoder.encode
- HTTP长连接与短链接以及推送技术原理
- android ListView 滑动进度保存和恢复
- 2036.改革春风吹满地
- ros中tf的新的学习感悟
- Linux挂载概念理解