CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 1999
    Posts
    505

    Problem with C:\Windows\System32\drivers\etc\hosts file

    Hi,
    I want to configure apache server for a LAN of two computers. I have windows 7 on my machine having Apache and my other machine has vista. I got a soltion for this on:


    However based upon this solution when i am trying to modiy the C:\Windows\System32\drivers\etc\hosts file on my vista, i am getting following error:

    Cannot create C:\Windows\System32\drivers\etc\hosts file
    Make sure that the path and file name are correct
    Can somebody plz guide me with this problem.

    Zulfi.

  2. #2
    Join Date
    Jan 2013
    Location
    Largo, FL.
    Posts
    356

    Re: Problem with C:\Windows\System32\drivers\etc\hosts file

    Are you using an administrator account on the Vista machine when you try to edit the file?

    You should also right click on look at the Properties - make sure Read Only isn't selected.

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Problem with C:\Windows\System32\drivers\etc\hosts file

    Which program are you using to try to modify this file? From the program's right click context menu, select run as administrator.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4
    Join Date
    Jun 1999
    Posts
    505

    Re: Problem with C:\Windows\System32\drivers\etc\hosts file

    Hi,
    Thanks. I am able to access it now by running it as administrator. However when i am trying to access the second machine using http://server1 IE is not able to display the web page. The result of ipconfig/all is:
    C:\Users\HP>ipconfig/all

    Windows IP Configuration

    Host Name . . . . . . . . . . . . : HP-PC
    Primary Dns Suffix . . . . . . . :
    Node Type . . . . . . . . . . . . : Hybrid
    IP Routing Enabled. . . . . . . . : No
    WINS Proxy Enabled. . . . . . . . : No

    PPP adapter eVo:

    Connection-specific DNS Suffix . :
    Description . . . . . . . . . . . : eVo
    Physical Address. . . . . . . . . :
    DHCP Enabled. . . . . . . . . . . : No
    Autoconfiguration Enabled . . . . : Yes
    IPv4 Address. . . . . . . . . . . : 182.188.234.195(Preferred)
    Subnet Mask . . . . . . . . . . . : 255.255.255.255
    Default Gateway . . . . . . . . . : 0.0.0.0
    DNS Servers . . . . . . . . . . . : 119.159.255.36
    116.71.241.216
    NetBIOS over Tcpip. . . . . . . . : Disabled

    Ethernet adapter Local Area Connection:

    Media State . . . . . . . . . . . : Media disconnected
    Connection-specific DNS Suffix . :
    Description . . . . . . . . . . . : Bluetooth Personal Area Network
    Physical Address. . . . . . . . . : 08-ED-B9-E9-5E-B9
    DHCP Enabled. . . . . . . . . . . : Yes
    Autoconfiguration Enabled . . . . : Yes

    Wireless LAN adapter Wireless Network Connection:

    Media State . . . . . . . . . . . : Media disconnected
    Connection-specific DNS Suffix . :
    Description . . . . . . . . . . . : Broadcom 4313GN 802.11b/g/n 1x1 Wi-Fi Ada
    pter
    Physical Address. . . . . . . . . : 84-4B-F5-27-CA-AA
    DHCP Enabled. . . . . . . . . . . : Yes
    Autoconfiguration Enabled . . . . : Yes

    Tunnel adapter 6TO4 Adapter:

    Connection-specific DNS Suffix . :
    Description . . . . . . . . . . . : Microsoft 6to4 Adapter
    Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
    DHCP Enabled. . . . . . . . . . . : No
    Autoconfiguration Enabled . . . . : Yes
    IPv6 Address. . . . . . . . . . . : 2002:b6bc:eac3::b6bc:eac3(Preferred)
    Default Gateway . . . . . . . . . : 2002:c058:6301::c058:6301
    DNS Servers . . . . . . . . . . . : 119.159.255.36
    116.71.241.216
    NetBIOS over Tcpip. . . . . . . . : Disabled

    Tunnel adapter Teredo Tunneling Pseudo-Interface:

    Connection-specific DNS Suffix . :
    Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
    Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
    DHCP Enabled. . . . . . . . . . . : No
    Autoconfiguration Enabled . . . . : Yes
    IPv6 Address. . . . . . . . . . . : 2001:0:5ef5:79fd:43a:251d:4943:153c(Prefe
    rred)
    Link-local IPv6 Address . . . . . : fe80::43a:251d:4943:153c%12(Preferred)
    Default Gateway . . . . . . . . . :
    NetBIOS over Tcpip. . . . . . . . : Disabled

    Tunnel adapter isatap.{257CD658-694B-4768-9978-67FD69BDA6C8}:

    Media State . . . . . . . . . . . : Media disconnected
    Connection-specific DNS Suffix . :
    Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
    Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
    DHCP Enabled. . . . . . . . . . . : No
    Autoconfiguration Enabled . . . . : Yes

    Tunnel adapter isatap.{BC09BB13-98C0-4ACE-9955-0BF8FC75FA85}:

    Media State . . . . . . . . . . . : Media disconnected
    Connection-specific DNS Suffix . :
    Description . . . . . . . . . . . : Microsoft ISATAP Adapter
    Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
    DHCP Enabled. . . . . . . . . . . : No
    Autoconfiguration Enabled . . . . : Yes

    Tunnel adapter isatap.{CEC8CF63-7FE4-4B40-B280-19CCF63C85C5}:

    Media State . . . . . . . . . . . : Media disconnected
    Connection-specific DNS Suffix . :
    Description . . . . . . . . . . . : Microsoft ISATAP Adapter #3
    Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
    DHCP Enabled. . . . . . . . . . . : No
    Autoconfiguration Enabled . . . . : Yes

    C:\Users\HP>



    The host file o server is:
    # Copyright (c) 1993-2009 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    # 102.54.94.97 rhino.acme.com # source server
    # 38.25.63.10 x.acme.com # x client host

    # localhost name resolution is handled within DNS itself.
    # 127.0.0.1 localhost
    # ::1 localhost
    127.0.0.1 server1

    when i am using http://server1/, its showing me the index page. I am also able to run cgi scripts. However when i modified the httpd file in Apache conf directory Apache server was not running when i restarted the computer. So i have reinstalled Apache and I have not modified httpd.conf file.The host file on other computer is:

    # Copyright (c) 1993-2006 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    # 102.54.94.97 rhino.acme.com # source server
    # 38.25.63.10 x.acme.com # x client host

    127.0.0.1 localhost
    ::1 localhost
    182.188.234.195 server1
    Kindly guide me how to configure Apache for LAN.

    Zulfi.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured