大网数据广告活动
服务器运维问答

Adding a deafult route during heartbeat handover on debian

· 52CE 我爱测

We have a heartbeat handover that goes on between 2 firewalls out of one of our networks, the interface that the handover happens on has no IP set by default and only gets this IP when the handover happens. This also happens to b…

问题原文

原帖链接 · johnstod · CC BY-SA 3.0

We have a heartbeat handover that goes on between 2 firewalls out of one of our networks, the interface that the handover happens on has no IP set by default and only gets this IP when the handover happens. This also happens to be the default route out of this network (machines being used as firewalls) we don't have the IP space to give these machines another IP address each. This however causes issues when trying to route traffic to anything outside of the WAN port.

How do I go about adding a default route to an interface that has no IP address currently (the interface comes up via a system.d service on boot) or can I add a route on the handover over of the IP?

已采纳解答

原帖链接 · Matt Kereczman · CC BY-SA 3.0

You can add/remove routes with the ocf:heartbeat:Route resource agent.

The description of the Route resource-agent is:

Manages network routes (ocf:heartbeat:Route)

Enables and disables network routes.

Supports host and net routes, routes via a gateway address, 
and routes using specific source addresses.

This resource agent is useful if a node's routing table
needs to be manipulated based on node role assignment.

Consider the following example use case:

  -  One cluster node serves as an IPsec tunnel endpoint.

  -  All other nodes use the IPsec tunnel to reach hosts
     in a specific remote network.

Then, here is how you would implement this scheme making use
of the Route resource agent:

  -  Configure an ipsec LSB resource.

  -  Configure a cloned Route OCF resource.

  -  Create an order constraint to ensure 
     that ipsec is started before Route.

  -  Create a colocation constraint between the
     ipsec and Route resources, to make sure no instance
     of your cloned Route resource is started on the
     tunnel endpoint itself.

Parameters (*: required, []: default):

destination* (string): Destination network
    The destination network (or host) to be configured for the route. 
    Specify the netmask suffix in CIDR notation (e.g. "/24").
    If no suffix is given, a host route will be created.
    Specify "0.0.0.0/0" or "default" if you want this resource to set 
    the system default route.

device (string): Outgoing network device
    The outgoing network device to use for this route.

gateway (string): Gateway IP address
    The gateway IP address to use for this route.

source (string): Source IP address
    The source IP address to be configured for the route.

table (string): Routing table
    The routing table to be configured for the route.

Operations' defaults (advisory minimum):

    start         timeout=20
    stop          timeout=20
    monitor       timeout=20 interval=10
    reload        timeout=20

Define that in your configuration after your IP, and the route will get added once the IP is there.

Using Heartbeat without Pacemaker is deprecated, so finding any current documentation on that will be difficult. If able, you should probably have a look at adding Pacemaker to your setup.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-08-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。