RE: How to use Route??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2003-12-31 at 01:01, Ow Mun Heng wrote:
> Sorry.. Didn't finish my email .. see below 
> 
> > > On Tue, 2003-12-30 at 23:09, Ow Mun Heng wrote:
> > > > I have 2 network cards. One is a wifi eth1 and another's LAN eth0.
> > > > Both of these have different ip addresses and I just need them to 
> > > > be routed differently.
> > > > 
> > > > eg: eth1 10.0.0.1 gw 10.0.0.10   		<-company lan
> > > >     eth2 192.168.0.1 gw 192.168.0.10	<- wifi/internet
> > > > 
> > > and you want to reach hosts on either the 192.168.0 network or the
> > > 10.0.0 network, routing is handled automatically.
> 
> So.. it would know which NIC to route it to? 192.168.0 will go 
> through eth2 automatically. what if I want to go to www.hotmail.com?
---
yes

for example - see one of my systems...
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use
Iface
192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0
eth0
192.168.10.0    0.0.0.0         255.255.255.0   U     0      0        0
eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0
lo
0.0.0.0         192.168.10.254  0.0.0.0         UG    0      0        0
eth1

and then (clipping out unnecessary data)...
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0B:DB:93:23:27
          inet addr:192.168.100.5  Bcast:192.168.100.255 
          Mask:255.255.255.0

eth1      Link encap:Ethernet  HWaddr 00:0B:DB:93:23:28
          inet addr:192.168.10.5  Bcast:192.168.10.255 
          Mask:255.255.255.0

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0

what this means is...
data to 192.168.100.0 network (192.168.100.x because subnet mask
255.255.255.0) would go through eth0
data to 192.168.10.0 network (192.168.10.x because subnet mask
255.255.255.0) would go through eth1
data to 127.0.0.0 network (127.x.x.x because subnet mask 255.0.0.0)
would go through lo

all other traffic - ip's not in 192.168.100.x 192.168.10.x and 127.x.x.x
ranges would go to 192.168.10.254 (my default gateway which is
accessible only through eth1). Since 192.168.10.254 is my router to the
internet, I can easily get to www.yahoo.com.

But if I now add a network 192.168.100.20 subnet mask 255.255.255.0
(class C) and there is a mail server on that network in another office
that I want to get mail from...192.168.20.1, I can't get there. Suppose
this other office network is attached to the 192.168.10.0 network
through a vpn whose routing is handled via 192.168.10.253.

I already have a default gateway to send packets for 'unknown networks'
but this default gateway won't reach 192.168.20.1 so I have to add a
static route to get there...

route add -net 192.168.20.0 netmask 255.255.255.0 gw 192.168.10.253

All of this notwithstanding, it would appear that your problem is that
you want to connect to the internet and you are confused by how to deal
with two network interfaces and that you have no need for a static route
at all.

All you really need to know is what ip address is providing internet
services to your lan. That should be your default gateway. That is where
all packets that aren't destined for any local addresses should go. i.e.
www.yahoo.com 

Craig


-- 
Shrike-list mailing list
Shrike-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/shrike-list

[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux