LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-05-2013, 08:18 AM   #1
karnaf
Member
 
Registered: Dec 2005
Distribution: Linux Mint 14 (Cinnamon), Xubuntu 12.04, Ubuntu 10.04
Posts: 49

Rep: Reputation: 15
Multiple hostname for the same interface


Hi all,

I have a VM with apache on it serving three different sub-domains, for example:
  1. user.example.com
  2. moderator.example.com
  3. admin.example.com

When the VM starts, it gets its IP from the DHCP which should update the nameserver (both are on another VM in the same internal network)

Is there a way for me to register all three hostnames (user, moderator, admin) through DHCP so that anyone in the example.com domain can access any of the addresses, even if the VMs IP had changed?

I tried looking in the following directions, but couldn't find the answer
  • Change the dhclient to publish several hostnames
  • Change the way the DHCP and the NS talk, so that the DHCP would know how to magically notify the NS on that
  • Change the way the NS works
The current solution I followed was to assign a static IP for that VM, with static entries in the NS, but I'm looking for something funkier

Some of my VMs are Ubuntu, some are Fedora

Thanks
karnaf
 
Old 02-05-2013, 09:09 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
a web server has no business running on DHCP. That's just horrible.

What I would suggest is seeing a difference between a hostname and a web domain it serves. A machine should be called by, and therefore registered to DHCP as, the name of the BOX, not of it's websites. the ONLY A record for that box should be the machine hostname. any subsequent sites that it hosts should then be defined statically in DNS as CNAME records pointing to that A record.
 
1 members found this post helpful.
Old 02-05-2013, 09:36 AM   #3
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,481

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by acid_kewpie View Post
a web server has no business running on DHCP. That's just horrible.
I can see where it would be useful to use DHCP to configure things like default gateways, upstream DNS servers etc, but would have a MAC based IP reservation within the DHCP scope.
 
Old 02-05-2013, 09:38 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
oh sure, a reservation is very different. There is no anticipation of anything changing, just being centrally controlled in that sort of situation. You should always now what IP is serving your website though.
 
Old 02-05-2013, 01:13 PM   #5
karnaf
Member
 
Registered: Dec 2005
Distribution: Linux Mint 14 (Cinnamon), Xubuntu 12.04, Ubuntu 10.04
Posts: 49

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by acid_kewpie View Post
a web server has no business running on DHCP. That's just horrible.
Not sure I understand, so I'll answer both options I could think you meant
1. if you meant httpd & dhcp are on the same VM, well, they aren't
2. if you meant that a machine running httpd should have a static address and not get it dynamically, then I agree. However, that's a dev VM machine in a crazy world :-)
Quote:
Originally Posted by acid_kewpie View Post
What I would suggest is seeing a difference between a hostname and a web domain it serves. A machine should be called by, and therefore registered to DHCP as, the name of the BOX, not of it's websites. the ONLY A record for that box should be the machine hostname. any subsequent sites that it hosts should then be defined statically in DNS as CNAME records pointing to that A record.
Sounds like a good plan. Just making sure I got it right
let's assume the machine's "real" hostname is my-funky-dev-server
my-funky-dev-server.example.com will get an IP from DHCP (the A record), which in turn will update the NS
in the NS, I'll set CNAME for all three sub-domains of my web app to point to my-funky-dev-server.example.com by name, and not by IP
Correct?

Thanks!
k
 
Old 02-05-2013, 02:31 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,001

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
Some people use host headers to send the page to the correct server.
 
Old 02-05-2013, 02:53 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by jefro View Post
Some people use host headers to send the page to the correct server.
I think everyone uses host headers... that's how HTTP works..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can one associate a wireless interface with multiple access points?Get multiple IP's? kopatops Linux - Software 1 06-16-2010 04:56 PM
Help need to add multiple hostname charus Linux - Newbie 1 05-21-2010 03:30 AM
Changed hostname during install, now CUPS has wrong hostname on web interface slinx Linux - Software 1 08-07-2009 08:01 PM
How NET_TX_SOFTIRQ select network interface when multiple interface exits Mr.J Linux - Kernel 0 06-02-2009 11:17 AM
multiple ips, multiple gateways, one interface drpixel Linux - Networking 6 12-04-2002 12:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration