Networking Forums

Networking Forums > Computer Networking > Linux Networking > Can linux box have two host names / 2 ip addresses

Reply
Thread Tools Display Modes

Can linux box have two host names / 2 ip addresses

 
 
Richard TU
Guest
Posts: n/a

 
      09-30-2004, 09:00 PM
If yes, could you guys give some suggestions on how to do it?

Many thanks

Richard


 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      10-01-2004, 04:47 AM
On 2004-09-30, Richard TU <(E-Mail Removed)> wrote:
> If yes, could you guys give some suggestions on how to do it


IP address, as many as you want. Just add network cards or define
aliases. For the hostname, the machine can respond to different
hostnames (this is why you have CNAME record in DNS), but he will
have _one_ hostname.

Now, explain your problem.

Davide

--
While preceding your entrance with a grenade is a good tactic in
Quake, it can lead to problems if attempted at work.
--C Hacking
 
Reply With Quote
 
Bernhard Kastner
Guest
Posts: n/a

 
      10-01-2004, 02:15 PM
Richard TU schrieb:
> If yes, could you guys give some suggestions on how to do it?
>
> Many thanks
>
> Richard
>
>

paralelly on one nic: no
you can have several network cards (nic) in it and then have several IPs...
 
Reply With Quote
 
Lew Pitcher
Guest
Posts: n/a

 
      10-01-2004, 02:28 PM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bernhard Kastner wrote:
> Richard TU schrieb:
>
>> If yes, could you guys give some suggestions on how to do it?
>>
>> Many thanks
>>
>> Richard
>>
>>

> paralelly on one nic: no


Parallely on one NIC: yes.

ifconfig eth0
ifconfig eth0:0

will add two 'logical' interfaces, with their own seperate IP addresses,
that both use the same NIC. As far as the Linux system is concerned,
there are two NICs, even though there is only one physical NIC installed.

> you can have several network cards (nic) in it and then have several IPs...


True

- --

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)

iD8DBQFBXWmSagVFX4UWr64RAiJYAKD0MIrzeNoQdduWjh5bRU 7oE7KfMQCeLrYe
0vXp/UohRT47v1oZYX/Bq8Y=
=oU94
-----END PGP SIGNATURE-----
 
Reply With Quote
 
Stachu 'Dozzie' K.
Guest
Posts: n/a

 
      10-01-2004, 02:53 PM
On 2004-10-01, Bernhard Kastner wrote:
> Richard TU schrieb:
>> If yes, could you guys give some suggestions on how to do it?
>>
>> Many thanks
>>
>> Richard
>>
>>

> paralelly on one nic: no


Dunno then how it works:

#v+
[root@hans dozzie]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:6E:B7:95:81
inet addr:192.168.2.2 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12452 errors:0 dropped:0 overruns:0 frame:0
TX packets:14948 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6975514 (6.6 Mb) TX bytes:1626778 (1.5 Mb)
Interrupt:12 Base address:0x3000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:396 (396.0 b) TX bytes:396 (396.0 b)

[root@hans dozzie]# ifconfig eth0 add 10.0.0.1
[root@hans dozzie]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:6E:B7:95:81
inet addr:192.168.2.2 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12453 errors:0 dropped:0 overruns:0 frame:0
TX packets:14948 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6975580 (6.6 Mb) TX bytes:1626778 (1.5 Mb)
Interrupt:12 Base address:0x3000

eth0:0 Link encap:Ethernet HWaddr 00:0C:6E:B7:95:81
inet addr:10.0.0.1 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:12 Base address:0x3000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:396 (396.0 b) TX bytes:396 (396.0 b)

[root@hans dozzie]# cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 396 6 0 0 0 0 0 0 396 6 0 0 0 0 0 0
eth0: 6985446 12485 0 0 0 0 0 0 1634568 15017 0 0 0 0 0 0
#v-

--
Stanislaw Klekot
 
Reply With Quote
 
Richard TU
Guest
Posts: n/a

 
      10-01-2004, 06:22 PM
Thanks a lot for your replies.
I understand that one NIC can be configured to have multiple IP addresses.
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 linux box. Is this doable?

thanks
Richard


"Davide Bianchi" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) .net...
> On 2004-09-30, Richard TU <(E-Mail Removed)> wrote:
> > If yes, could you guys give some suggestions on how to do it

>
> IP address, as many as you want. Just add network cards or define
> aliases. For the hostname, the machine can respond to different
> hostnames (this is why you have CNAME record in DNS), but he will
> have _one_ hostname.
>
> Now, explain your problem.
>
> Davide
>
> --
> While preceding your entrance with a grenade is a good tactic in
> Quake, it can lead to problems if attempted at work.
> --C Hacking



 
Reply With Quote
 
Lew Pitcher
Guest
Posts: n/a

 
      10-01-2004, 07:02 PM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard TU wrote:
> Thanks a lot for your replies.
> I understand that one NIC can be configured to have multiple IP addresses.
> 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 linux box. Is this doable?


