No routing table entries when adding network route via Puppet

Issues related to configuring your network
Post Reply
LJS
Posts: 18
Joined: 2016/09/22 13:11:56

No routing table entries when adding network route via Puppet

Post by LJS » 2018/01/19 21:10:10

Okay. I've been attempting to add static routes via Puppet to a number of host machines. I've been writing to /etc/sysconfig/network-scripts/route-xxxxx and the entries that have been appearing look something like this...

Code: Select all

# HEADER: This file is being managed by puppet. Changes to
# HEADER: routes that are not being managed by puppet will persist;
# HEADER: however changes to routes that are being managed by puppet will
# HEADER: be overwritten. In addition, file order is NOT guaranteed.
# HEADER: Last generated at:
172.xx.xx.xxx/255.255.255.255 via 10.x.x.x dev xxx
...what I am not seeing however is anything in the routing table; all I see is the default values.

I've been tinkering around with the 'options' parameter below, i.e. trying the various table IDs and names that are populated in /etc/iproute2/rt_tables, but haven't had any joy (probably because I'm barking up the wrong tree).

Code: Select all

    network_route { '172.xx.xx.xxx/32':
      ensure    => 'present',
      gateway   => '10.x.x.x',
      interface => $interface,
      netmask   => '255.255.255.255',
      network   => '172.xx.xx.xxx',
      options   => 'table local',
    }
Now, I expect if I were to use the Network/Netmask Directives Format to populate the routes that might bring me some luck, but I having spent a lot of time configuring my module thus far I'm reluctant to do that until I've exhausted all options.

Does anyone have any idea of what I can do here?

User avatar
TrevorH
Forum Moderator
Posts: 23849
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: No routing table entries when adding network route via Puppet

Post by TrevorH » 2018/01/19 22:12:56

Try running the command manually ip route add 172.xx.xx.xxx/255.255.255.255 via 10.x.x.x dev xxx and see what that says.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

LJS
Posts: 18
Joined: 2016/09/22 13:11:56

Re: No routing table entries when adding network route via Puppet

Post by LJS » 2018/01/20 09:03:07

That does work. I see the resulting entry in the routing table.

User avatar
TrevorH
Forum Moderator
Posts: 23849
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: No routing table entries when adding network route via Puppet

Post by TrevorH » 2018/01/20 10:31:24

Well looking at your puppet macro, there are things specified there that are not in your route file. I've never used that puppet function - didn't exist when I needed it and I wrote my own version. Looking at what you have specified though I would expect it to have generated a route file that said

Code: Select all

172.xx.xx.xxx/32 via 10.x.x.x table local dev $interface
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

LJS
Posts: 18
Joined: 2016/09/22 13:11:56

Re: No routing table entries when adding network route via Puppet

Post by LJS » 2018/01/20 11:31:50

Understood, and I agree.

Do you by chance have any recommendations on how to add host routes under Puppet to CentOS 7? There are 3-4 network modules that go about the process in different ways but having tried two of them I'm now presented with the issue described above. I would expect route or netstat to display the entries I'm attempting to populate in the route-xxxxx file, and having also tried other parameters I'm kind of lost!

User avatar
TrevorH
Forum Moderator
Posts: 23849
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: No routing table entries when adding network route via Puppet

Post by TrevorH » 2018/01/20 14:17:06

Since you're specifying 'table local', are you running ip ro sh table local ?
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

LJS
Posts: 18
Joined: 2016/09/22 13:11:56

Re: No routing table entries when adding network route via Puppet

Post by LJS » 2018/01/22 10:52:10

Sorry for the late reply.

Do you mean as follows? options => 'ip ro sh table local'. If so then I have just tried that and still get the same result.

User avatar
TrevorH
Forum Moderator
Posts: 23849
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: No routing table entries when adding network route via Puppet

Post by TrevorH » 2018/01/22 14:13:04

No, I meant to run exactly that command as root at a command prompt : ip route show table local to check that routing table itself.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

LJS
Posts: 18
Joined: 2016/09/22 13:11:56

Re: No routing table entries when adding network route via Puppet

Post by LJS » 2018/01/23 10:18:30

As luck would have it, after using a different network module and trying some new config in the module I built myself, I've got things working.

If anyone encounters issues similar to what I had then I recommend using https://github.com/example42/puppet-network as your base config and adding in your extras from there.

Post Reply