View previous topic :: View next topic |
Author |
Message |
Yui n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 21 Jul 2006 Posts: 29
|
Posted: Fri Jul 21, 2006 5:20 pm Post subject: Setting port forwarding without access to a router interface |
|
|
I don't have access to my router interface for insurance reason, so I can't reset the router and other things like that.
I need port forwarding (for amule, ssh, and some programs like that), I know that it's possible to create a port forwarding rule on a router without access to it. (Azureus can do it (I think they call it uPnP), and you have an interface to do that with WinXP).
All I want is a simple program that create a port forwarding rule on my router, in a terminal if possible. Redirect port 20 to 192.168.1.32 for example.
I began to look for that a long time ago and didn't find out yet how to do it. I'm a linux newbie, so I choosed to ask here before reading all azureus code to make a program that can do that.
My English is pretty bad, I hope you understand what I want.
Thanks
Last edited by Yui on Wed Jul 26, 2006 1:43 pm; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Dieter@be Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 03 Apr 2005 Posts: 314 Location: Wetteren, Belgium
|
Posted: Fri Jul 21, 2006 5:25 pm Post subject: |
|
|
yep upnp that's it, i don't know exactly "how" to do it, but it's called "universal plug and play" so search on that ![Smile :)](images/smiles/icon_smile.gif) _________________ Nothing beats a ride on the Gentoo learning curve.
2 Gentoo Linux boxes - 2 Arch Linux boxes - Love all four
Say no to i386 binaries! -- Adopt an unanswered topic |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Suicidal l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/1612453232442f4c75f36c4.jpg)
Joined: 30 Jul 2003 Posts: 959 Location: /dev/null
|
Posted: Fri Jul 21, 2006 5:34 pm Post subject: |
|
|
I just use the following, not using upnp but linuxbox 2 linuxbox:
Code: | #!/bin/bash
COMMAND="ssh -N -R 4596:localhost:22 foo.bar.com"
CHECK_TUNNEL=`ps -eo args | grep "$COMMAND" | grep -v grep`
if [ -z "$CHECK_TUNNEL" ] ; then
$COMMAND
fi |
I set it to run every 5 min via crontab forwards port 22 on my local box to port 4596 on my home box. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Yui n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 21 Jul 2006 Posts: 29
|
Posted: Fri Jul 21, 2006 5:47 pm Post subject: |
|
|
If I understand you, foo.bar.com is the ip (or the dyndns stuff) of my modem-router ?
So the redirection is not actually done on the modem-router but it is my local box that "listen" on that port and catch the packets ? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Suicidal l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/1612453232442f4c75f36c4.jpg)
Joined: 30 Jul 2003 Posts: 959 Location: /dev/null
|
Posted: Fri Jul 21, 2006 9:49 pm Post subject: |
|
|
Yui wrote: | If I understand you, foo.bar.com is the ip (or the dyndns stuff) of my modem-router ?
So the redirection is not actually done on the modem-router but it is my local box that "listen" on that port and catch the packets ? |
Correct either LHOST or RHOST in the following example can be a FQDN such as foo.bar.com or an IP such as 192.1.2.3
rewrote it a bit; (needed some clarification IMHO)
In this example the LHOST is forwarding port 22 to port 4596 on RHOST
LHOST="gentoo NSM box at work"
RHOST="home gentoo desktop"
LHOST:22---------------->RHOST:4596
The below script works best if you are using ssh keys.
Code: |
#!/bin/bash
RHOST="foo.bar.com"
LHOST="localhost"
COMMAND="ssh -N -R 4596:$LHOST:22 $RHOST"
CHECK_TUNNEL=`ps -eo args | grep "$COMMAND" | grep -v grep`
if [ -z "$CHECK_TUNNEL" ] ; then
$COMMAND
fi
|
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Dieter@be Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 03 Apr 2005 Posts: 314 Location: Wetteren, Belgium
|
Posted: Sat Jul 22, 2006 9:41 am Post subject: |
|
|
if he doesn't have access to his router web-interface , he probably can't ssh to it either i think ![Smile :)](images/smiles/icon_smile.gif) _________________ Nothing beats a ride on the Gentoo learning curve.
2 Gentoo Linux boxes - 2 Arch Linux boxes - Love all four
Say no to i386 binaries! -- Adopt an unanswered topic |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Suicidal l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/1612453232442f4c75f36c4.jpg)
Joined: 30 Jul 2003 Posts: 959 Location: /dev/null
|
Posted: Sat Jul 22, 2006 8:22 pm Post subject: |
|
|
Dieter@be wrote: | if he doesn't have access to his router web-interface , he probably can't ssh to it either i think ![Smile :)](images/smiles/icon_smile.gif) |
In my above example LHOST is behind a firewall that I cant configure RHOST is behind a firewall that I have access to. You will need access to at least one of the routers to make the port accessable. Most people at work dont have assess to the router but at home they usually do. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Tin Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 22 Dec 2005 Posts: 305 Location: Namur, Belgium
|
Posted: Sun Jul 23, 2006 11:45 am Post subject: |
|
|
I think that the router he spoke about is a modem with router inside, not a real machine.
Then, it is impossible that a ssh daemon runs on this box.
The router interface is a web interface provided by the modem itself, and permitting to do some nat and firewall configurations.
Because he is unable to have access to the interface (no password given by the provider because if you want the password, the guarantee is not valid anymore) BUT he noticed that some programs like azureus succeed in configuring some nat settings remotely (using the upnp he spoke about ?), he is trying to find HOW it is possible without having to read all the azureus sources.
Yui, don't you think it should be interesting to ask directly to the forum of azureus how they do that ?
Good luck ![Smile :-)](images/smiles/icon_smile.gif) _________________ Tin, the gentoobie |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Dieter@be Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 03 Apr 2005 Posts: 314 Location: Wetteren, Belgium
|
Posted: Sun Jul 23, 2006 3:26 pm Post subject: |
|
|
Tin wrote: | Yui, don't you think it should be interesting to ask directly to the forum of azureus how they do that ?
|
universal plug & play (as he already said)
maybe have a look at the azureus code, maybe you'll see (references to) libraries that make the upnp magic possible (or ask the devs ) _________________ Nothing beats a ride on the Gentoo learning curve.
2 Gentoo Linux boxes - 2 Arch Linux boxes - Love all four
Say no to i386 binaries! -- Adopt an unanswered topic |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Yui n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 21 Jul 2006 Posts: 29
|
Posted: Tue Jul 25, 2006 9:24 am Post subject: |
|
|
Well, I think your script would work for ssh and other programs like that. But I don't think it will work for programs like amule.
It's a good script and I could use it one day. But yeah, I'll read azureus source code and try to make a script for uPnP.
Thanks anyway
I'll post here if I find how to do it. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Zi7 n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/152001732044c57b4b32965.png)
Joined: 23 Jul 2006 Posts: 43 Location: Provence
|
Posted: Tue Jul 25, 2006 11:36 am Post subject: |
|
|
There's a light upnp client library available here: http://miniupnp.free.fr/
You might want to give it a shot...
Good luck! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Yui n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 21 Jul 2006 Posts: 29
|
Posted: Wed Jul 26, 2006 1:42 pm Post subject: |
|
|
Yeah, it's exactly what I was seeking. I tried the Joao Paulo Barraca version (command line version of miniupnp) and it works even if it's quite difficult to use.
Thanks for all. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|