您的位置:首页 > 其它

设置Ubuntu有线上网

2014-02-18 10:50 232 查看
感谢文章的主人:http://blog.chinaunix.net/uid-20789945-id-1841081.html

1. 在命令行下输入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

2. 上面动态和静态都还要设置DNS 在命令行下输入sudo vi /etc/resolv.conf 打开这个文件

,把这一行 nameserver 61.144.56.100 放到里边去,要在第一行!

3. 启网络:sudo /etc/init.d/networking restart

4. 测试一下看设置是否成功:可以先看一下:在命令行下输入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通
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: