Announcement

Collapse
No announcement yet.

DNS thru host file

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • DNS thru host file

    hi guys, just want some of your advise on how to achieve this:

    using the hosts file for any windows machine:
    let's say:
    192.168.1.7 office1
    192.168.1.8 office2

    i had tried editing the host file using the above settings, then just type at the browser: http://192.168.1.7 able to resolve office1

    but what if there is a specific port that need to specify, how to do it.
    like:
    192.168.1.9:8080

    hosts file doesn't resolve addresses with the port specified on it.

    if i put: 192.168.1.8 office3
    i need to put on the browser: http://office3:8080 then it will be able to resolve the address.

    but Is there some work around on this, by just typing a name and it will resolve the address and the port?

    Thanks for any advice.

  • #2
    Re: DNS thru host file

    Originally posted by JJJCR View Post
    hi guys, just want some of your advise on how to achieve this:

    using the hosts file for any windows machine:
    let's say:
    192.168.1.7 office1
    192.168.1.8 office2

    i had tried editing the host file using the above settings, then just type at the browser: http://192.168.1.7 able to resolve office1

    but what if there is a specific port that need to specify, how to do it.
    like:
    192.168.1.9:8080

    hosts file doesn't resolve addresses with the port specified on it.

    if i put: 192.168.1.8 office3
    i need to put on the browser: http://office3:8080 then it will be able to resolve the address.

    but Is there some work around on this, by just typing a name and it will resolve the address and the port?

    Thanks for any advice.
    by just typing the address in the web browser you are already specifying the port as by default http is port 80, you are trying to connect to a non standard port hence the need for the 8080 at the end. a simple solution would be to redirect the traffic on the web server from 80 to 8080 (providing you didn't have a different site listening on 80)

    Comment


    • #3
      Re: DNS thru host file

      hi hazey, there's another site on port 80.
      so redirection would not help. would there be other alternatives, to do this?

      thanks.

      Comment


      • #4
        Re: DNS thru host file

        This isn't actually using DNS.

        HOSTS files are used and checked first before DNS gets involved nd will lead to an administrative nightmare further on down the line, as we are experiencing at my place at the moment.

        http://en.wikipedia.org/wiki/Hosts_(file)

        You will need to use host headers OR use the port number when accessing the site.

        You don't mention what web server you are usng so i've included IIS5, 6 and 7 and apache.

        Apache

        http://www.google.com.au/search?sour...f9a0e9791b2ce4

        Host headers IIS5

        http://www.google.com.au/search?sour...f9a0e9791b2ce4

        Host Headers IIS6

        http://www.google.com.au/search?sour...f9a0e9791b2ce4

        Host Headers IIS7

        http://www.google.com.au/search?sour...t+headers+iis7

        Comment


        • #5
          Re: DNS thru host file

          hi wullieb1, thanks for the links. we're using apache. i'll try to experiment with httpd.conf

          Comment


          • #6
            Re: DNS thru host file

            Originally posted by JJJCR View Post
            hi wullieb1, thanks for the links. we're using apache. i'll try to experiment with httpd.conf

            Thats exactly where you need to edit the port number for Apache web servers. You should find it at:

            #Listen 12.34.56.78:80
            Listen (port number here - IE Listen 80)

            The top line is rem'ed out as you can see. If you do a grep on the httpd.conf for #Listen 12.34.56.78:80 you will find the line below where the web server is listening on the specified port.

            Comment


            • #7
              Re: DNS thru host file

              You would need to create a A record in your DNS server as well as configuring Host headers in the Apache server. This is just for internal name resolution though.
              Caesar's cipher - 3

              ZKHQ BRX HYHQWXDOOB GHFLSKHU WKLV BRX ZLOO UHDOLVH LW ZDV D ZDVWH RI WLPH!

              SFX JNRS FC U6 MNGR

              Comment

              Working...
              X