免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 738 | 回复: 0
打印 上一主题 下一主题

Ubuntu中配置网络笔记 [复制链接]

论坛徽章:
1
15-16赛季CBA联赛之北控
日期:2022-03-04 22:35:50
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-04-20 14:09 |只看该作者 |倒序浏览

作者: ginceo  出自: http://www.linuxdiyf.com
每次在装ubuntu的时候,如果连上网络,到设置apt源的那步,总要等半天, 所以我就拔掉网线,选择为暂不配置
装完之后要第一件事要配置ip,在配置好/etc/network/interfaces之后,也配置了/etc/resolv.conf
内网的机器都可以ping通 但是ping 外网的就是不行,一直提示 network is unreachable
在增加一个缺省的网关后 所有问题ok
我初学linux 希望各位高手多多指教
我的配置如下:
配置静态IP地址
sudo vi /etc/network/interfaces
内容如下:
auto lo
iface lo inet loopback
auto eth0
auto eth1
#iface eth1 inet dhcp
iface eth1 inet static
address 192.168.1.8
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
geteway 192.168.1.1
配置DNS
vi /etc/resolv.conf
增加内容:
nameserver 192.168.1.1
naserver 202.106.0.20
配置网关
route add default gw 192.168.1.1
重新启动网络配置
/etc/init.d/networking restart
这条命令就可以搞定
route add default gw 192.168.1.1
后面那是你的网关。
现在route一下
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
default my.router 0.0.0.0 UG 0 0 0 eth0
之前如果没有添加的话,只有上面的第一条。第二条是新加进去的。如果还访问不了,哪你的情况可能有点特殊哦。
这样重启以后 就不能用了。
修改
编辑 /etc/network/interfaces
添加 gateway 192.168.1.1

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/31/showart_570065.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP