Re: TCP/IP Port Relay

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



to clarify. your rules that you entered were (I am replacing it-304.ailife.com here with 10.1.1.1, and external_interface with eth0, and internal_interface with eth1 - for claritys sake):

/sbin/iptables -t nat -I PREROUTING -p tcp --dport 23 -j DNAT \
--to 10.1.9.2:3270
/sbin/iptables -I FORWARD -i eth0 -o eth1 \
-p tcp -d 10.1.9.2 --dport 3270 -j ACCEPT

this is normal port forward on linux box. you are forwarding linux box external port 23 to internal server port 3270. Is this what you want? You would need to connect to linux box external IP to port 23 from the 10.1.1.1 machine. You could change the forward rule to allow inbound traffic just from 10.1.1.1 (that's the host on the very left in your original chart):
/sbin/iptables -I FORWARD -s 10.1.1.1 -i eth0 -o eth1 \
-p tcp -d 10.1.9.2 --dport 3270 -j ACCEPT

the simplest way to test if port forwarding works is to telnet to port 23 on 10.1.9.2: telnet 10.1.9.2 23 # actually 23 is redundant, since it's the default port of telnet anyway. you should see something like this, indicating successful connection (assuming 10.1.1.1 is linux box):
Trying 10.1.9.2...
Connected to 10.1.9.2.
Escape character is '^]'.

if you get that, then port forwarding works.

if port forwarding is not what you need, then please explain in a little more detail

-vahur


Frank M. Ramaekers wrote:
There seems to be a problem with it

Normal (TN3270 traffic originating from the relay host):

10:44:29.667165 IP doylebrunson.ailife.com.46318 > 10.1.9.2.verismart: S 707994026:707994026(0) win 5840 <mss 1460,sackOK,timestamp 1913051656 0,nop,wscale 7>
10:44:29.685075 IP 10.1.9.2.verismart > doylebrunson.ailife.com.46318: S 1665830401:1665830401(0) ack 707994027 win 33396 <mss 1452,nop,wscale 0,nop,nop,timestamp 6736695 1913051656>
10:44:29.685137 IP doylebrunson.ailife.com.46318 > 10.1.9.2.verismart: . ack 1 win 46 <nop,nop,timestamp 1913051674 6736695>
10:44:29.707089 IP 10.1.9.2.verismart > doylebrunson.ailife.com.46318: P 1:4(3) ack 1 win 33396 <nop,nop,timestamp 6736695 1913051656>
10:44:29.707147 IP doylebrunson.ailife.com.46318 > 10.1.9.2.verismart: . ack 4 win 46 <nop,nop,timestamp 1913051696 6736695>

Relayed:

10:44:04.362686 IP it-304.ailife.com.bts-appserver > 10.1.9.2.verismart: S 3483673038:3483673038(0) win 65535 <mss 1460,nop,nop,sackOK>
10:44:07.294923 IP it-304.ailife.com.bts-appserver > 10.1.9.2.verismart: S 3483673038:3483673038(0) win 65535 <mss 1460,nop,nop,sackOK>

...and the client times out (The TN3270 server is running on port 3270/verismart).

Any ideas?


Frank M. Ramaekers Jr.
Systems Programmer                   MCP, MCP+I, MCSE & RHCE
American Income Life Insurance Co.   Phone: (254)761-6649
1200 Wooded Acres Dr.                Fax:   (254)741-5777
Waco, Texas  76710

-----Original Message-----
From: centos-bounces@xxxxxxxxxx [mailto:centos-bounces@xxxxxxxxxx] On Behalf Of Vahur Jõesalu
Sent: Thursday, April 24, 2008 9:27 AM
To: CentOS mailing list
Subject: Re:  TCP/IP Port Relay

hmm, if I understood you correctly, then this should work just fine (on linux firewall):

/sbin/iptables -t nat -I PREROUTING -p tcp --dport 23 -j DNAT \
--to telnetserverip:port-number
/sbin/iptables -I FORWARD -i external_interface -o internal_interface \ -p tcp -d telnetserverip --dport portnumberontelnetserver -j ACCEPT

after a reboot or firewall service restart it's gone again.

-vahur

Frank M. Ramaekers wrote:
What is the best way to temporarily setup a port relay.  I'm trying to
diagnose a problem with Cisco's latest VPN client and need to determine
if the problem is port number related.

e.g.  VPN client---------23-(Linux box to relay port)-------xx-(Telnet
server)

(Keep in mind this is temporary and for debugging purposes)

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

_____________________________________________________

This message contains information which is privileged and confidential and is solely for the use of the

intended recipient. If you are not the intended recipient, be aware that any review, disclosure,

copying, distribution, or use of the contents of this message is strictly prohibited. If you have

received this in error, please destroy it immediately and notify us at PrivacyAct@xxxxxxxxxxx
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux