免费注册 查看新帖 |

Chinaunix

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

linux配置静态路由解决网络问题 [复制链接]

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

作者: panaiec  出自: http://www.linuxdiyf.com
今天,需要建立一个dblink,但一直没有成功,于是检查网络:
因为屏蔽了ping,所以用telnet试试:
[root@localhost root]# telnet 172.0.2.90
Trying 172.0.2.90...
telnet: connect to address 172.0.2.90: No route to host
看来是网络的问题。检查一下网卡的路由走向:
[root@localhost root]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
202.96.54.0 * 255.255.255.128 U 0 0 0 eth1
172.25.0.0 * 255.255.0.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 202.96.54.1 0.0.0.0 UG 0 0 0 eth1
发现没有为172.0网段配置路由,也没有为eth0配置默认路由(eth0是内网网卡、eth1是外网网卡)
为eth0手工配置静态路由:
[root@localhost root]# route add -net 172.0.0.0 netmask 255.255.0.0 gw 172.25.13.1 eth0
此时路由走向状况是:
[root@localhost root]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
202.96.54.0 0.0.0.0 255.255.255.128 U 0 0 0 eth1
172.25.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
172.0.0.0 172.25.13.1 255.255.0.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 202.96.54.1 0.0.0.0 UG 0 0 0 eth1
再用telnet测试连接:
[root@localhost root]# route add -net 172.0.0.0 netmask 255.255.0.0 gw 172.25.13.1 eth0
[root@localhost root]# telnet 172.0.2.90
Trying 172.0.2.90...
Connected to 172.0.2.90.
Escape character is '^]'.
可见,网络已经是连通的了,dblink也可以正常访问数据了。

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

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP