- can I have 1 box with 2 NICs and 2 hostnames?

PDA

View Full Version : can I have 1 box with 2 NICs and 2 hostnames?


Kev
07-24-2004, 10:06 PM
Hi, think the subject line sums up my problem. I have a linux box with
2 network cards in it, with 2 seperate I.P. addresses. The box is not
the DNS server and I cant change anything on the DNS server for the
network (cos it dont let me). What I need to do is have a hostname
corresponding to each network card on the linux box.

So far it just has one hostname which just resolves to 1 of the
I.P.s. Both cards are connected to the same network (it has to be this
way! : ). I dont know which card this hostname/I.P. relates to at the
moment.

I REALLY REALLY need help here. I can't find any posts about this in
searches on message boads, usenet or the web. I do, however, need 2
NICs on the same network with different hostnames :P

Thanks in advance

Kev

Running: Mandrake 9

Bill Unruh
07-24-2004, 10:06 PM
farleyflemin@hotmail.com (Kev) writes:

]Hi, think the subject line sums up my problem. I have a linux box with
]2 network cards in it, with 2 seperate I.P. addresses. The box is not
]the DNS server and I cant change anything on the DNS server for the
]network (cos it dont let me). What I need to do is have a hostname
]corresponding to each network card on the linux box.

Sure. No problem. However, there are some gotchas which may not be what
you want.
a) routing-- basically you need to choose which of the ports to use with
which addresses. you cannot ask it to "use the least used one" or ask it
to split the traffic between the two (doubling the rate) for example.
Thus the usual situation is where you have an internal network say with
10.x.x.x addresses and an external network. Traffic for the outside
world goes via the external network and your default route is on that,
and traffic on the internal network goes via the other card.

As far as hostnames are concerned, there are two issues. a)
externally-- a hostname is just an alias for the IP address. The DNS
nameserver is the translator.
b) on the host itself-- you need to choose a hostname for the machine
itself (or X for example will get very upset) There is no particular
reason why the internal name should be the same as any external name.
(well there probably is, but it is not necessary).

Note that there is no reason why the machine need have the same name on
the two external networks either.


] So far it just has one hostname which just resolves to 1 of the
]I.P.s. Both cards are connected to the same network (it has to be this
]way! : ). I dont know which card this hostname/I.P. relates to at the
]moment.

IF they both connect to the same network, then the second card is
useless-- sell it to some deserving person. On the local network, the
packets are passed by MAC number not IP address. The gateway sends out a
request to the machines asking which MAC address is associated with a
given IP (which MUST be on the same subnet as the gateway address), and
then sends out the packets to that MAC address. Ie, locally IP addresses
are not used. And your gateway will have only one MAC per IP. Now you
could give each network card a different IP address. and the gateway
would associate each MAC with each IP but I have no idea what that would
buy you.





] I REALLY REALLY need help here. I can't find any posts about this in
]searches on message boads, usenet or the web. I do, however, need 2
]NICs on the same network with different hostnames :P

Why?

As always tell us the problem you want to solve, not the solution you
think you want. You will get far more help that way.



]Thanks in advance

]Kev

]Running: Mandrake 9

James Knott
07-24-2004, 10:07 PM
Kev wrote:

> Hi, think the subject line sums up my problem. I have a linux box with
> 2 network cards in it, with 2 seperate I.P. addresses. The box is not
> the DNS server and I cant change anything on the DNS server for the
> network (cos it dont let me). What I need to do is have a hostname
> corresponding to each network card on the linux box.
>
> So far it just has one hostname which just resolves to 1 of the
> I.P.s. Both cards are connected to the same network (it has to be this
> way! : ). I dont know which card this hostname/I.P. relates to at the
> moment.
>
> I REALLY REALLY need help here. I can't find any posts about this in
> searches on message boads, usenet or the web. I do, however, need 2
> NICs on the same network with different hostnames :P

A computer has only one name. However, there's no reason why you can't have
2 DNS names.

--

Fundamentalism is fundamentally wrong.

To reply to this message, replace everything to the left of "@" with
james.knott.

Raqueeb Hassan
07-24-2004, 10:07 PM
yes, the DNS can provide more names .... and the hosts file too ....
the two nics can have 2 host names/ip addresses from different blocks
..... depending upon the networks it is connected to.

raqueeb hassan
bunia, DRC

Robert E A Harvey
07-24-2004, 10:07 PM
James Knott <bit_bucket@rogers.com> wrote of names
> A computer has only one name. However, there's no reason why you can't have
> 2 DNS names.

Yes, absolutely.

Although there is always another point of view. In Solaris if you
have more than one ethernet interface there are separate files with
names like /etc/hostname.le0 /etc/hostname.le1 You can (must) map
those names in the hosts file to valid IP addresses for the
interfaces.

I'm not quite sure what the Op is trying to achieve, but I agree
mainly - have one machine name, and more than one network name in
dns/static host files/NIS or whatever resolution method you use.

in Suse YAST will help you set up the details of each interface it
finds - redhat-config-network allows the same thing for another distro

