Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
2 Nics in the same network. Routing problems.
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
Tmor
n00b
n00b


Joined: 10 Mar 2005
Posts: 30

PostPosted: Tue Aug 23, 2005 5:41 pm    Post subject: 2 Nics in the same network. Routing problems. Reply with quote

Hi,

I have 2 NICs that are both DHCP enabled and I need to be able to talk to them both them. They are both on the same subnet. The problem is in the routing. When DHCP brings up BOTH interfaces it adds 2 default routes. One for each interface on the subnet. This problem only seemed to appear when I started using 2005.1 and the new /etc/conf.d/net parameters.

When no interfaces are up there is only the loopback route.

When one interface (eth0) is up there is a DEFAULT route pointing to the gateway and eth0 is pingable.

Code:
 default     10.15.182.1     0.0.0.0     UG     0     0     0     eth0


When both interfaces (eth0 and eth1) are up there are 2 DEFAULT gateways and only eth1 is pingable.

Code:
 default     10.15.182.1     0.0.0.0     UG     0     0     0     eth0
 default     10.15.182.1     0.0.0.0     UG     0     0     0     eth1



Ideas?
_________________
A day without sunshine is like night...
Back to top
View user's profile Send private message
jamapii
l33t
l33t


Joined: 16 Sep 2004
Posts: 637

PostPosted: Tue Aug 23, 2005 5:50 pm    Post subject: Reply with quote

You can write a postup() shell function in /etc/conf.d/net, that determines the number of default routes, and if it's 2, it removes one of them:

Code:
postup () {
  if [ $(route -n | grep '^0\.0\.0\.0' | wc -l) -gt 1 ]; then
     # route del gw eth0
     # put a command here that removes a default route
  fi
}


But I'm not sure if there's a real problem, and removing a default route solves it.

If it's a wireless and an ethernet lan, I prefer routing over bridging in the access point, then you don't have 2 nics on the same subnet.
Back to top
View user's profile Send private message
Tmor
n00b
n00b


Joined: 10 Mar 2005
Posts: 30

PostPosted: Tue Aug 23, 2005 11:25 pm    Post subject: Script Reply with quote

Yes, that would definately solve the problem of the route, but the interface wouldnt be reachable. To complicate matters more, the two nics are in two different switches and all the switches are in the same network.

Am I just missing a fundamental network problem? It would seem that both interfaces should be able to default back to their respective gateways, which in this case is the firewall with the IP 10.x.x.1 and both be active because the have different MAC/IP addresses which the switches can handle. Spanning-Tree is active and there are no loops in the network.

Now if I am in the same subnet I can talk with both interfaces, but any traffic incoming from another subnet cannot. I have duplicated this several times locally and I dont believe its a firewall configuration and I dont want to NAT any external to internal addresses (although I know that would work flawlessly).

Now, I dont have to have DHCP. I can manually define anything.



The network setup kind of looks like this:

Code:

Router <-> Firewall <-> Switch
                          |
                       Switch --- eth0 |
                          |            | Linux Box
                       Switch --- eth1 | 

_________________
A day without sunshine is like night...
Back to top
View user's profile Send private message
Tmor
n00b
n00b


Joined: 10 Mar 2005
Posts: 30

PostPosted: Sun Sep 04, 2005 3:34 am    Post subject: Reply with quote

bump. anyone know how to get 2 interfaces active on the same subnet?
_________________
A day without sunshine is like night...
Back to top
View user's profile Send private message
bigfunkymo
Apprentice
Apprentice


Joined: 23 Jan 2004
Posts: 237

PostPosted: Sun Sep 04, 2005 1:13 pm    Post subject: Reply with quote

Just out of curiosity, what exactly are you trying to accomplish here?
_________________
[No package... Grabbing a set.]
Back to top
View user's profile Send private message
Taladar
Guru
Guru


Joined: 09 Oct 2004
Posts: 458
Location: Bielefeld, Germany

PostPosted: Sun Sep 04, 2005 6:54 pm    Post subject: Reply with quote

You are likely to end up with all packages going to one interface anyway if both are on the same logical subnet. To avoid that you would have to change routing to your PC and employ some kind of load balancing. Something like that would be needed for outgoing packages too.

So I second the question "what are you trying to do?"
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Mon Sep 05, 2005 7:22 am    Post subject: Reply with quote

Posters are right "What are you trying to do?" The first interface will always be used.

However, I do this as well so that when my wireless connection fails, my wired connection takes over (or vice versa if some dumbass knocks the power off my desk phone (ip phone, PC gets cat5 from phone)).

baselayout-1.12.0 solves this by enforcing different metrics for each interface
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
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