happem

Ubuntu系统下:如何快速配置网络

在Ubuntu系统下工作,只掌握图形化的配置工具还是不够的,系统在出现故障的时候往往使用的是终端的操作模式,下面里仁3G培训讲师介绍在终端下如何配置网络。

临时改变网络参数

.Ifconfig:查看和配置IP地址。

$ifconfig eth0

$sudo ifconfig eth0 192.168.9.23 netmask 255.255.255.0

route:配置路由参数

$sudo route add default gw 192.168.9.1 eth0 #设置默认网关

使参数立即生效

$sudo/etc/init.d/networking restart

修改网络配置文件

设置DNS服务器。

$sudo echo‘nameserver=219.150.32.132>/etc/resolv.conf’

编辑/etc/network/interfaces。

$sudo vim /etc/network/interfaces

  Auto lo

  Iface lo inet loopback

 Iface eth0 inet static   #设置eth0,静态IP

 Address 192.168.8.45

  Netmask 255.255.255.0

  Gateway 192.168.8.1

  Iface eht1inet dhcp #设置eth1为dhcp模式

可以通过下面的命令设置路由。

  Up route add default gw 192.168.8.1 eth1

  Up route add –net 192.168.8.0/24 gw 192.168.8.1 eth0

  Down route del –net 192.168.8.0/24 gw 192.168.8.1 eth0

其中,当网络接口up时,执行它后面的命令;当网络接口down时,执行它后面的命令。

使用参数立即生效。

$sudo /etc/init.d/networking restart 转:www.lirenedu.org

posted on 2012-09-12 14:57 happem 阅读(264) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理