LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Port forwarding and remote X11 sessions (https://www.linuxquestions.org/questions/linux-networking-3/port-forwarding-and-remote-x11-sessions-17268/)

lfabiani 03-29-2002 07:15 AM

Port forwarding and remote X11 sessions
 
Hello!

I have the following situation: I have a DIGITAL WorkStation that runs True64 unix. I have a linux box that is a server to a private LAN (this box is the gateway)

I am trying to setup port forwarding so that clients from the private LAN could run programs from the DIGITAL box (like Fluent, emacs, etc...)


What I did was the following:
I've set up iptables on my linux box, and ip forwarding works fine.
Then I've tried to do a port forwarding of port 6001 to a 192.168.0.3 IP.

then on the .0.3 client I typed
xhost +

Then on my digital box I've typed
DISPLAY=myip:1.0 (where myip is the IP of the gateway)
export DISPLAY

then I ran emacs, but nothing happened....

What should I do??

Sixpax 03-29-2002 04:14 PM

You need to somehow verify that the port forwarding is working. What you might want to do is setup some simple service like FTP on the DIGITAL machine and do port forwarding on the Linux gateway to port 21. Then see if that works.

lfabiani 03-30-2002 03:19 PM

Hi!

Thank you for your answer

OK, I will test it...

But the ports of X sessions are correct? (6000 or up, depending on the DISPLAY=...)

Sixpax 03-30-2002 07:32 PM

Yes, 6000+DISPLAY are the ports X listens on.

lfabiani 03-31-2002 07:26 AM

OK, this is what I found:

Port forwarding is OK (I forwarded port 26 of the gateway to the 23 of the client and was able to telnet the client from other machines)

On the linux gateway I do, after setting up iptables with the rc.firewall script, that I got from a HOW-TO:

/sbin/iptables -A FORWARD -i eth1 -o eth0 -p tcp --dport 6001 -j ACCEPT
/sbin/iptables -A PREROUTING -t nat -p tcp -d linux_gateway_ip --dport 6001 -j DNAT --to 192.168.0.3:6001

On the client machine I do a:

xhost +


On the DIGITAL computer I do a:

DISPLAY=linux_gateway_ip:1.0
export DISPLAY
emacs &


The emacs proccess lasts a minute or so, and I guess it is trying to connect without success... Then it displays a error message:
"Error: Can open display: ..."

Since port forwarding works (I tested it with telnet), and the proccess doesn't die immediatly, I think that I'm missing something....
:confused:

Sixpax 03-31-2002 11:21 AM

Ok, I'm missing a few things in your configuration myself...

First of all, what type of machine is that .0.3 client? and how did you set it up to listen on port 6001? Normally X listens on port 6000 unless you start another X session or do some funkiness.

lfabiani 04-01-2002 06:11 AM

The 192.168.0.3 is a Red Hat linux.

I didn't set up X to listen to 6001 port.... :( I thought it would automatically.....

Ok so if I just redirect port 6001 on the gateway to port 6000 to the red hat client, it should be ok ???


All times are GMT -5. The time now is 03:28 AM.