T
T
TIEugene2012-11-16 10:23:28
System administration
TIEugene, 2012-11-16 10:23:28

How does rinetd work?

Or another TCP redirector.
Let there be machine A that works with machine B - which redirects everything (or what it needs) to machine C using rinetd.
Is the address A somehow visible on the BC section? This means the means of the network provider C.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
I
ivnik, 2012-11-16
@ivnik

Judging by the manu, this is just a tcp proxy. Accordingly, machine A works only with B and does not know about any machine C. And machine C receives connections from machine B and does not know about any A.

I
ivnik, 2012-11-16
@ivnik

Added to config:
127.0.0.1 127 192.168.0.1 192
Run tcpdump and telnet:

$ telnet 127.0.0.1 127
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.

# tcpdump -i any -n port 127 or port 192
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
12:42:40.869870 IP 127.0.0.1.42205 > 127.0.0.1.127: Flags [S], seq 3890575008, win 32792, options [mss 16396,sackOK,TS val 86107963 ecr 0,nop,wscale 7], length 0
12:42:40.869882 IP 127.0.0.1.127 > 127.0.0.1.42205: Flags [S.], seq 293205897, ack 3890575009, win 32768, options [mss 16396,sackOK,TS val 86107963 ecr,wscale96 86107 ], length 0
12:42:40.869891 IP 127.0.0.1.42205 > 127.0.0.1.127: Flags [.], ack 1, win 257, options [nop,nop,TS val 86107963 ecr 86107963], length 0
12:42:40.869959 IP 192.168.0.1.36533 > 192.168.0.1.192: Flags [S], seq 3984613777, win 32792, options [mss 16396,sackOK,TS val 86107963 ecr 0,nop,wscale 7], length 0
12:42:40.869967 IP 192.168.0.1.192 > 192.168.0.1.36533: Flags [R.], seq 0, ack 3984613778, win 0, length 0
12:42:40.870023 IP 127.0.0.1.127 > 127.0.0.1.42205: Flags [F.], seq 1, ack 1, win 256, options [nop,nop,TS val 86107963 ecr 86107963], length 0
12:42:40.870071 IP 127.0.0.1.42205 > 127.0.0.1.127: Flags [F.], seq 1, ack 2, win 257, options [nop,nop,TS val 86107963 ecr 86107963], length 0
12:42:40.870085 IP 127.0.0.1.127 > 127.0.0.1.42205: Flags [.], ack 2, win 256, options [nop,nop,TS val 86107963 ecr 86107963], length 0

It can be seen that packets from 192.168.0.1 are sent to port 192, i.e. address 127.0.0.1 is off.

S
shadowalone, 2012-11-16
@shadowalone

rinetd uses DNAT, and accordingly it is not difficult to understand that if settings are made for port forwarding to a machine on the internal network, and the address of the machine with rinetd is not specified by the gateway on this machine, then nothing will work.
You can experiment.

T
TIEugene, 2012-11-16
@TIEugene

In general, I have a slightly different task - to forward traffic between two networks via the Internet using external machines.
Roughly speaking, to break the visual connection between the two networks. Nutyponel © :-)
That's why I'm looking for such a hosting (not Russian, essno) so that I can put a proxy or iptables or rinetd.
The discussion shows that rinetd will suffice.

R
ragus, 2012-11-25
@ragus

in general, rinetd works stupidly: it listens to a socket, when a connection arrives, it does accept () and, in accordance with the rules, makes connect () to the host: port, which is specified in the config. then in a loop: we read from one socket into the buffer. write to another socket.
buffer in userspace so that data is constantly running along the path kernel <=> userspace< => kernel. This option eats cpu and does not differ in performance. yes, and there is no tunneling essno))))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question