Yes, this is doable. And you have some choices as to how you do it.

For IP addresses, you can either have a couple of NICs in the one box,
with each NIC assigned one of the IP addresses in question, or you can
have one NIC in the box, with multiple IP addresses assigned to it.

For the hostnames (actually, DNS names), you can assign seperate names
for each IP address, or you can assign multiple names to one IP address.

For your web server, you can configure it with 'virtual server' IDs, so
that it answers from a different document root for each unique IP
address or DNS name it is responsible for. For instance, you can
configure the /one/ server to listen on all IP addresses, and answer
from /var/web/foo.com/ for any reference to an http://foo.com/ page, or
from /var/web/bar.com/ for any reference to an http://bar.com/ page
(assuming that foo.com and bar.com both resolve to the one system,
either through seperate IP addresses or the same IP address).


- --

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)

iD8DBQFBXanAagVFX4UWr64RAjbDAJ4xppZtUzEyZDmt2Y59YN LMLRxUMQCeIl2+
Bz3lqe4hb1QZpC61yMwkAx0=
=hH0K
-----END PGP SIGNATURE-----
 
Reply With Quote
 
James Knott
Guest
Posts: n/a

 
      10-01-2004, 08:28 PM
Richard TU wrote:

> 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 linux box. Is this doable?
>


Certainly. Just create an alias address, so both IPs work with the one box.
Don't worry about the host name, as that box won't.

--

(This space intentionally left blank)
 
Reply With Quote
 
Richard TU
Guest
Posts: n/a

 
      10-01-2004, 08:39 PM
Thanks a lot once again. I just configured it as to what you suggested, and
also set the virtual host in httpd.conf. It works!! Great!!
Thanks everybody!
Richard


"Lew Pitcher" <(E-Mail Removed)> wrote in message
news:dRh7d.28992$(E-Mail Removed) ...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Richard TU wrote:
> > Thanks a lot for your replies.
> > I understand that one NIC can be configured to have multiple IP

addresses.
> > 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 linux box. Is this doable?

>
> Yes, this is doable. And you have some choices as to how you do it.
>
> For IP addresses, you can either have a couple of NICs in the one box,
> with each NIC assigned one of the IP addresses in question, or you can
> have one NIC in the box, with multiple IP addresses assigned to it.
>
> For the hostnames (actually, DNS names), you can assign seperate names
> for each IP address, or you can assign multiple names to one IP address.
>
> For your web server, you can configure it with 'virtual server' IDs, so
> that it answers from a different document root for each unique IP
> address or DNS name it is responsible for. For instance, you can
> configure the /one/ server to listen on all IP addresses, and answer
> from /var/web/foo.com/ for any reference to an http://foo.com/ page, or
> from /var/web/bar.com/ for any reference to an http://bar.com/ page
> (assuming that foo.com and bar.com both resolve to the one system,
> either through seperate IP addresses or the same IP address).
>
>
> - --
>
> 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)
>
> iD8DBQFBXanAagVFX4UWr64RAjbDAJ4xppZtUzEyZDmt2Y59YN LMLRxUMQCeIl2+
> Bz3lqe4hb1QZpC61yMwkAx0=
> =hH0K
> -----END PGP SIGNATURE-----



 
Reply With Quote
 
Bill Unruh
Guest
Posts: n/a

 
      10-01-2004, 10:59 PM
James Knott <(E-Mail Removed)> writes:

]Richard TU wrote:

]> 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 linux box. Is this doable?
]>

]Certainly. Just create an alias address, so both IPs work with the one box.
]Don't worry about the host name, as that box won't.

Well, actually IP addresses refer to interfaces. If that one box has only
one interface, then the remote system will get confused-- it will send a
request to IP address 1 and receive a response from IP address 2.

Names are easy. Just have both names point to the same IP address in the
DNS tables of your DNS server (AFAIK they must be on the same subnet for this to
work. Ie you cannot have string.physics.ubc.ca and organ.phys.mcmaster.ca
point tothe same IP since the mcmaster.ca domain is a different subnet than
ubc.ca) If you want the same interface (ie that one ethernet card) to have
different IP address, that is I believe more difficult. You could use
proxyarp I guess to have the one machine be the proxyarp to the other IP.
But you would still have trouble on the ip of the outbound packets.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any point to full host names in /etc/hosts ? Rikishi 42 Linux Networking 52 11-12-2007 06:59 PM
Why aren't host names showing up with ssh? Tristan Miller Linux Networking 13 04-17-2006 12:29 PM
Resolving host names on a moveable laptop mtford Linux Networking 5 03-20-2006 08:31 PM
DHCPD and host names gedm Linux Networking 0 06-08-2005 09:00 AM
Can Not Resolve Host names =?Utf-8?B?QXR0aWN1cyBGaW5jaA==?= Windows Networking 4 01-16-2005 10:11 PM



1 2 3 4 5 6 7 8 9 10 11