linux配置静态路由解决网络问题

今天,需要建立一个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也可以正常访问数据了。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/231499/viewspace-63806/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/231499/viewspace-63806/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值