Chinaunix

标题: 如何配置ubuntu上网问题 [打印本页]

作者: swbbiao    时间: 2006-12-24 18:13
标题: 如何配置ubuntu上网问题
一:如果不行的话,你可以在命令行下输入sudo vi /etc/network/interfaces   打开这个文件安我的样式修一下:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
        address 192.168.0.178
        netmask 255.255.255.0
        gateway 192.168.0.1
上面是设置静态的.
如果自动获取的话就如下:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
二:上面动态和静态都还要设置DNS  在命令行下输入sudo vi /etc/resolv.conf 打开这个文件 把这一行 nameserver 61.144.56.100 放到里边去,要在第一行! 61.144.56.100可以设置你自己的DNS,这你懂的啦!
三:重启网络:sudo /etc/init.d/networking restart  
四:测试一下看设置是否成功:可以先看一下:在命令行下输入ifconfig 就能看到类似我这样的:
eth0      Link encap:Ethernet  HWaddr 00:16:76:3E:D3:5F
          inet addr:192.168.0.178  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::216:76ff:fe3e:d35f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:200398 errors:0 dropped:0 overruns:0 frame:0
          TX packets:187200 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:235438130 (224.5 MiB)  TX bytes:13786104 (13.1 MiB)
最后你看ping 一下能否ping 通啦!刚才设置的是ubuntu,红帽的你现在应该不要了吧!要的话我在写给你,红帽就更简单啦!你只要在命令行下输入netconfig然后会走出东西给你输入!!!然后/etc/init.d/networking restart  重启就行啦!这里是不用加sudo 的,这个你应该都知的啦!!!
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/25785/showart_220474.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2