vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Richard TU wrote: > If yes, could you guys advise how to do it? 1. Install two NICs. 2. Create configurations for the NICs with different IP addresses. That is the normal configuration anyway. 3. Make entries into /etc/hosts that map different host names to the IP addresses. But this suggestion will not work in all ways. Logging onto the server and issuing -- $ hostname -- will not produce two hostnames, depending on which NIC you have accessed the system by. Why not simply state the problem, not your idea of a solution? -- Paul Lutus http://www.arachnoid.com |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Richard TU wrote: > If yes, could you guys advise how to do it? Yes, a linux system can have two host names and two IP addresses. Most already do. For hostnames, you have to determine what sort of hostname you are interested in. - - If it is the name returned by the hostname(1) utility, then you only get one name. Sorry. - - If it is the name used by Samba as your systemname within a workgroup or domain, then again, you only get one. Sorry. - - However, if it is the name associated to your IP address, then you get as many names as you can assign to your IP address. You can use the /etc/hosts file (see hosts(5)) to assign as many names as you want to your static IP addresses. You can also use your DNS server to assign the names. You already have at least /one/ host name for your system: IP address 127.0.0.1 is, by convention, named as "localhost" (or "localhost.localnet") by the /etc/hosts file. As for IP addresses, if your system is connected to a network, then it already has at least two IP addresses. Run the ifconfig(8) command, and it will list each interface you have. Most interfaces will be assigned an IP address, including the "lo" interface (which is assigned the IP address 127.0.0.1). You get as many IP addresses as you have network interfaces for. (And, btw, each IP address can have a host name, assigned either through /etc/hosts or through DNS; you already have the hostname of "localhost" assigned this way, for instance.) To get more than one working /network/ IP address, you have to have more than one working network adaptor. You either install multiple NICs into your system, or you use Linux "logical" networking interface. This permits you to have (for instance) an eth0 /and/ an eth0:0 device; two logical interfaces each with it's own IP address, but on one physical NIC. See the ifconfig(8) manual page for details. - -- Lew Pitcher Master Codewright & JOAT-in-training | GPG public key available on request Registered Linux User #112576 (http://counter.li.org/) Slackware - Because I know what I'm doing. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBXKNQagVFX4UWr64RAr4NAJ9KWArmOM1lyghT8X2MeQ U5+OuTDwCfcO66 o3PKTmGP8uevZaSFb50zn+4= =BR6x -----END PGP SIGNATURE----- |
| |||
| Paul Lutus wrote: >Richard TU wrote: > > > >>If yes, could you guys advise how to do it? >> >> > >1. Install two NICs. > > 1) You can have multiple IP addresses bound to a single NIC. You only need different NIC's if you are going to hook them physically to different networks. 2) You can have multiple names for a machine, even when they point to the same IP address. I do this all the time in order to call machines by their roll name. This allows me to change what servers handle various requests by just changing the IP address for the name in the DNS. Here are some examples: ns.domain.com -> main name server for the domain mail.domain.com -> main mail exhanger for the domain fileserver.domain.com -> main file server for the domain etc.. Of courese, as others have stated, typing hostname will only give you the primary hostname, and looking up the name via an IP address will generally only return the primary hostname. Cliff -- _____cliff_rayman_____cliff_@_rayman_._com_____ |
| |||
| Lew Pitcher wrote: > Yes, a linux system can have two host names and two IP addresses. Most already do. > > For hostnames, you have to determine what sort of hostname you are interested in. > > - - If it is the name returned by the hostname(1) utility, then you only get one > name. Sorry. At least with the stock kernel. There is the vserver patch which, among others, can assign different hostnames for every context. I doubt the original poster is interested in it, but there IS a way. > - - If it is the name used by Samba as your systemname within a workgroup or > domain, then again, you only get one. Sorry. That is a lot simpler, you can have multiple Samba installs, bound to different network interfaces. Each one can have their own hostname. There ARE some things you can't do in Linux, but these are not among them -- Petre. |
| |||
| Richard TU wrote: > If yes, could you guys advise how to do it? > I see most people assume you mean one thing by a Linux box. And they probably assume correctly what you mean. But there is another way of looking at things. When I have a dual boot machine (e.g., Linux and Windows), I give it a different but similar IP address. E.g. 192.168.100.1 for Windows and 192.168.100.101 for Linux. Then my other machines on the LAN can impose stricter requirements on the Windows box and the Linux box, even if we are talking about the same box, just one with different OS running at the time -- which is different from my point of view. So my main machine, the one connected to the Internet directly, perceives two machines out on the LAN, a Windows machine and a Linux machine, even though there is only one box there. It might make inferences from the fact that only one is active at a time, but that is about it. -- .~. Jean-David Beyer Registered Linux User 85642. /V\ Registered Machine 241939. /( )\ Shrewsbury, New Jersey http://counter.li.org ^^-^^ 08:30:00 up 8 days, 19:34, 3 users, load average: 4.30, 4.22, 4.19 |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ratiu Petru wrote: > Lew Pitcher wrote: > > >>Yes, a linux system can have two host names and two IP addresses. > > Most already do. > >>For hostnames, you have to determine what sort of hostname you are > > interested in. > > >>- - If it is the name returned by the hostname(1) utility, then you > > only get one > >> name. Sorry. > > At least with the stock kernel. There is the vserver patch which, among > others, can assign different hostnames for every context. I doubt the > original poster is interested in it, but there IS a way. I did not know that. Thanks for the info. > >>- - If it is the name used by Samba as your systemname within a > > workgroup or > >> domain, then again, you only get one. Sorry. > > That is a lot simpler, you can have multiple Samba installs, bound to > different network interfaces. Each one can have their own hostname. Aha! That's the key; they have to be bound to different interfaces. Again, I did not know that. Thanks again > There ARE some things you can't do in Linux, but these are not among > them > The thing I find with Linux is that there's always more to learn. I /love/ this OS. <grin> - -- Lew Pitcher, IT Consultant, Enterprise Data Systems Enterprise Technology Solutions, TD Bank Financial Group (Opinions expressed here are my own, not my employer's) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) iD8DBQFBXU6/agVFX4UWr64RAvk7AKDjEGBVTBua5pPXGNMXOX7o1xadVQCggV Z7 257XqjmBjIcsD3dafXTDhHU= =6Jgp -----END PGP SIGNATURE----- |
| |||
| Thanks a lot for your replies. I understand a lot now after you explained it. Here is my problem: I have two linux boxes, each with its own IP and hostname. Now I want to combine these two into one linux box, but still keep the two sets of IP addresses and hostnames. For example, when I go to the web page, both hostnames should lead me to the same linux box after the combination. I prefer to use one NIC to listen to two IP addresses like setting eth0 and eth0:0 to different IP address. What I have to do is to add the hostname in the hosts file, is that right? thanks Richard "Lew Pitcher" <lpitcher@sympatico.ca> wrote in message news:1r17d.28494$tT2.1526581@news20.bellglobal.com ... > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Richard TU wrote: > > If yes, could you guys advise how to do it? > > Yes, a linux system can have two host names and two IP addresses. Most already do. > > For hostnames, you have to determine what sort of hostname you are interested in. > > - - If it is the name returned by the hostname(1) utility, then you only get one > name. Sorry. > - - If it is the name used by Samba as your systemname within a workgroup or > domain, then again, you only get one. Sorry. > - - However, if it is the name associated to your IP address, then you get as > many names as you can assign to your IP address. You can use the /etc/hosts > file (see hosts(5)) to assign as many names as you want to your static IP > addresses. You can also use your DNS server to assign the names. You already > have at least /one/ host name for your system: IP address 127.0.0.1 is, by > convention, named as "localhost" (or "localhost.localnet") by the /etc/hosts > file. > > As for IP addresses, if your system is connected to a network, then it already > has at least two IP addresses. Run the ifconfig(8) command, and it will list > each interface you have. Most interfaces will be assigned an IP address, > including the "lo" interface (which is assigned the IP address 127.0.0.1). You > get as many IP addresses as you have network interfaces for. (And, btw, each > IP address can have a host name, assigned either through /etc/hosts or through > DNS; you already have the hostname of "localhost" assigned this way, for > instance.) > > To get more than one working /network/ IP address, you have to have more than > one working network adaptor. You either install multiple NICs into your > system, or you use Linux "logical" networking interface. This permits you to > have (for instance) an eth0 /and/ an eth0:0 device; two logical interfaces > each with it's own IP address, but on one physical NIC. See the ifconfig(8) > manual page for details. > > - -- > Lew Pitcher > > Master Codewright & JOAT-in-training | GPG public key available on request > Registered Linux User #112576 (http://counter.li.org/) > Slackware - Because I know what I'm doing. > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.4 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFBXKNQagVFX4UWr64RAr4NAJ9KWArmOM1lyghT8X2MeQ U5+OuTDwCfcO66 > o3PKTmGP8uevZaSFb50zn+4= > =BR6x > -----END PGP SIGNATURE----- |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Richard TU wrote: > Thanks a lot for your replies. > I understand a lot now after you explained it. > > Here is my problem: > I have two linux boxes, each with its own IP and hostname. Now I want to > combine these two into one linux box, but still keep the two sets of IP > addresses and hostnames. For example, when I go to the web page, both > hostnames should lead me to the same linux box after the combination. > I prefer to use one NIC to listen to two IP addresses like setting eth0 and > eth0:0 to different IP address. What I have to do is to add the hostname in > the hosts file, is that right? Remember that /etc/hosts only affects the system on which it resides. So, each system that will access the new 'combined' system will need corresponding changes to its own /etc/hosts file. If you don't have control over these outside systems, then you should make a change at the DNS level. Assuming (for the purposes of this illustration) that your two sites are currently named foo.bar.com (at IP address 10.0.0.1) and rosanne.bar.com (at 10.0.0.2) here's what I would do with the combined system... In your network config scripts ifconfig eth0 10.0.0.1 broadcast 10.255.255.255 netmask 255.0.0.0 ifconfig eth0:0 10.0.0.2 broadcast 10.255.255.255 netmask 255.0.0.0 In your various /etc/hosts file 10.0.0.1 foo.bar.com foo 10.0.0.2 rosanne.bar.com rosanne (alternatly, update your DNS to point these domain names to the proper IP addresses). In your Apache httpd.conf file <VirtualHost foo.bar.com> ServerAdmin webmaster@foo.bar.com DocumentRoot /var/www/foo.bar.com ServerName foo.bar.com ErrorLog logs/foo.bar.com-error_log CustomLog logs/foo.bar.com-access_log common </VirtualHost> <VirtualHost rosanne.bar.com> ServerAdmin webmaster@rosanne.bar.com DocumentRoot /var/www/rosanne.bar.com ServerName foo.bar.com ErrorLog logs/rosanne.bar.com-error_log CustomLog logs/rosanne.bar.com-access_log common </VirtualHost> In directory /var/www/foo.bar.com place the web pages for web domain foo.bar.com In directory /var/www/rosanne.bar.com place the web pages for the web domain rosanne.bar.com - -- Lew Pitcher, IT Consultant, Enterprise Data Systems Enterprise Technology Solutions, TD Bank Financial Group (Opinions expressed here are my own, not my employer's) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) iD8DBQFBXbAvagVFX4UWr64RAjMDAJsHHy3vleqfV2AlOaCL7q TQ3W9RkQCgutRD W6vA7v9F8HRk958EVxlzpzI= =gB2x -----END PGP SIGNATURE----- |
| ||||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Lew Pitcher wrote: [snip] Correction... See below > In your Apache httpd.conf file > <VirtualHost foo.bar.com> > ServerAdmin webmaster@foo.bar.com > DocumentRoot /var/www/foo.bar.com > ServerName foo.bar.com > ErrorLog logs/foo.bar.com-error_log > CustomLog logs/foo.bar.com-access_log common > </VirtualHost> > <VirtualHost rosanne.bar.com> > ServerAdmin webmaster@rosanne.bar.com > DocumentRoot /var/www/rosanne.bar.com ServerName rosanne.bar.com > ErrorLog logs/rosanne.bar.com-error_log > CustomLog logs/rosanne.bar.com-access_log common > </VirtualHost> > > In directory /var/www/foo.bar.com > place the web pages for web domain foo.bar.com > > In directory /var/www/rosanne.bar.com > place the web pages for the web domain rosanne.bar.com - -- Lew Pitcher, IT Consultant, Enterprise Data Systems Enterprise Technology Solutions, TD Bank Financial Group (Opinions expressed here are my own, not my employer's) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) iD8DBQFBXbCHagVFX4UWr64RAnAtAKCN3jVYkrbqWTWL7ca4Io rGbORs2ACgpScF 46A03rzhE6y/HnQS1zpgSKU= =AD+d -----END PGP SIGNATURE----- |