FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 02-01-2012, 06:35 PM
Steve Clark
 
Default ip route and nexthop: the "CentOS" way

On 02/01/2012 02:03 PM, Nick wrote:
> Hi,
>
> I'm wanting to configure a CentOS 6 server to have a fall-back default route via
> a second network interface.
>
> Given:
>
> - eth0 with 192.168.0.10 on subnet 192.168.0.0/24 gateway 192.168.0.1
> - eth1 with 192.168.1.10 on subnet 192.168.1.0/24 gateway 192.168.1.1
>
> Where eth0's network is a "back door" to the internet, and eth1's is the "front
> door", I believe I can configure the routing table manually like this:
>
> ip route default scope global
> nexthop via 192.168.1.1 dev eth1 weight 1
> nexthop via 192.168.0.1 dev eth0 weight 2
>
> However, I've re-read the RHEL6 documents for configuring static routes here:
>
>
> http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-networkscripts-static-routes.html
>
> This kind of thing doesn't seem to fit into the scheme of
> /etc/sysconfig/network-scripts/route-eth? described there, since the route isn't
> "for" any single interface. Is there a "RHEL/CentOS" way to do this, or do I
> need to resort to some sort of script containing the above ip route command
> inserted somewhere?
>
> And how do I stop CentOS from trying to pick its own default gateway settings
> (since /etc/sysconfig/network likely won't have a GATEWAY parameter)?
>
>
Hmm...

I just tried this and besides needing ip route "add" default

It does not seem to work when I unplug the cable on my primary link.

--
Stephen Clark
*NetWolves*
Director of Technology
Phone: 813-579-3200
Fax: 813-882-0209
Email: steve.clark@netwolves.com
http://www.netwolves.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-01-2012, 08:06 PM
Les Mikesell
 
Default ip route and nexthop: the "CentOS" way

On Wed, Feb 1, 2012 at 1:35 PM, Steve Clark <sclark@netwolves.com> wrote:
>
>> I'm wanting to configure a CentOS 6 server to have a fall-back default route via
>> a second network interface.
>>
>> Given:
>>
>> * - eth0 with 192.168.0.10 on subnet 192.168.0.0/24 gateway 192.168.0.1
>> * - eth1 with 192.168.1.10 on subnet 192.168.1.0/24 gateway 192.168.1.1
>>
>> Where eth0's network is a "back door" to the internet, and eth1's is the "front
>> door", I believe I can configure the routing table manually like this:
>>
>> * ip route default scope global
>> * * nexthop via 192.168.1.1 dev eth1 weight 1
>> * * nexthop via 192.168.0.1 dev eth0 weight 2
>>
>> However, I've re-read the RHEL6 documents for configuring static routes here:
>>
>>
>> http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-networkscripts-static-routes.html
>>
>> This kind of thing doesn't seem to fit into the scheme of
>> /etc/sysconfig/network-scripts/route-eth? described there, since the route isn't
>> "for" any single interface. *Is there a "RHEL/CentOS" way to do this, or do I
>> need to resort to some sort of script containing the above ip route command
>> inserted somewhere?
>>
>> And how do I stop CentOS from trying to pick its own default gateway settings
>> (since /etc/sysconfig/network likely won't have a GATEWAY parameter)?
>>
>>
> Hmm...
>
> I just tried this and besides needing ip route "add" default
>
> It does not seem to work when I unplug the cable on my primary link.

I don't think CentOS is smart enough to automatically drop routes
associated with a NIC that is down like a Cisco would. If you put
routes in /etc/sysconfig/network-scripts/routes-eth? to match the
device names, the ifup and ifdown scripts will add/remove routes when
you manually run time to enable/disable a particular NIC, but that
doesn't get you automatic failover. And with ethernet type devices it
is pretty rare for the link to go away at the same time the packets
stop getting through anyway.

--
Les Mikesell
lesmikesell@gmail.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-01-2012, 08:22 PM
Steve Clark
 
Default ip route and nexthop: the "CentOS" way

On 02/01/2012 04:06 PM, Les Mikesell wrote:
> On Wed, Feb 1, 2012 at 1:35 PM, Steve Clark<sclark@netwolves.com> wrote:
>>> I'm wanting to configure a CentOS 6 server to have a fall-back default route via
>>> a second network interface.
>>>
>>> Given:
>>>
>>> - eth0 with 192.168.0.10 on subnet 192.168.0.0/24 gateway 192.168.0.1
>>> - eth1 with 192.168.1.10 on subnet 192.168.1.0/24 gateway 192.168.1.1
>>>
>>> Where eth0's network is a "back door" to the internet, and eth1's is the "front
>>> door", I believe I can configure the routing table manually like this:
>>>
>>> ip route default scope global
>>> nexthop via 192.168.1.1 dev eth1 weight 1
>>> nexthop via 192.168.0.1 dev eth0 weight 2
>>>
>>> However, I've re-read the RHEL6 documents for configuring static routes here:
>>>
>>>
>>> http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-networkscripts-static-routes.html
>>>
>>> This kind of thing doesn't seem to fit into the scheme of
>>> /etc/sysconfig/network-scripts/route-eth? described there, since the route isn't
>>> "for" any single interface. Is there a "RHEL/CentOS" way to do this, or do I
>>> need to resort to some sort of script containing the above ip route command
>>> inserted somewhere?
>>>
>>> And how do I stop CentOS from trying to pick its own default gateway settings
>>> (since /etc/sysconfig/network likely won't have a GATEWAY parameter)?
>>>
>>>
>> Hmm...
>>
>> I just tried this and besides needing ip route "add" default
>>
>> It does not seem to work when I unplug the cable on my primary link.
> I don't think CentOS is smart enough to automatically drop routes
> associated with a NIC that is down like a Cisco would. If you put
> routes in /etc/sysconfig/network-scripts/routes-eth? to match the
> device names, the ifup and ifdown scripts will add/remove routes when
> you manually run time to enable/disable a particular NIC, but that
> doesn't get you automatic failover. And with ethernet type devices it
> is pretty rare for the link to go away at the same time the packets
> stop getting through anyway.
>
I got it sort of work - but even with the weights and flushing the routing cache sometimes
it seemed to want to go on the higher weighted route. Could be something in my
setup.

I did onetime have if fail from the lower weight to the higher weighted route when I pulled
the cable on the preferred route.

--
Stephen Clark
*NetWolves*
Director of Technology
Phone: 813-579-3200
Fax: 813-882-0209
Email: steve.clark@netwolves.com
http://www.netwolves.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-02-2012, 09:28 AM
Nick
 
Default ip route and nexthop: the "CentOS" way

On 01/02/12 21:06, Les Mikesell wrote:
>> Hmm...
>>
>> I just tried this and besides needing ip route "add" default
>>
>> It does not seem to work when I unplug the cable on my primary link.

Well, I should disclose that is an experiment, and I may not have explained the
config fully - see the pages I referenced for more authoritative information. I
did think I had it working but I am less sure now, and caching looks like it may
be a problem.

I should emphasise that the main question I have here is: is RHEL's scheme for
configuring routing flexible enough to accommodate such configurations?

And if it isn't, is there anything I should bear in mind when hacking a script
to do this sort of thing, in order to avoid breaking my system or generally
fighting against the system's assumptions?


> I don't think CentOS is smart enough to automatically drop routes
> associated with a NIC that is down like a Cisco would. If you put
> routes in /etc/sysconfig/network-scripts/routes-eth? to match the
> device names, the ifup and ifdown scripts will add/remove routes when
> you manually run time to enable/disable a particular NIC,

Right; and then one NIC's state controls the routing configuration for both. I
can't see an easy way around that.


> but that doesn't get you automatic failover.
> And with ethernet type devices it
> is pretty rare for the link to go away at the same time the packets
> stop getting through anyway.

Just to clarify, by "that" do you mean custom "routes in [..]/routes-eth?" or
the nexthop configuration I mentioned? It'd guess the former, but I'm more
interested in the latter.

Based on some tests I suspect it works initially, then if things change, the
routing cache will keep the old non-working config until someone flushes it.
Note, I'm not sure about this either (due to the general fog of fatigue), and
I'm thinking I should try a an entirely different approach.

Thanks,

N
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-02-2012, 09:41 AM
Ljubomir Ljubojevic
 
Default ip route and nexthop: the "CentOS" way

On 02/02/2012 11:28 AM, Nick wrote:
> And if it isn't, is there anything I should bear in mind when hacking a script
> to do this sort of thing, in order to avoid breaking my system or generally
> fighting against the system's assumptions?
>

I would have ping the gateway of primary link (maybe both) and some
outside IP on that path, and in case of timeouts I would activate
changes or something. Like "heartbeat" tests.

But I recommend you read:
http://www.shorewall.net/Shorewall_and_Routing.html

and then consider using shorewall in MultiISP environment. I do not
think Basic routing is able to deal with changing circumstances, at
least not fast enough. One solution would be running dynamic routing
protocols, like OSPF or OLSR, which involves running then on several
routers/systems, or using some active script like shorewall.

--

Ljubomir Ljubojevic
(Love is in the Air)
PL Computers
Serbia, Europe

Google is the Mother, Google is the Father, and traceroute is your
trusty Spiderman...
StarOS, Mikrotik and CentOS/RHEL/Linux consultant
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-02-2012, 11:10 AM
Steve Clark
 
Default ip route and nexthop: the "CentOS" way

On 02/02/2012 05:41 AM, Ljubomir Ljubojevic wrote:
> On 02/02/2012 11:28 AM, Nick wrote:
>> And if it isn't, is there anything I should bear in mind when hacking a script
>> to do this sort of thing, in order to avoid breaking my system or generally
>> fighting against the system's assumptions?
>>
> I would have ping the gateway of primary link (maybe both) and some
> outside IP on that path, and in case of timeouts I would activate
> changes or something. Like "heartbeat" tests.
>
Yes, we use a perl script that pings two different sites on the net using specific routes
to direct the pings out specific interfaces, if after a configurable number of pings get lost
out the primary interface the perl script changes the default route to the secondary interface
while still trying to ping out the primary interface, when a configurable number of pings out the
primary interface succeed the perl script changes the default route back to the primary.
> But I recommend you read:
> http://www.shorewall.net/Shorewall_and_Routing.html
>
> and then consider using shorewall in MultiISP environment. I do not
> think Basic routing is able to deal with changing circumstances, at
> least not fast enough. One solution would be running dynamic routing
> protocols, like OSPF or OLSR, which involves running then on several
> routers/systems, or using some active script like shorewall.
>


--
Stephen Clark
*NetWolves*
Director of Technology
Phone: 813-579-3200
Fax: 813-882-0209
Email: steve.clark@netwolves.com
http://www.netwolves.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-03-2012, 06:58 AM
Gordon Messmer
 
Default ip route and nexthop: the "CentOS" way

On 02/01/2012 11:03 AM, Nick wrote:
> I believe I can configure the routing table manually like this:
> ip route default scope global
> nexthop via 192.168.1.1 dev eth1 weight 1
> nexthop via 192.168.0.1 dev eth0 weight 2
>
> This kind of thing doesn't seem to fit into the scheme of
> /etc/sysconfig/network-scripts/route-eth? described there, since the route isn't
> "for" any single interface.

It doesn't really matter that the route isn't "for" a specific
interface. The route just has to be valid when the file is evaluated.
You'd want to create route-eth1 and add a single line starting with
"default" and containing the rest of the command you listed above.

> And how do I stop CentOS from trying to pick its own default gateway settings
> (since /etc/sysconfig/network likely won't have a GATEWAY parameter)?

If you're not specifying one elsewhere, the system won't "pick" one as
far as I know.

Having said that, I don't think that the kernel will do automatic route
detection failures. IIRC, "weight" is used for load balancing, and
connections will be pinned to whatever route is selected.

You probably don't want to do any of this. Instead, you'd want to use a
package that's set up to handle the routes and rules that are required
for multiple ISP handling, and scripts that are written to detect link
failure and adjust the system accordingly. Consider:
http://www.shorewall.net/MultiISP.html#LinkMonitor

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 01:01 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org