Results 1 to 5 of 5

Thread: Forwarding port 80 --> 8081????

  1. #1

    Forwarding port 80 --> 8081????

    Is there a way to break this behavior. I like to set the web interface to port 8081. And i want it to be accessible with LAN and WAN trought port 8081.

    No port redirection.

    I want this coz need my port 80 for an other webserver (without killing the current one).

    Sollie.

  2. #2
    Quote Originally Posted by sollie View Post
    Is there a way to break this behavior. I like to set the web interface to port 8081. And i want it to be accessible with LAN and WAN trought port 8081.

    No port redirection.

    I want this coz need my port 80 for an other webserver (without killing the current one).

    Sollie.
    Some settings are defaulted in web-gui, others you should be able to modify over the iptables

    Code:
    iptables --list
    iptables -d nat --list
    See documentation http://www.netfilter.org/documentation/index.html

    I would eventually want the same thing, but I don't have time to do so now :-( so I would appreciate if you could share your findings.

    Thankx & Regards

  3. #3
    I will try to find a way.

    Sollie.

  4. #4
    I could not find a way to stop the redirection. But i found a way to reverse the direction with some php scripts.

    Step 1: I replaced my index.html from web (origional asus website) with the following code:

    Code:
    <head>
    <meta http-equiv="refresh" content="0; URL=http://www.yourdomain.com:8082">
    </head>
    <body>
    </body>
    </html>
    Step 2: I use lighttpd (8082) with php and my index.php looks like this:

    Code:
    <?php 
    $user = getenv("REMOTE_ADDR");
    $host = getenv("HTTP_HOST"); 
    
    // when you enter your domain form outside (WAN)
    if($user == "192.168.0.3")	{
    	
    	if($host == "www.yourdomain.com")	{ $url = "local_index.php"; } // $url = waar hij heen redirect
    	elseif($host == "www.yourdomain.com:8082") { $url = "local_index.php"; } 
    	else { $url = "local_index.php" ; } 
    	
    	}
    	
    //When you enter your domain from the insite (LAN)
    else	{
    	if($host == "www.yourdomain.com")	{ $url = "remote_index.php"; } // $url = waar hij heen redirect
    	elseif($host == "www.yourdomain.com:8082") { $url = "remote_index.php"; } 
    	else { $url = "remote_index.php" ; } 
    	}
    
    // Ga naar de $url toe..
    Header("Location: $url"); 
    ?>
    Step 3: whe i reboot the router the index.html i restored by the router. I removed this behavior by adding the following code to rc.local:

    Code:
    # Restore Webserver Redirection
    cp /shares/MYVOLUME1/MYSHARE1/run/index.html /shares/MYVOLUME1/MYSHARE1/web
    Step 4: to use yourdomain.com local, you have to change your "host" file in windows. Use the following path: windir/system32/drivers/etc/host.
    Change that file, by adding a yourdomain.com direction to your routers IP.

    Sollie.
    Last edited by sollie; 24-01-2007 at 19:51.

  5. #5

    Thumbs up

    hi,

    Used some of the information provided by sollie, inparticular this link
    http://www.netfilter.org/documentati...g-HOWTO-7.html
    and did the following to get it to work. Checked it with a VPN connection and it does work

    So here's what you do.

    Let's say you have 8081 currently set up on the asus wl700 to serve photos but you want to use lighttpd or another web server on 8088.

    I have created a small tutorial which I hope will work for you, It bugged me for 2 weeks but I finally have it cracked. alternatively u can use sollie's suggestion above.

    1. You need to find out what line number the 8081 is being served on
    iptables -t nat --list --line-numbers

    2. you then need to remove the line which has ref to 8081
    iptables -t nat -D PREROUTING 2

    3. Then you need to add your own server port to replace the 8081 port
    iptables -t nat -I PREROUTING 2 -p tcp -m tcp -i eth0 --dport 80 -j DNAT --to-destination <enteryourip>:<newportno>

    4. You then need to remove the 8081 port from the INPUT table in iptables.
    iptablex -D INPUT <again enter the number of the line 8081 is on>
    you may need to run iptables --list --line-numbers to find out what 8081 is on input table.

    5. Add the replaced server to the input table
    iptable -I input <LINE NO eg 8> -p tcp -m tcp -d <enteryourip> --dport <newportno> -j ACCEPT


    You can run a couple of test now on your webserver to see if it's working and you can add the lines above to the rc.local but i suggest that you put them into a file and execute the file from rc.local with #!/opt/bin/bash as the input line followed by the command lines above, put this in a file say called iptable-change and save it in /opt/etc give it a chmod 777 and call it from rc.local.

    There may be another way to call it in rc.local but i have found it the best way to get it working.

    As always, back up your iptables, before you make a mess of your machine and cannot get anything working. Note these files are located in /tmp
    and are called
    nat_rules
    filter_rules
    That way you can always copy them back in if you make a mess.

Similar Threads

  1. Replies: 3
    Last Post: 01-11-2014, 13:16
  2. FritzBox -> wl-hdd -> vsftpd Port ändern
    By PeterRies in forum German Discussion - Deutsch (DE)
    Replies: 1
    Last Post: 12-02-2008, 10:40
  3. Problems with port forwarding
    By User007 in forum WL-500g Q&A
    Replies: 0
    Last Post: 04-08-2006, 16:53
  4. Need help with Wl500g and port forwarding
    By ikir in forum WL-500g Q&A
    Replies: 0
    Last Post: 28-01-2006, 13:58
  5. Firmware v1.9.2.7 CR1 [Oleg]
    By Oleg in forum WL-500g Firmware Releases
    Replies: 53
    Last Post: 13-04-2005, 23:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •