Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Dual NIC & Routing
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
bigV
Tux's lil' helper
Tux's lil' helper


Joined: 05 Dec 2002
Posts: 102
Location: Southampton, UK

PostPosted: Tue Jul 08, 2003 8:45 am    Post subject: Dual NIC & Routing Reply with quote

I have two NIC cards loaded and ready to go. I am having a problem understanding the routing however!! :?

The routing is as follows
Code:
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.24.240.254   10.24.240.5     255.255.255.255 UGH      40 0          0 eth1
10.24.240.0     0.0.0.0         255.255.255.0   U        40 0          0 eth1
10.24.0.0       0.0.0.0         255.255.252.0   U        40 0          0 eth0
127.0.0.0       127.0.0.1       255.0.0.0       UG       40 0          0 lo
0.0.0.0         10.24.2.253     0.0.0.0         UG       40 0          0 eth0

my /etc/conf.d/net config is as follows

Code:
iface_eth0="10.24.2.93 broadcast 10.24.3.255 netmask 255.255.252.0"
iface_eth1="10.24.240.5 broadcast 10.24.240.255 netmask 255.255.255.0"
gateway="eth0/10.24.2.253"

Why, by default, do the two NICS both use the same default gw. This toally messes the routing up for me and I am unsure how to fix it!!

I have a similar setup on a solris box where the routing is perfect i.e.

Code:
  Destination           Gateway           Flags  Ref   Use   Interf
-------------------- -------------------- ----- ----- ------ ------
172.16.0.0           172.16.0.10           U        1  14585  eri1
10.24.0.0            10.24.2.94            U        1   4401  eri0
224.0.0.0            10.24.2.94            U        1      0  eri0
default              172.16.0.254          UG       1   1797 
127.0.0.1            127.0.0.1             UH      8291654586  lo0


By default, to get to the 10.24.0.0 network, go to the 10.24.2.94 (local) interface :arrow: this is good :D
Also, by default, to get to the 172.16.0.0 network, go via the 172.16.0.10 (local) interface :arrow: this is also good :D

Why do I have problems on my Gentoo box - or is it me just being extremely stupid!! :? :arrow: please no comments on this one

bigV
Back to top
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Tue Jul 08, 2003 11:00 am    Post subject: Reply with quote

Hi!

The routing seems to be ok for me

line 1 in routing table
host routing for 10.24.240.254 to 10.24.240.5

line 2
to go to 10.24.240.0/24 use eth1, means everything from 10.24.240.0-10.24.240.255 goes through this NIC

line 3
to go to 10.24.24.0/22 use eth1, means everything from 10.24.0.0-10.24.3.255 goes through this NIC

line 4
local loop

line 5
everything else (Genmask 0.0.0.0) -> throw towards the next station who knows how to route the stuff, means standard gateway 10.24.2.253

BTW:
having a router in the middle of a network range isn't very wise. I always set mine to the outer borders. 10.24.3.254 in that case
_________________
Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself
Back to top
View user's profile Send private message
bigV
Tux's lil' helper
Tux's lil' helper


Joined: 05 Dec 2002
Posts: 102
Location: Southampton, UK

PostPosted: Tue Jul 08, 2003 11:08 am    Post subject: Reply with quote

By default though I get the following....

Code:
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.24.240.0     0.0.0.0         255.255.255.0   U        40 0          0 eth1
10.24.0.0       0.0.0.0         255.255.252.0   U        40 0          0 eth0
127.0.0.0       127.0.0.1       255.0.0.0       UG       40 0          0 lo
0.0.0.0         10.24.2.253     0.0.0.0         UG       40 0          0 eth0


I inserted the following with a route add -net

Code:
10.24.240.254   10.24.240.5     255.255.255.255 UGH      40 0          0 eth1


Which means that both of my interfaces , eth0 and eth1 are using the same default gw i.e. to get to 10.24.240.1 for instance, I have to go to 10.24.2.253 :arrow: This is not what I want

See what I mean :wink:
Back to top
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Tue Jul 08, 2003 11:28 am    Post subject: Reply with quote

1. why the 'route add -net'?
If at all this should be -host. OK, the netmask is /32 but who knows...

2.To be honest i don't see your problem
Default gateway is (always, no matter if its Solaris/Windows/xBSD/Linux) last resort. Every packet which has no explicit entry in the routing table is handled by this one. All the others are handled by the according rules

Every packet with dest. ip 10.24.240.0/24 -> eth1
Every packet with dest. ip 10.24.0.0/22 -> eth0
Every packet with dest. ip 127.0.0.0/8 -> local
Every packet 'not handled above' -> default gateway (to be reached over eth0)

i'm just trying to understand your point but up to now this routing is perfectly OK
_________________
Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself
Back to top
View user's profile Send private message
devon
l33t
l33t


Joined: 23 Jun 2003
Posts: 943

PostPosted: Tue Jul 08, 2003 3:41 pm    Post subject: Reply with quote

Think4UrS11 wrote:
i'm just trying to understand your point but up to now this routing is perfectly OK

I believe he is confused because the Gentoo box and the Solaris box outputs the routing data in different formats. :)

He reads the following
Code:
10.24.240.0     0.0.0.0         255.255.255.0   U        40 0          0 eth1
0.0.0.0         10.24.2.253     0.0.0.0         UG       40 0          0 eth0

as saying "Route 10.24.240.0/24 to 0.0.0.0 which then goes to 10.24.2.253"

bigV: When the Gentoo box needs to send a packet to either 10.24.240.0/24 or 10.24.0.0/22, the box will ARP for the destination's MAC address and then send the packet out the appropriate interface. If the packet is not to either network, it will use the default gateway.
Back to top
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Tue Jul 08, 2003 3:50 pm    Post subject: Reply with quote

so maybe we should write some sort of extension for netstat, shouldn't we?

netstat -rn -"os-style"

where os-style can be

linux / xBSD / Solaris / Windoze / OS390 / graphical / ...

just kidding :twisted:
_________________
Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself
Back to top
View user's profile Send private message
bigV
Tux's lil' helper
Tux's lil' helper


Joined: 05 Dec 2002
Posts: 102
Location: Southampton, UK

PostPosted: Wed Jul 09, 2003 11:58 am    Post subject: Reply with quote

arse :oops:
Back to top
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Wed Jul 09, 2003 5:28 pm    Post subject: Reply with quote

stay cool

a llittle joke sometimes must be possible

life is to hard without a good sense of black humor :)
_________________
Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum