ITeye博客

ubuntu12.4网卡设置,自定义ip地址

weilingfeng98 · 2013-01-08 12:57 · 服务器 · linux · 操作系统 · Markdown

上网搜索修改linux网络地址的文章,在ubuntu12.04版本都不能用,然后去utuntu12.04官网看了一下,找到了修改ip地址的方法,在这里总结一下,以便记忆 1.ubuntu12.04的网络设置文件

vim /etc/network/interface 
# The loopback network interface
auto lo  
iface lo inet loopback

加入下面的配置

# The primary network interface 
auto eth0
iface eth0 inet static
address 10.12.146.84
netmask 255.255.255.0
gateway 10.12.146.1 

加入后查看该文件可可以看到

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo  
iface lo inet loopback
         
# The primary network interface 
auto eth0
iface eth0 inet static
address 10.12.146.84
netmask 255.255.255.0
gateway 10.12.146.1 

加入该配置后网络还不能生效,需执行该命令

/etc/init.d/netwoking restart

2.修改dns配置 如果设置ip后不能连接外网,则可能需要修改dns配置(当然如果你配置了桥接方式) 执行命令

 vim /etc/resolv.conf 

加入如下dns配置

nameserver 8.8.8.8
nameserver 8.8.4.4

这两个地址是google提供dns解析地址 到目前为止linux网络配置就完成了

ps:这了还有一篇介绍的比较详细,贴出来http://www.01happy.com/ubuntu-12-04-network-setting/

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。