?
Solved

Apache on Linux in Windows LAN

Posted on 2003-03-25
8
Medium Priority
?
905 Views
Last Modified: 2010-03-18
Trying to get apache server respond to http://internal-unix-server/ on WinNT machines by browsers on the intranet. Planning to run a Twiki server on the Linux webserver to be accessable by WinNT workstations on intranet. IP address of the server is obtained through DHCP.


Current Situation:

Cannot start Apache 2.0.40 httpd with server name set to internal-unix-server. Have to use the IP address as server-name to start httpd. However, I'm using DHCP so this is not desirable.

I'm able to ping the internal-unix-server name (Samba running). I'm able to see the internal-unix-server in Network Neighborhood in WinNT.

If I use internal-unix-server as server-name in httpd.conf, I got the error message in the error log file:
   [alert] (22002)Name or service not known: mod_unique_id: unable to find IPv4 address of "internal-unix-server" Configuration Failed


Environment:

Apache 2.0.40, Samba 2.2.7a running on Red Hat 8.0.

0
Comment
Question by:aeemycheung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 17

Expert Comment

by:psimation
ID: 8209905
Your problem is DNS related.
You need to configure a local DNS server to point the name "internal-unix-server" to it's IP address.
What would complicate matters here is the fact that your Linux box is getting a dynamic IP via DHCP...
I'm not sure how to map a name to a dynamic IP, but others might have a solution for you.

The reason why your Linux box won't start apache with the name instead of IP is for exactly the same reason, it cannot resolve the name to an IP, once you have configured your name servers correctly, it will start.
I think by far the easiest way would be to give the Linux box a statis IP on the network, then either configure Linux as a nameserver, or use one of the windows servers as a nameserver and make the appropriate entry for the Linux box there. Then you need to tell all users on the network, Linux server included, to use the windows nameserver as the default nameserver.
0
 
LVL 1

Expert Comment

by:-jer-
ID: 8211215
--------------------------------------------------------------------------------------------------------------------
I think by far the easiest way would be to give the Linux box a statis IP on the network, then either configure Linux as a nameserver, or use one of the windows servers as a nameserver and make the appropriate entry for the Linux box there. Then you need to tell all users on the network, Linux server included, to use the windows nameserver as the default nameserver.
--------------------------------------------------------------------------------------------------------------------

agreed.  the problem seems like the windows boxes don't know where the linux box is... to test this, try starting apache using the ip address (for example 192.168.1.104, then point the windows browser to that ip http://192.168.1.104) and this should bring up the page.  Then you know your problem is entirely DNS related within the network.
0
 

Author Comment

by:aeemycheung
ID: 8214924
Thanks guys. I've already tried the static IP thing (that's not really 'allowed' in a DHCP network where other WinNT machines are using DHCP to get IP). What I need is the dynamic IP solution.

Somebody has already done something like this, basing on the question asked:
http://www.experts-exchange.com/Networking/Linux_Networking/Q_20484503.html

But I'm not sure how it's done. I do not need sophisticated authentication in my case though.
0
Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

 
LVL 9

Accepted Solution

by:
tkalchev earned 300 total points
ID: 8218414
The best way for resolving your problem is somehow to find what is the dynamically assigned IP address at boot time, then to make the appropriate changes in /etc/hosts.

One solution is (Assuming your network interface is eth0, and the hostname is linux_server):

1.Create a file /etc/hosts.orig, where you should copy the contents of your /etc/hosts, excluding all records, containing your hostname  (linux_server).

2.Configure httpd.conf with
ServerName linux_server

2.Add the following at the end of /etc/rc.local :


ETH=eth0
HNAME=linux_server

DYN_IP=$(ifconfig $ETH | grep "inet addr" | awk '{print $2}' | awk '{split($1,e,":"); print e[2]}')

rm -f /etc/hosts
cp /etc/hosts.orig /etc/hosts
echo "$DYN_IP $HNAME" >> /etc/hosts

/sbin/service apache restart

So, on every boot you will have an actual /etc/hosts file and apache will not fail to resolve the IP address.
0
 
LVL 9

Expert Comment

by:tkalchev
ID: 8218598
Opps, above should be added to /etc/rc.d/rc.local not /etc/rc.local of course
0
 

Expert Comment

by:dirtyninja
ID: 8289488
bypass dhcp...
1. see what ip info you have
ifconfig
less /etc/resolv.conf
route -n
2. edit your adapter info
vi /etc/sysconfig/network-scripts/ifcfg-eth0
    NAME=internal-unix-server
    DEVICE=eth0
    IPADDR="your ip address"
    BOOTPROTO=static
    ONBOOT=yes
    NETMASK=255.255.255.0
    GATEWAY="your gateway"
    DNS2="your dns"
3. tell the comp what its name is
vi /etc/hosts
    "your ip address"   internal-unix-server
4. apachectl start
0
 

Author Comment

by:aeemycheung
ID: 8289919
Thanks, tkalchev. I have tried your suggestion has and it works fine. Is it a bit strange to have to restart the apache (httpd) service? Is it safe or good to play with the script that started the service the first time?

Futher problem,  the address has not been registered with the DNS yet, so although Windows NT machines are able to find the server with http://linux-server (I guess they used broadcasting), another Linux machine cannot find it. Is there some way I can register the name with the DNS? Or can I configure the other machines to use broadcast in order to connect to the linux-web-server?
0
 
LVL 9

Expert Comment

by:tkalchev
ID: 8290060
You need to restart apache in order to recognize the newly created binding between the hostname and the DHCP IP address. The worst case is that first apache cannot start with the error yo have specified, because it still don't know that "linux-server" is bound to the new DHCP IP address.

You can access the server from the NT machines, because they are using NetBIOS to find the names. Linux servers are not using NetBIOS, only the /etc/hosts and DNS lookup. One solution is to install a local DNS server and dynamicaly update the local zone file after every IP changing of the linux-server.

0

Featured Post

ATEN's HDBaseT Presentation at InfoComm 2017

Hear ATEN Product Manager YT Liang review HDBaseT technology, highlighting ATEN’s latest solutions as they relate to real-world applications during her presentation at the HDBaseT booth at InfoComm 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question