To the OP - you can't have googled hard enough. Try
http://www.prosig.com/protor/kbase/eth1-install.html
http://www.linux.org/docs/ldp/howto/Net-HOWTO/x1100.html
http://sunsite.iisc.ernet.in/virlib/linux/linag2/ch05.html
http://tinyurl.com/rzgq
http://tinyurl.com/rzhl

http://tinyurl.com/rzgl
might interest you too....

Sachin
07-24-2004, 10:07 PM
There can be only one hostname for a machine but u can have 2 nic card
attach to your linux machine.

There r two possiblity of identifying your nic card either by dns
server and entry seperately in host file in each and every machine.

try to add entry in host like this.

192.168.1.1 internal.linux.com internal
192.168.1.2 external.linux.com external

Note:- Same entry also work for other OS.

Then ping from other ping and see what happen.

If u still have got some problem mail me

Kev
07-24-2004, 10:08 PM
Hi, ok I was trying to avoid posting the problem instead of the
required solution : ) but here goes:

I have a linux server set up on a network (connected to a 4 port
swtiched hub). The server has 2 cards in it currently. Now looking
around I think maybe it would work with one.
The problem is that I have strict rules to follow in the set-up of
this box. It will be used for 2 people's final projects for a computer
science degree. This means that although the same hardware will be
used, the 2 people cannot share certain configuration files, so they
must have totaly seperate versions of software, sometimes running
simultaneously - hence 2 i.p.s/hostnames. Specifically, sendmail will
have to have 2 copies running at the same time using totaly different
configurations, almost invisble to each other (probably different
versions even). It will have to be configured to use a specific I.P.
and probably think of the other I.P. as another computer (rather than
using /bin/mail). I REALLY hope this is possible and that somebody can
help because degree's depend on it...

There is no way another machine can be bought and it would have to be
modified to be dependable (new HDD + backup hardware) and it just
cannot be afforded.

many thanks

Kev



farleyflemin@hotmail.com (Kev) wrote in message news:<94658453.0310210725.544965c@posting.google.com>...
> Hi, think the subject line sums up my problem. I have a linux box with
> 2 network cards in it, with 2 seperate I.P. addresses. The box is not
> the DNS server and I cant change anything on the DNS server for the
> network (cos it dont let me). What I need to do is have a hostname
> corresponding to each network card on the linux box.
>
> So far it just has one hostname which just resolves to 1 of the
> I.P.s. Both cards are connected to the same network (it has to be this
> way! : ). I dont know which card this hostname/I.P. relates to at the
> moment.
>
> I REALLY REALLY need help here. I can't find any posts about this in
> searches on message boads, usenet or the web. I do, however, need 2
> NICs on the same network with different hostnames :P
>
> Thanks in advance
>
> Kev
>
> Running: Mandrake 9

W Cardwell
07-24-2004, 10:08 PM
See http://user-mode-linux.sourceforge.net/ . User Mode Linux allows you to
run multiple virtual linux machines simultaneously on the same hardware. The
docs are good so it's not terribly difficult to set up.

--

wcardwell at nc dot rr dot com


"Kev" <farleyflemin@hotmail.com> wrote in message
news:94658453.0310231233.527d5a4c@posting.google.com...
> Hi, ok I was trying to avoid posting the problem instead of the
> required solution : ) but here goes:
>
> I have a linux server set up on a network (connected to a 4 port
> swtiched hub). The server has 2 cards in it currently. Now looking
> around I think maybe it would work with one.
> The problem is that I have strict rules to follow in the set-up of
> this box. It will be used for 2 people's final projects for a computer
> science degree. This means that although the same hardware will be
> used, the 2 people cannot share certain configuration files, so they
> must have totaly seperate versions of software, sometimes running
> simultaneously - hence 2 i.p.s/hostnames. Specifically, sendmail will
> have to have 2 copies running at the same time using totaly different
> configurations, almost invisble to each other (probably different
> versions even). It will have to be configured to use a specific I.P.
> and probably think of the other I.P. as another computer (rather than
> using /bin/mail). I REALLY hope this is possible and that somebody can
> help because degree's depend on it...
>
> There is no way another machine can be bought and it would have to be
> modified to be dependable (new HDD + backup hardware) and it just
> cannot be afforded.
>
> many thanks
>
> Kev
>
>
>
> farleyflemin@hotmail.com (Kev) wrote in message
news:<94658453.0310210725.544965c@posting.google.com>...
> > Hi, think the subject line sums up my problem. I have a linux box with
> > 2 network cards in it, with 2 seperate I.P. addresses. The box is not
> > the DNS server and I cant change anything on the DNS server for the
> > network (cos it dont let me). What I need to do is have a hostname
> > corresponding to each network card on the linux box.
> >
> > So far it just has one hostname which just resolves to 1 of the
> > I.P.s. Both cards are connected to the same network (it has to be this
> > way! : ). I dont know which card this hostname/I.P. relates to at the
> > moment.
> >
> > I REALLY REALLY need help here. I can't find any posts about this in
> > searches on message boads, usenet or the web. I do, however, need 2
> > NICs on the same network with different hostnames :P
> >
> > Thanks in advance
> >
> > Kev
> >
> > Running: Mandrake 9