Koozali.org: home of the SME Server

Contribs.org Forums => General Discussion => Topic started by: Bud on February 16, 2011, 05:12:38 PM

Title: Port Forward Advice
Post by: Bud on February 16, 2011, 05:12:38 PM
hope you guys can help me

i have a sme 8 - server setup is " server and gateway "
Server IP 10.0.10.90

i have installed an app called " Feng Office " http://www.fengoffice.com/ (it's a great groupware app)

i have port forward 443 and 80 to IP 10.0.10.90

my Feng Office config.php = define('ROOT_URL', 'https://10.0.10.90/fengoffice');

my problem is that i can Browse and Use the Feng Office App localy on the Lan

However when i try to use DynDNS for External Access ( eg: https://mydyndns.com/fengoffice/ ) i cannot seem to externally connect to the fengoffice application
I do realise that it has to do with the config.php file howerver if I change the settings on the config.php to say define('ROOT_URL', 'https://mydyndns.com/fengoffice'); then I cannot get the App to Work Locally on my Lan Unless I make Changes to the Hosts File on all Windowz Computers

any ideas what i could do?

any help greatly appcreciated
Title: Re: Port Forward Advice
Post by: cactus on February 16, 2011, 05:22:33 PM
Also define the external hostname internally in the hostname panel IIRC. That way internal hosts will get the internal IP address from SME Server DNS and the external users use the IP address from the external domain IIRC.
Title: Re: Port Forward Advice
Post by: CharlieBrady on February 16, 2011, 07:22:54 PM
Use ProxyPass rather than port forwarding.
Title: Re: Port Forward Advice
Post by: mmccarn on February 17, 2011, 05:50:47 AM
I would second Cactus's advice.

On my home network (SME only), I create either hosts or domains on the SME so that LAN workstations attempting to resolve my dyndns hostname come up with the LAN ip.  Using the default SME dyndns settings this works by default for the primary domain.

At work, my "feng office" domain is configured in the SME to use "corporate dns" servers, is pointed at my Active Directory controller, and I have an entry in AD to force local clients to get the local IP for the server.
Title: Re: Port Forward Advice
Post by: Bud on February 17, 2011, 01:46:12 PM
thanks for the help guys but please excuse me i'm a bit confused

Example Server
the sme server domain name is called eg: " myserver.com "

so under my  " Hostnames and Addresses "  I have
        smebox.myserver.com     IP  10.0.10.90
        ftp.myserver.com          IP   10.0.10.90
        mail.myserver.com         IP   10.0.10.90
        proxy.myserver.com       IP   10.0.10.90
        wpad.myserver.com       IP   10.0.10.90
        www.myserver.com        IP   10.0.10.90

the DynDNS is  "mydyndns.com "

what do i now add to the " Hostnames and Addresses " as my Feng Office config is " https://10.0.10.90/fengoffice "

do i change my Feng Office Config File as well ?

any help greatly appreciated


Title: Re: Port Forward Advice
Post by: mmccarn on February 18, 2011, 12:42:00 PM
Add "mydyndns.com" as a locally resolved domain on your SME - which will affect LAN clients but no one else on the planet.
Title: Re: Port Forward Advice
Post by: Bud on February 20, 2011, 05:22:58 AM
cactus and mmccarn thanks for your help

the advice is sound and it works however i have another scenario

i have a client with two servers: sme 7.5.1 and a centos 5.5 server
the sme 7.5.1. server  setup is " server and gateway "

sme 7.5.1 IP: 192.168.0.10
centos 5.5. IP: 192.168.0.20


client dyndns = " clientdyndns.org "

i have installed Feng Office on the CentOS 5.5 Server and is operational with a config.php file entry of: " https://192.168.0.20/fengoffice "

i have made a port forward in the sme 7.5.1. server as the following:
Source Port = 999
Destination port = 445
Detination IP = 192.168.0.20

lan access to Feng Office is no problem

Question:
what do i do now to get ac cess to Feng Office from outside the lan
Title: Re: Port Forward Advice
Post by: cactus on February 20, 2011, 09:15:17 AM
Wouldn't that be the same as you did for your other domain?
Title: Re: Port Forward Advice
Post by: Bud on February 21, 2011, 07:30:38 AM
cactus thanks for your reply

my problem is the Feng Office " config.php " file = " define('ROOT_URL', 'https://192.168.0.20/fengoffice'); "

This points to the clients local CentOS Server that has Feng Office Installed.

With this setting the Local Users on the Lan can use Feng Office however whan I add the " clientdyndns.org " to the SME Server Domain Options and the SME Server has also a Port Forward of Source Port 999 to IP: 192.168.0.20 ( CentOS Server with Feng Office Installed) I still cannot browse from outside the Network to Feng Office eg: https://clientdyndns.org:999/fengoffice

even if i change the Feng Office Config File to " define('ROOT_URL', 'https://clientdyndns.org:999/fengoffice'); " i can then connect to Feng Office from outside the Lan however my users INSIDE the Lan CANNOT Connect to Feng Office.

any ideas as to what i am doing wrong?
what is the correct procedure that i need to follow?

thanks again
Title: Re: Port Forward Advice
Post by: mmccarn on February 21, 2011, 02:53:09 PM
The problem with the Centos system is the port number, I think -- if you use DNS to handle the LAN/WAN issue, the port number on the target host must be the same from both the LAN and the WAN.

Thus, if WAN access uses port 999, then you must modify the config on the CentOS box so that feng office works on port 999 from the LAN, too.

Early on in this discussion, Charlie suggested ProxyPass (http://wiki.contribs.org/SME_Server:Documentation:FAQ#Proxy_Pass) - this, too, might solve your problem:
- Configure feng office to work from the LAN
- Configure proxypass on the SME to pass the desired domain (fengoffice.blah.com) or ibay (blah.com/fengoffice) back and forth to the CentOS box.

[offthewall idea]
You may be able to configure your web server (and feng office) to use the same database and data folders from two different URLs - so LAN users could use one URL, and outside users could use another URL.
[/offthewall idea]
Title: Re: Port Forward Advice - SOLVED
Post by: Bud on February 24, 2011, 12:51:52 PM
guys thanks for the help

i got it sorted

no proxy or hostname settings needed

this is what i did (ps: you can do this for wordpress as well etc.)

ok say you have two servers
Server 1 = IP 192.168.0.10 (SME Server 7.5.1 running as Server and Gateway)
Server 2 = IP 192.168.0.20 (CentOS Server 5.5)

Solution
1. In your SME Server You will need to Port forward say Source Port 999 to Server 2 IP: 192.168.0.20 to Destination Port 443

2. In Feng Office Edit the config/config.php file and then add the following code:

Where you see on line 10:   define('ROOT_URL', 'https://192.168.0.20/fengoffice');

Replace this with

CODE START:

// the following creates an array with all the possible url values that you might utilize.
$feng_multi = array(

    "dyndns.com" => array(
                 "ROOT_URL"=>"https://dyndns.com:999/fengoffice"
   ),   

         "192.168.0.20" => array(
                 "ROOT_URL"=>"https://192.168.0.20/fengoffice"
)
   );

// this next part pulls the server name from the url info and sets feng_settings with the appropriate values from the array.
   
$server_name = $_SERVER["SERVER_NAME"];
$feng_settings = $feng_multi[$server_name];

// ** settings ** //
  define('ROOT_URL', $feng_settings["ROOT_URL"]);


CODE END:

thats it, so now the local lan users type in https://192.168.0.20/fengoffice/

and the external wan users type in https://dyndns.com:999/fengoffice/

hope this helps
Title: Re: Port Forward Advice
Post by: phsantiago on March 03, 2011, 10:10:42 AM
Great advice. One problem, though. Using your code, I can access fengoffice remotely using hamachi vpn, and via our lan. However, the email notifications now have an invalid link. The link does not have the root url.

Hope you fix have a fix for this too. Thanks.

guys thanks for the help

i got it sorted

no proxy or hostname settings needed

this is what i did (ps: you can do this for wordpress as well etc.)

ok say you have two servers
Server 1 = IP 192.168.0.10 (SME Server 7.5.1 running as Server and Gateway)
Server 2 = IP 192.168.0.20 (CentOS Server 5.5)

Solution
1. In your SME Server You will need to Port forward say Source Port 999 to Server 2 IP: 192.168.0.20 to Destination Port 443

2. In Feng Office Edit the config/config.php file and then add the following code:

Where you see on line 10:   define('ROOT_URL', 'https://192.168.0.20/fengoffice');

Replace this with

CODE START:

// the following creates an array with all the possible url values that you might utilize.
$feng_multi = array(

    "dyndns.com" => array(
                 "ROOT_URL"=>"https://dyndns.com:999/fengoffice"
   ),   

         "192.168.0.20" => array(
                 "ROOT_URL"=>"https://192.168.0.20/fengoffice"
)
   );

// this next part pulls the server name from the url info and sets feng_settings with the appropriate values from the array.
   
$server_name = $_SERVER["SERVER_NAME"];
$feng_settings = $feng_multi[$server_name];

// ** settings ** //
  define('ROOT_URL', $feng_settings["ROOT_URL"]);


CODE END:

thats it, so now the local lan users type in https://192.168.0.20/fengoffice/

and the external wan users type in https://dyndns.com:999/fengoffice/

hope this helps