手机
当前位置:查字典教程网 >操作系统 >Ubuntu/Debian >ubuntu13.04设置静态ip的方法
ubuntu13.04设置静态ip的方法
摘要:操作系统:Ubuntu13.04设置静态IP:准备:1、查看在用的网卡、IP及子网掩码netmask,我的是eth0ifconfigeth0...

操作系统:Ubuntu13.04

设置静态IP:

准备:

1、查看在用的网卡、IP及子网掩码netmask, 我的是eth0

ifconfig</p> <p>eth0 Link encap:Ethernet HWaddr ec:9a:74:36:c8:8c</p> <p>inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0</p> <p># IP:192.168.1.100, netmask:255.255.255.0

2、查看网关gateway

route -n</p> <p>Destination Gateway Genmask Flags Metric Ref Use Iface</p> <p>0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0</p> <p># gateway: 192.168.1.1</p> <p># dns: 192.168.1.1 # 一般都和gateway,当然也可设置其他dns

3、现在开始设置静态ip

sudo vim /etc/network/interfaces</p> <p># interfaces(5) file used by ifup(8) and ifdown(8)</p> <p>auto lo</p> <p>iface lo inet loopback</p> <p># Set Static IP</p> <p>auto eth0 # 我的网卡</p> <p>iface eth0 inet static # 静态,与之相对的是动态(dhcp,即iface eth0 inet dhcp)</p> <p>address 192.168.1.100 # 你可以设置同网段的可用ip, 如192.168.1.102</p> <p>gateway 192.168.1.1 # 网关</p> <p>netmask 255.255.255.0 # 子网掩码</p> <p>dns-nameservers 192.168.1.1 # 可设置多个dns, 也可不在这里设置,编辑/etc/resolv.conf

dns-nameservers 114.114.114.114

4、重启网卡

sudo service networking restart</p> <p># 或 sudo /etc/init.d/networking restart</p> <p># 还是不行的话,请重启reboot</p> <p># 注意:</p> <p>#当没有设置dns-nameservers 时,需要在/etc/resolv.conf手动添加</p> <p>sudo vim /etc/resolv.cof</p> <p>nameserver 192.168.1.1

另外:

在相对较早的版本中,你需要设置/etc下的resolv.conf文件,并添加nameserver,这样才可以连接互联网,否则只能通过ip访问,无法解析网址.(nslookup 可查看网址ip, 当然,你必须先有dns).

在Ubuntu12.04之后,已经不再推荐这种方式,因为无论你想在该配置文件中设置什么值,重新启动后都会被还原为初始状态。(当然不包括开机启动脚本自动设置)

推荐的做法是,直接在interfaces配置文件中加入dns-nameservers <网关ip>这一行.

【ubuntu13.04设置静态ip的方法】相关文章:

Ubuntu 10.04 下Wine完美安装QQ2010正式版的方法

ubuntu下网页打开慢的解决方法

ubuntu12.04配置静态IP及设置DNS的方法

安装ubuntu12.04后无线网卡驱动安装方法分享

在Ubuntu中安装VirtualBox并配置USB设备支持的方法

Ubuntu 上安装IE浏览器的方法

Ubuntu Linux系统下设置静态IP的方法

ubuntu与windows远程连接的方法

Ubuntu 12.04系统配置方法教程(图文)

Ubuntu压缩/解压缩RAR文件的方法

精品推荐
分类导航