[Urgent] Web requests from Public to Private IP

Hi…
I am working on website for my organization and need urgent help for managing the server.
Scenario:
1 CentOS based BIND DNS Server with Public IP (assume 1.2.3.4) with a domain name (assume abc.edu.in)
2 Windows based IIS Web Server for Dot Net based Website on an internal private IP. (assume 5.1.1.2)
3 Linux based Web Server for PHP based Website on an internal private IP. (assume 5.1.1.3)
Requirement:

  1. When a user requests abc.edu.in, website from 5.1.1.2 should be served.
  2. When a user requests abc.edu.in/yy, website from 5.1.1.2 should be served.
  3. When a user requests yy.abc.edu.in, website from 5.1.1.3 should be served.

A step-by-step elegant solution is highly appreciated. Please help.
Thanks and Regards,

Hi,

If I understand correctly that all you need is to create or change your existing zone file on your CentOS server for a domain abc.edu.in. Try and have a look for a existing DNS zone file inside:

/etc/bind/zones/master/

Otherwise create a new file eg.:

/etc/bind/zones/master/db.abc.edu.in

with a following content where I assume that that your CentOS DNS’s fully qualified domain name is eg.: ns1.abc.edu.in or ns2.abc.edu.in :

;
; BIND data file for abc.edu.in
;
$TTL    3h
@       IN      SOA       abc.edu.in admin.abc.edu.in. (
                          1234     ; Serial
                          3h       ; Refresh after 3 hours
                          1h       ; Retry after 1 hour
                          1w       ; Expire after 1 week
                          1h )     ; Negative caching TTL of 1 day
;

@       IN      NS      ns1.abc.edu.in.
@       IN      NS      ns2.abc.edu.in.

abc.edu.in.            IN      A       5.1.1.2
yy                    IN      A       5.1.1.3

Next include your new zone file in

/etc/named.rfc1912.zones

:

zone "abc.edu.in" {
       type master;
       file "/etc/bind/zones/master/db.abc.edu.in";
};

Restart DNS bind:

# service named restart

For more information please visit: How to setup a named DNS service on Redhat 7 Linux Server

Hope it helps

Lubos

Dear Irendek,

Thanks for quick reply.
I have already tried the following solution
abc.edu.in. IN A 5.1.1.2
yy IN A 5.1.1.3

It id not working from internet since 5.1.12 and 5.1.1.3 are not global IPs. This solution works from within the network but not from outside the network.
ipv4 forwarding is also activates, firewall and SELinux are off, also tried with another IP of private range, but nothing worked.
If you still feel that it should work, please share required network configurations.

Thanks

Hi,

If I understand correctly that all you need is to create or change your existing zone file on your CentOS server for a domain abc.edu.in. Try and have a look for a existing DNS zone file inside:

/etc/bind/zones/master/

Otherwise create a new file eg.:

/etc/bind/zones/master/db.abc.edu.in

with a following content where I assume that that your CentOS DNS’s fully qualified domain name is eg.: ns1.abc.edu.in or ns2.abc.edu.in :

;
; BIND data file for abc.edu.in
;
$TTL    3h
@       IN      SOA       abc.edu.in admin.abc.edu.in. (
                          1234     ; Serial
                          3h       ; Refresh after 3 hours
                          1h       ; Retry after 1 hour
                          1w       ; Expire after 1 week
                          1h )     ; Negative caching TTL of 1 day
;

@       IN      NS      ns1.abc.edu.in.
@       IN      NS      ns2.abc.edu.in.

abc.edu.in.            IN      A       5.1.1.2
yy                    IN      A       5.1.1.3

Next include your new zone file in

/etc/named.rfc1912.zones

:

zone "abc.edu.in" {
       type master;
       file "/etc/bind/zones/master/db.abc.edu.in";
};

Restart DNS bind:

# service named restart

For more information please visit: How to setup a named DNS service on Redhat 7 Linux Server

Hope it helps

Lubos

Hi,

for this you can use port forwarding from your external IP address eg. x.y.z:

abc.edu.in -> x.y.z -> x.y.z:8080 -> 5.1.1.2:80
yy.abc.edu.in -> x.y.z -> x.y.z:8088 -> 5.1.1.3:80

however you will need to append a port number to your request URL like: abc.edu.in:8080, abc.edu.in:8080/yy or yy.abc.edu.in:8088

Another option is to use reverse proxy such as nginx reverse proxy and use it to forward external requests locally to internal web servers based on the URL.

hope it helps…

lubos

Dear Irendek, i would not prefer port number but i could try nginx as you recommended.
Can you please provide mea any link where i can get required configurations please?

[QUOTE=lrendek;2816]Hi,

for this you can use port forwarding from your external IP address eg. x.y.z:

abc.edu.in -> x.y.z -> x.y.z:8080 -> 5.1.1.2:80
yy.abc.edu.in -> x.y.z -> x.y.z:8088 -> 5.1.1.3:80

however you will need to append a port number to your request URL like: abc.edu.in:8080, abc.edu.in:8080/yy or yy.abc.edu.in:8088

Another option is to use reverse proxy such as nginx reverse proxy and use it to forward external requests locally to internal web servers based on the URL.

hope it helps…

lubos[/QUOTE]

I not have any specific tutorial in mind for nginx reverse proxy. Simply web search engine of you choice.