ubuntu 13.04 设定静态IP
2024-08-24 21:38:16
切换到root用户,然后进入/etc/network目录。备份interfaces文件(备份文件是一个好习惯)
下面编辑interfaces文件,添加如下语句:
# Assgin static IP by eric on -SEP-
iface eth0 inet static
address 192.168.196.135 #change to your static IP
netmask 255.255.255.0 #change to your netmask
gateway 192.168.196.255 #change to your getway
#We must specify dns-nameserver here
#in order to get internet access from host
dns-nameservers 192.168.196.255
auto eth0
编辑完成后的interfaces文件内容如下:
root@ubuntu:/etc/network# cat interfaces
# interfaces() file used by ifup() and ifdown()
auto lo
iface lo inet loopback #add by andy at --
# Assgin static IP by eric on -SEP-
iface eth0 inet static
address 192.168.196.135 #change to your static IP
netmask 255.255.255.0 #change to your netmask
gateway 192.168.196.255 #change to your getway
#We must specify dns-nameserver here
#in order to get internet access from host
dns-nameservers 192.168.196.255
auto eth0
下一步就是重启网卡:
root@ubuntu:/etc/network# /etc/init.d/networking restart
重启完成后,测试一下:
root@ubuntu:/etc/network# ping www.baidu.com.cn
PING www.a.shifen.com (220.181.112.244) () bytes of data.
bytes from 220.181.112.244: icmp_req= ttl= time=6.12 ms
bytes from 220.181.112.244: icmp_req= ttl= time=14.7 ms
OK。静态IP设置完成。
最新文章
- JSONP 理解 和 实例 讲解
- jquery.validate使用 - 自定义错误信息
- 如何 在远程虚拟机 里 破解 最新版 SQL Prompt
- kail2 linux 安装vmware tools
- linux资源使用配置文件 /etc/security/limits.conf和ulimit
- Hadoop.2.x_时间服务器搭建(CentOs6.6)
- [DFNews] GetData也出取证软件了
- 动态创建Layout
- 《Prism 5.0源码走读》Bootstrapper
- C开发 中原子性操作 , 除了快什么都不剩下了
- java基础之数据类型转换
- 解决Tomcat无法加载css和js等静态资源文件
- PHP打印各种金字塔!
- jquery val() and text().
- java中的类型转换
- C#语句 分支语句 if --- else ---
- CentOS7安装搭建.Net Core 2.0环境-详细步骤
- 【SPL标准库专题(10)】SPL Exceptions
- Ubuntu Linux系统环境变量配置文件
- 【PAT】1017 A除以B(20 分)