Configuring Static Routing in linux solves network problems

Source: Internet
Author: User
In linux, configure Static Routing to solve network problems-Linux Enterprise Application-Linux server application information. The following is a detailed description. Today, we need to establish a dblink, but it has never been successful. So we checked the network:

Use telnet because ping is blocked:

[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

It seems to be a network problem. Check the route direction of the NIC:

[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

No route is configured for the 172.0 CIDR block, and no default route is configured for eth0 (eth0 is an intranet Nic, and eth1 is an Internet Nic)

Manually configure static routes for eth0:

[Root @ localhost root] # route add-net 172.0.0.0 netmask 255.255.0.0 gw 172.25.13.1 eth0

The Route status is as follows:

[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.255.128 U 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

Use telnet to test the connection:

[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 '^]'.

It can be seen that the network is connected, and dblink can also access data normally.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.