ip aliasing and httpd.conf

I have a computer I need to add a 2nd IP (because one domain name is not controlled by me, and it was pointing to a different IP, but I do not want to have 3 machines up, just 2 DNS which also run the web).

so I can add a 2nd IP through /etc/rc.conf,

but not sure what do it in the httpd.conf:

do I do this?

Code:
NameVirtualHost *:80

<VirtualHost nic.1.ip:80>
    ServerAdmin webmaster@x.net
    DocumentRoot /usr/home/xyz
    ServerName x.net
    ErrorLog /usr/httplog/x.err
    CustomLog /usr/httplog/x.log common
</VirtualHost>

<VirtualHost nic.2.ip:80>
    ServerAdmin webmaster@y.com
    DocumentRoot /usr/home/123
    ServerName y.net
    ErrorLog /usr/httplog/y.err
    CustomLog /usr/httplog/y.log common
</VirtualHost>

do I have to set it to listen to both IPs before the virtualhost? how do I do that?
 
Ok, I got ip aliasing and httpd.conf to work together, however the /etc/rc.conf did not work:

Code:
 1. ifconfig_re0="inet x.x.x.4 netmask 255.248.0.0"
ifconfig_re0_alias1="inet x.x.x.5 netmask 255.255.255.0"

but command line did work:
Code:
2. ifconfig re0 x.x.x.5 netmask 255.255.255.0 alias

can someone tell me why 2. works but not one? what is the correct command to put for freebsd? thanks.

for httpd.conf,
I listed both ips in first, then followed by what was in the first post.

Code:
NameVirtualHost x.x.x.4:80
NameVirtualHost x.x.x.5:80
 
I tried alias0, instead of alias1, still no luck after rebooting...

have to do it by hand after each reboot...
 
Could you post your exact, updated rc.conf?

Another thing I would point out is for aliases that are on the same subnet as the primary IP, the mask should actually be set to 255.255.255.255.
 
anomie, thanks! i was wondering if I should try .255 -- did not know it has to be the exact number. strangely the command line would work for .0. anyway I rebooted and now it works! the easiest problem so far for my boxes...
 
Back
Top