Forwarding traffic from a host to a host's container
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have two hosts in a network 192.168.0.0/24
:
- Host A
192.168.0.15
- Host B
192.168.0.13
And there is a remote ssh tunnel from B
to A
:
ssh -R 192.168.0.13:8080:192.168.0.15:8002 192.168.0.13 -N
and that tunnel works.
Host A
runs a container nginx
that runs nginx on a port 80. I would like to forward a traffic from 192.168.0.15:8002
to that nginx server. How to do it?
So,
if someone send a GET request
with curl 192.168.0.13:8080
he will get response from nginx run on 192.168.0.15
in a container. The flow should be:
192.168.0.14 (for example) ---GET--> 192.168.0.13:8080
192.168.0.13 --(SSH TUNNEL)--> 192.168.0.15:8002
192.168.0.15:8002 -----------> 172.17.0.2:80 (nginx container)
172.17.0.2 ------------> 192.168.0.15
192.168.0.15 ------------> 192.168.0.13
192.168.0.13 ------------> 192.168.0.14
P.S.
I have to use iptables- I cannot change an existing tunnel.
networking iptables docker
add a comment |Â
up vote
0
down vote
favorite
I have two hosts in a network 192.168.0.0/24
:
- Host A
192.168.0.15
- Host B
192.168.0.13
And there is a remote ssh tunnel from B
to A
:
ssh -R 192.168.0.13:8080:192.168.0.15:8002 192.168.0.13 -N
and that tunnel works.
Host A
runs a container nginx
that runs nginx on a port 80. I would like to forward a traffic from 192.168.0.15:8002
to that nginx server. How to do it?
So,
if someone send a GET request
with curl 192.168.0.13:8080
he will get response from nginx run on 192.168.0.15
in a container. The flow should be:
192.168.0.14 (for example) ---GET--> 192.168.0.13:8080
192.168.0.13 --(SSH TUNNEL)--> 192.168.0.15:8002
192.168.0.15:8002 -----------> 172.17.0.2:80 (nginx container)
172.17.0.2 ------------> 192.168.0.15
192.168.0.15 ------------> 192.168.0.13
192.168.0.13 ------------> 192.168.0.14
P.S.
I have to use iptables- I cannot change an existing tunnel.
networking iptables docker
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have two hosts in a network 192.168.0.0/24
:
- Host A
192.168.0.15
- Host B
192.168.0.13
And there is a remote ssh tunnel from B
to A
:
ssh -R 192.168.0.13:8080:192.168.0.15:8002 192.168.0.13 -N
and that tunnel works.
Host A
runs a container nginx
that runs nginx on a port 80. I would like to forward a traffic from 192.168.0.15:8002
to that nginx server. How to do it?
So,
if someone send a GET request
with curl 192.168.0.13:8080
he will get response from nginx run on 192.168.0.15
in a container. The flow should be:
192.168.0.14 (for example) ---GET--> 192.168.0.13:8080
192.168.0.13 --(SSH TUNNEL)--> 192.168.0.15:8002
192.168.0.15:8002 -----------> 172.17.0.2:80 (nginx container)
172.17.0.2 ------------> 192.168.0.15
192.168.0.15 ------------> 192.168.0.13
192.168.0.13 ------------> 192.168.0.14
P.S.
I have to use iptables- I cannot change an existing tunnel.
networking iptables docker
I have two hosts in a network 192.168.0.0/24
:
- Host A
192.168.0.15
- Host B
192.168.0.13
And there is a remote ssh tunnel from B
to A
:
ssh -R 192.168.0.13:8080:192.168.0.15:8002 192.168.0.13 -N
and that tunnel works.
Host A
runs a container nginx
that runs nginx on a port 80. I would like to forward a traffic from 192.168.0.15:8002
to that nginx server. How to do it?
So,
if someone send a GET request
with curl 192.168.0.13:8080
he will get response from nginx run on 192.168.0.15
in a container. The flow should be:
192.168.0.14 (for example) ---GET--> 192.168.0.13:8080
192.168.0.13 --(SSH TUNNEL)--> 192.168.0.15:8002
192.168.0.15:8002 -----------> 172.17.0.2:80 (nginx container)
172.17.0.2 ------------> 192.168.0.15
192.168.0.15 ------------> 192.168.0.13
192.168.0.13 ------------> 192.168.0.14
P.S.
I have to use iptables- I cannot change an existing tunnel.
networking iptables docker
networking iptables docker
asked 7 mins ago
Gilgamesz
1063
1063
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475297%2fforwarding-traffic-from-a-host-to-a-hosts-container%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password