port range forwarding.

If you need some help, this should be the first place to look.

Postby TiGeR » Thu Jan 17, 2002 7:16 am

<font color='#000000'>To make the rc_portf file to suport forwarding of a range of ports do this changes.<p>If you are using a dialup or leased connection. Then rc_portf file will never run. If that is the case then the file that needs changed is the ip_up file and the chages are very similar but not exactly the same. You have to substitute $I for $IPADDR0 <p>change this part of the rc_portf :
*********************************************
Code: Select all
echo -n "Enabling port forwarding..."
case $ROUTER in
dialup|leased) echo "Delayed";;
*) for i in `cat /etc/forward.cfg`; do
set -- ""
if [ ! "`echo $i | sed -n /_/P`" ]; then
set -- `echo $i | sed s/,/\ /g`
ipportfw -A -$1 $IPADDR0/$2 -R $3
fi
done
 ? $DONE;;
esac

*********************************************
To this:
*********************************************
Code: Select all
echo -n "Enabling port forwarding..."
case $ROUTER in
dialup|leased) echo "Delayed";;
*) for i in `cat /etc/forward.cfg| sed s/\#.*//`; do
set -- ""
if [ ! "`echo $i | sed -n /_/P`" ]; then
set -- `echo $i | sed s/,/\ /g`
ipportfw -A -$1 $IPADDR0/$2 -R $3
fi
done
for i in `cat /mnt/router/etc/multiforward.cfg | sed s/\#.*//`; do
set -- ""
if [ ! "`echo $i | sed -n /_/P`" ]; then
set -- `echo $i | sed s/,/\ /g`
ipautofw -A -r $1 $2 $3 -h $4
fi
 ? done
 ? $DONE;;
esac

*********************************************
and create a file in "/mnt/router/etc" named "multiforward.cfg"
this is the format of that file:
*********************************************
#_protocol,startport,endport,ipadrToForwardTo
#_protocol_is_tcp_or_udp)
#_this_example_is_2_user_icq_forward
tcp,5000,5019,192.168.0.2
tcp,5020,5039,192.168.0.3
*********************************************
(Edited by TiGeR at 9:01 pm on Jan. 26, 2002)

TiGeR, I edited the posts and changed some of the special characters that came through from the language difference.</font>



<!--EDIT|Lightning|1033186778-->
TiGeR
 

Postby Lightning » Thu Jan 17, 2002 1:49 pm

TiGeR that is a good idea and if you make one more improvement then spaces are allowed in the .cfg files as well as spaces and comment after each entry.<p>change this
for i in `cat /etc/forward.cfg`;
to this
for i in `cat /etc/forward.cfg | sed s/#.*//`; <p>Then you can use spaces and comments after each entry just like a normal configuration file. Then all of the _'s can be removed also. I think it was just an oversite when Serge made it the first time and never did get changed.
Lightning
 

Postby TiGeR » Thu Jan 17, 2002 2:21 pm

thanx for that !..
I edited the post to make this changes...
Im not realy god at doing this kind of scripts but after a few trial and error with "echo" before the command i finaly got it working :-)<p>
TiGeR
 

Postby Lightning » Thu Jan 17, 2002 5:53 pm

While I was looking at the rc_portf file I also noticed that if you are using a dialup or leased connection. Then rc_portf file will never run. If that is the case then the file that needs changed is the ip_up file and the chages are very similar but not exactly the same. You have to substitute $I for $IPADDR0
<p>(Edited by Lightning at 9:58 am on Jan. 5, 2002)
Lightning
 

Postby TiGeR » Sat Jan 26, 2002 4:59 pm

Thanx Lightning.
I was not awere of this i will shange my post to beskribe this to ..
TiGeR
 

Postby Administrator » Sat Jan 26, 2002 7:04 pm

NOT AN FAQ
Administrator
 

Postby TiGeR » Fri Feb 01, 2002 7:46 am

<font color='#000000'>Didnt it say "tips and trix" to ?
And this was clearly a tip.<p>And if didnt say that im realy sorry.
But now i made a package of it and that one went to the right place :)
<p>(Edited by TiGeR at 11:48 am on Feb. 1, 2002)</font>



<!--EDIT|Howler|1030285975-->
TiGeR
 


Return to FAQ - Frequently Asked Questions

Who is online

Users browsing this forum: No registered users and 1 guest