Linux Routing Problem

linuxroutingtcp

For a driver test I'm working on, I need to connect 2 Linux machines through a third Linux machine which acts as a router. Each machine has a proprietary network device with 2 ports so that one port is under subnet 11.x.x.x, and the second under subnet 12.x.x.x. The service port through which I remotely connect is under 10.x.x.x subnet. The test is done only on the proprietary devices in the 11 and 12 subnets.

An illusatration of the machines configuration:

A(11.0.0.1) <-> B(11.0.0.2) ||- C(11.0.0.3)

A(12.0.0.1) -|| B(12.0.0.2) <-> C(12.0.0.3)

(Literal description of the illustration: A's fist port is connected to B's first port, B's second port is connected to C's second port, and A's second port, and C's first port are disconnected.)

I've configured B (the routing machine) to forward IP requests. Then I configured A and C using the ip route shell command like so:

A

ip route add "12.0.0.0/16" via 11.0.0.2

B

ip route add "11.0.0.0/16" via 12.0.0.2

This works. I ping 12.0.0.3 from A with any packet size and it works, and vice versa. The problem is that my TCP code doesn't work properly between A and C. It only works with adjacent machines like A+B and B+C.

A simple python script that sends an "Hello World!" string over TCP works, but when the same script sends message larger than 1450 bytes, nothing goes through. The connection is established between the 2 hosts, but the information doesn't come through. It's important to mention here again that ping with packets larger than 1450 bytes works.

I think I'm probably doing something wrong here with the configuration of the routing machine or incomplete configuration in the ip route.

What could cause such a problem?

Best Answer

Just an idea, the MTU (Maximum Transmission Unit) is usually 1500 bytes. Check with ifconfig. 1450 sounds very close to 1500 - IP+TCP headers. If you raise the MTU on both interfaces on all machines, are you then able to transmit larger TCP packets?

ifconfig <device> mtu 2000

I dunno about the fact that ping packets above 1450 bytes works.

Related Topic