Trouble configuring apache to listen to second IP in same instance

I'm trying to establish a virtual host using a second IP on the same box.
I'm using redhat Fedora Core 2, and the IP's are pointed at the machine externally.  I'm not sure if my problem is with binding the IP's or in establishing the virtual host in my config file.

My 2 IP's are xx.xx.xx.26 and xx.xx.xx.27 and port 80 is available on each.  One I would like to assign to a named address of www.mydomainname.net and the other to www.mydomain.com  the .net I would like to send to a folder in var/www/dotnet and the dotcom to the default of var/www/html
I'd like to send the error logs to different folders named /logs/dotnet and /logs/dotcom

When I check the hardware settings in the network configuration, I only show the .26 address  and I'm not sure how to get the hardware nic to listen to the .27 address the ISP has pointed at the line.

Can you help?
LVL 1
preserver3Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

preserver3Author Commented:
I have both IP's established in the network configuration, but when I attempt to start apache with a name based virtual host I get
[Wed Dec 01 11:54:01 2004] [error] (EAI 2)Name or service not known: Failed to resolve server name for xx.xx.xx.xx.26 (check DNS) -- or specify an explicit ServerName

When I try to switch to listen to the ports exclusively instead of the global listen to port 80 ie:
Listen xx.xx.xx.26:80
Listen xx.xx.xx.27:80
I get a server denial message from the page
and when I implement the virtual hosts with
<VirtualHost xx.xx.xx.27:80>
    ServerAdmin jasonstarin@giant-head.com
    DocumentRoot /var/www/dotnet
    ServerName www.mysite.net
    ErrorLog /etc/httpd/dotnetlogs
</VirtualHost>
<VirtualHost xx.xx.xx.26:80>
    ServerAdmin me@mydomain.com
    DocumentRoot /var/www/html
    ServerName www.mysite.com
    ErrorLog /etc/httpd/dotcomlogs
</VirtualHost>

I get this error:
(98)Address already in use: make_sock: could not bind to address [::]:80
no listening sockets available, shutting down
 if I leave it listening to 80 or this error if I don't:
 (EAI 2)Name or service not known: Failed to resolve server name for xx.xx.xx.27 (check DNS) -- or specify an explicit ServerName

Where am I going wrong?

0
g0rathCommented:
You want to use IP aliasing. This is different per Linux distro, so need to know which one first.

Basically you'll be setting up

eth0:0 xx.xx.xx.26
eth0:1 xx.xx.xx.27

Look for a line to add something like this or the above
xx.xx.0.26-27

For those named instances to work, are the DNS records pointing to the .26 and .27 IPs correctly?
Your Apache config stuff there is correct, the only reason it's failing is because nothing is responding to the xx.xx.xx.27 address. After that gets resolved, you should be fine.

Note: You'll want to find the proper config way to do this....if not, these commands will always work, just not after a reboot

/sbin/ifconfig eth0:1 xx.xx.xx.27

/sbin/route add -host xx.xx.xx.27 dev eth0:1

Then to see if it looks cool:

cat /proc/net/aliases

-----
RedHat 8.0

go to the dir /etc/sysconfig/network-scripts
look for files that look like "ifcfg-eth0" etc...

copy the file ifcfg-eth0 to ifcfg-eth0:1

edit the file ifcfg-eth0:1
change the DEVICE= line to be DEVICE=eth0:1
change IPADDR to your xx.xx.xx.27 address
setup your netmask if needed

then type this to enable it
ifup eth0:1
and to disable it
ifdown eth0:1
0
mrielfCommented:
You can ping both ip from outside?

If yes, then check NameVirtualHost directives...





Listen 80

NameVirtualHost xx.xx.xx.26:80
NameVirtualHost xx.xx.xx.27:80

<VirtualHost xx.xx.xx.27:80>
    ServerAdmin jasonstarin@giant-head.com
    DocumentRoot /var/www/dotnet
    ServerName www.mysite.net
    ErrorLog /etc/httpd/dotnetlogs
</VirtualHost>
<VirtualHost xx.xx.xx.26:80>
    ServerAdmin me@mydomain.com
    DocumentRoot /var/www/html
    ServerName www.mysite.com
    ErrorLog /etc/httpd/dotcomlogs
</VirtualHost>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
preserver3Author Commented:
You were absolutely right, but there was one more step I needed to do in Apache Server to make everything work.


NameVirtualHost xx.xx.xx.26:80
<VirtualHost xx.xx.xx.26:80>
    ServerAdmin me@mydomain.com
    DocumentRoot /var/www/html
    ServerName www.mysite.com
    ErrorLog /etc/httpd/dotcomlogs
</VirtualHost>
NameVirtualHost xx.xx.xx.27
<VirtualHost xx.xx.xx.27:80>
    ServerAdmin jasonstarin@giant-head.com
    DocumentRoot /var/www/dotnet
    ServerName www.mysite.net
    ErrorLog /etc/httpd/dotnetlogs
</VirtualHost>


My distro is Fedora Core 2, and I was able to use the network configuration tool tocopy the xx.xx.xx.26 at eth0 and make a copy that I then edited and changed to the .27 suffix.

I'm giving you all of the points, but this is needed to finish the rest of the question
0
preserver3Author Commented:
Well, Mreilf answered while I was repsonding.  I'll split it between you two.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.