Networking Forums

Networking Forums > Computer Networking > Linux Networking > Ethernet order

Reply
Thread Tools Display Modes

Ethernet order

 
 
ak47
Guest
Posts: n/a

 
      12-14-2003, 07:58 AM
I am new to Linux and using RH9.0.

I have two ethernet cards, eth0 is on my internal network (192.1.1.*)
and eth1 has an external IP address. The internal network has machines
which is nat'ed thru a router for internet access.

If I was to access the internet or any network resources, how does the
OS select which network to use first? how does it all work with two
adpaters?

AK
 
Reply With Quote
 
 
 
 
jack
Guest
Posts: n/a

 
      12-14-2003, 03:09 PM
ak47 wrote:
> I am new to Linux and using RH9.0.
>
> I have two ethernet cards, eth0 is on my internal network (192.1.1.*)
> and eth1 has an external IP address. The internal network has machines
> which is nat'ed thru a router for internet access.


Does that mean that some of the internal boxes are connected to a
separate router? Or does Your linux box do this?


> If I was to access the internet or any network resources, how does the
> OS select which network to use first? how does it all work with two
> adpaters?


First of all, read the Networking-HowTo.

This is a matter of routing. When You configure Your NICs, You will
specify an IP address and a netmask. The OS then knows that it can
reach every destination in that subnet via that respective NIC.
Additionally, You can add other routes to the routing table.
Most commonly, You will have one "default route" which will be used
when no other route matches the destination network.

For example, say Your eth0 is configured with IP address 192.168.1.1
and the netmask is 255.255.255.0, which is very common among small
home networks. Every connection to 192.168.1/24 would go through eth0.

If there is another local network 192.168.2/24, and one box in the
192.168.1/24 is connected to both networks and acts as a gateway, You
could tell Your OS that the 192.168.2/24 network can be accessed via
that box:

route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.32

where "192.168.1.32" is the gateway to that other network.

Every packet with a destination address in 192.168.2/24 will go out
via eth0 and be sent to 192.168.1.32 and from there into the other
net. - In this example, the gateway knows that one NIC is connected to
192.168.1/24 from the NIC setup with IP address 192.168.1.32, netmask
255.255.255.0. It also knows that a second NIC is connected to the other
subnet, also from the setup.

Hope this puts You on the track,


Cheers, Jack.

--
----------------------------------------------------------------------
My personal reading of the string "MicroSoft" expands to "NanoWeak"...

 
Reply With Quote
 
ak47
Guest
Posts: n/a

 
      12-15-2003, 10:14 AM
Thanks for the reply - I will read the HOW-TO.....

To clarify - I do have an internal network using a westell adsl
modem/router for normal use with 192.168.1.* (the router/modem is
192.168.1.1).

I added this Linux box on the network to play with and wanted it to
host some websites which I plan but also to serve files to the
internal network hence the two NIC's.

I wanted to kow (as both the networks can access the internet, either
internal thru the NAT or direct using eth1 - the external IP'd NIC) if
I was to type www.google.com in a web browser, which NIC would it use?
What IP address would the target server see?

Thanks again for the reply....now for the HOW-TO....

If anyone else has the time for a quick answer that would be
appreciated as I am very new to this Linux thing, but have been hugely
impressed so far.
 
Reply With Quote
 
jack
Guest
Posts: n/a

 
      12-15-2003, 11:53 AM
ak47 wrote:
> Thanks for the reply - I will read the HOW-TO.....
>
> To clarify - I do have an internal network using a westell adsl
> modem/router for normal use with 192.168.1.* (the router/modem is
> 192.168.1.1).
>
> I added this Linux box on the network to play with and wanted it to
> host some websites which I plan but also to serve files to the
> internal network hence the two NIC's.


If I understand that correctly, the clients in that 192.168.1/24 net
connect to the internet via that Westell device, an _not_ via Your
linux box.

If that is the case:

> I wanted to kow (as both the networks can access the internet, either
> internal thru the NAT or direct using eth1 - the external IP'd NIC) if
> I was to type www.google.com in a web browser, which NIC would it use?
> What IP address would the target server see?


This depends on how Your routing is configured. Try

"/sbin/route -n"

and it will (most likely) show a "host entry" (netmask 255.255.255.255)
for Your (public) eth1 pointing at Your ISP's side of the connection
(in fact, their router). Then You will find one line that tells Your
kernel to use eth0 for destinations inside the 192.168.1.0/255.255.255.0
subnet.

The last route, with some sort of "catch all" destination 0.0.0.0, is
referred to as the default route. This is the one that will be used
when no earlier route matched the target.

So in Your case, it depends on how that default route is set up. There
are two options:

In this default route, there's a gateway specified. Essentially, this
tells Your kernel to forward all traffic that appears to be non-local
to that gateway machine, which in turn will take care of its delivery.

So You could specify Your Westell with 192.168.1.1 as the default gw,
and Your connection to any public IP except for Your own and that of
Your ISP's router would go via eth0 to that device. Of course all
connections to 192.168.1/24 will also use eth0.

You can, on the other hand, specify the ISP's router as the default
gateway. Then, only packets to Your local net (192.168.1/24) will use
eth0, all others will go via eth1 to Your ISP's router.

In the former case (eth0), any server You contact will see the modem's
IP as the sender address; in the latter case, Your public IP that is
configured on eth1.


> Thanks again for the reply....now for the HOW-TO....


You should. Things are very well explained there, and You will most
certainly understand things a lot better.

Glad to hear You enjoy Linux. Keep going.


Cheers, Jack.


--
----------------------------------------------------------------------
My personal reading of the string "MicroSoft" expands to "NanoWeak"...

 
Reply With Quote
 
ak47
Guest
Posts: n/a

 
      12-17-2003, 06:42 PM
Jack

Many many thanks for your answer - it is very much appreciated.

AK
 
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
problem setting up moto we800g ethernet bridge with linksys ethernet router I'm NOT DON Windows Networking 0 05-30-2005 07:50 PM
BT Order Tracker anth Broadband 7 07-26-2004 02:30 PM
BT Order Tracker John Towill Broadband 2 02-02-2004 03:39 PM
Did I order the right AP? Marc Onrust Wireless Internet 8 11-15-2003 03:07 PM
PROBLEM: Notebook w/PCMCIA ethernet & docking station ethernet / Multiple NICs / Only use one at a time ---==[Quasar]==--- Linux Networking 0 09-19-2003 04:03 AM



1 2 3 4 5 6 7 8 9 10 11