Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/etc/conf.d/net and routes
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
systema encephale
n00b
n00b


Joined: 17 Apr 2006
Posts: 11

PostPosted: Fri Oct 22, 2010 1:07 pm    Post subject: /etc/conf.d/net and routes Reply with quote

Hi,

I need to assign an IP address to an eth interface on a Gentoo box but I want all the traffic for the given network to go through the default gateway. When I write the network config in /etc/conf.d/net and restart the net.eth0 daemon, besides configuring that address on the eth0, it also sets the direct route for that network. Well, I don't want it to set the route. Is there a way to tell Gentoo "just do the ifconfig stuff and don't touch routes"?

Thanks a lot
Back to top
View user's profile Send private message
AngelKnight
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jan 2003
Posts: 126

PostPosted: Fri Oct 22, 2010 2:48 pm    Post subject: Re: /etc/conf.d/net and routes Reply with quote

[quote="systema encephale"]Hi,

I need to assign an IP address to an eth interface on a Gentoo box but I want all the traffic for the given network to go through the default gateway. When I write the network config in /etc/conf.d/net and restart the net.eth0 daemon, besides configuring that address on the eth0, it also sets the direct route for that network. Well, I don't want it to set the route. Is there a way to tell Gentoo "just do the ifconfig stuff and don't touch routes"?

Thanks a lot[/quote]

If you're assigning statically, set the network on the IP address to a /32 instead of whatever it actually is. But you're going to have to add a connected route for your gateway also so that your Gentoo box knows it can ARP for it. Unless it can't, in which case you're going to have a fun time with this :)

Background: If you add, say, a /24 address, that's an assertion that other IPs on that /24 are "directly connected" to the ethernet adapter. On ethernet or ethernet-alikes, that means the station can ARP for the destination L3 right on the ethernet device. If you were to add the /XX address, the kernel would automatically add the connected route in the background. If you have ECMP configured, you can see this, I beileve, with "/sbin/ip route show table 255".
Back to top
View user's profile Send private message
systema encephale
n00b
n00b


Joined: 17 Apr 2006
Posts: 11

PostPosted: Fri Oct 22, 2010 3:04 pm    Post subject: Reply with quote

Hi, thanks for the reply. I will explain you my situation so that you can understan better. I want to split up my huge /16 network to several /24 smaller ones using different vlans. In the center there's an HP Procurve 4204 doing basic layer 3 routing between the vlans. My Gentoo box has a foot on each vlan and will work as dhcp AND http server: this means that the http server address MUST be the same for all vlans, while the dhcp server address has to belong to the subnet it releases addresses for, otherwise the dhcpcd daemon complains at startup.
Let's say my box has main address 10.0.0.100/24 and 101 vlan's address 10.2.1.253/24 (10.2.1.254 is the procurve's address). It can release addresses to hosts in the 101 vlan, but if one of them (say 10.2.1.1) tries to contact 10.0.0.100 the reply comes from 10.2.1.253 and gets discarded. 10.0.0.100 and 10.2.1.253 are the same machine, but the reply packet goes through the shortest route. If I remove from the routing table the 10.2.1.0/24 direct route and I force the Gentoo box to go through its default gateway (again, the procurve) the 10.2.1.1 host sees the reply coming from 10.0.0.100.
Do you have another solution? Should I play with metric?

Thanks
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 621
Location: Yeovil, Somerset, UK

PostPosted: Mon Oct 25, 2010 12:33 am    Post subject: Reply with quote

One simple solution might be to remove the additional links on your Gentoo box ie only have one IP address on it. Then use BOOTP/DHCP forwarding on your Procurve to get requests for addresses to your DHCP server. The Procurve is your router so it should worry about what network is where. dhcpd will still allocate addresses for the correct subnet because the forwarding agent will describe the network it got the request for.

Another idea might be to use policy based routing on your Gentoo box to do source based routing but that's a bit of a fiddle. Read these:

http://www.policyrouting.org/PolicyRoutingBook/ONLINE/TOC.html
http://lartc.org/howto/

Cheers
Jon
Back to top
View user's profile Send private message
AngelKnight
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jan 2003
Posts: 126

PostPosted: Wed Oct 27, 2010 7:29 am    Post subject: Reply with quote

systema encephale wrote:
Hi, thanks for the reply. I will explain you my situation so that you can understan better. I want to split up my huge /16 network to several /24 smaller ones using different vlans. In the center there's an HP Procurve 4204 doing basic layer 3 routing between the vlans. My Gentoo box has a foot on each vlan and will work as dhcp AND http server: this means that the http server address MUST be the same for all vlans, while the dhcp server address has to belong to the subnet it releases addresses for, otherwise the dhcpcd daemon complains at startup.
Let's say my box has main address 10.0.0.100/24 and 101 vlan's address 10.2.1.253/24 (10.2.1.254 is the procurve's address). It can release addresses to hosts in the 101 vlan, but if one of them (say 10.2.1.1) tries to contact 10.0.0.100 the reply comes from 10.2.1.253 and gets discarded. 10.0.0.100 and 10.2.1.253 are the same machine, but the reply packet goes through the shortest route. If I remove from the routing table the 10.2.1.0/24 direct route and I force the Gentoo box to go through its default gateway (again, the procurve) the 10.2.1.1 host sees the reply coming from 10.0.0.100.
Do you have another solution? Should I play with metric?

Thanks


If you insist on doing this on one box, your only likely means of accomplishing this is either policy routing at your web-and-DHCP server, or teaching your procurve to do exceedingly twisted things to all the traffic it manages.

If you insist on DHCP and web on the same server, these are the choices your constraints have left you with.
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