Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with routes in ubuntu #189

Open
amateo opened this issue Sep 22, 2016 · 2 comments
Open

Problem with routes in ubuntu #189

amateo opened this issue Sep 22, 2016 · 2 comments

Comments

@amateo
Copy link

amateo commented Sep 22, 2016

Hi,

I'm trying to use this module to configure my network routes. I'm running ubuntu servers (12.04, 14.04 and 16.04). My problem is that although network_route is creating entries in /etc/network/routes the route is not actually added in the system after a restart or manually add.

To solve this, I have add an exec to run /etc/init.d/networking restart but this doesn't work in all ubuntu servers (networking configuration changed since 14.04).

I have also tried to use the /etc/init.d/networking-routes script provided with ifupdown-extra package. The problem in this case is that network_route is adding blank spaces (I guess that spaces for options) at the end of every line so that script didn't parse them.

Would it be possible that network_route implements the actual command to add/remove the route in a running system?

@rski
Copy link
Member

rski commented Sep 22, 2016

It puts extra spaces that make the file unparsable by ifupdown-extra? that sounds bad, can you post an example manifest and resulting networking-routes script?

@amateo
Copy link
Author

amateo commented Sep 27, 2016

This is a sample manifests:

network_route {'192.168.1.0/24':
    ensure => 'present',
    network => '192.168.1.0',
    gateway => '155.54.212.126',
    netmask => '255.255.255.0',
    interface => $facts['networking']['primary'],
}

With this manifest, you can see the route file produced in this gist, where you can see spaces at the end of line 6.
The problem is that in some ubuntu distributions (I have checked it in 12.04 and 14.04) the /etc/init.d/networking-routes provided with ifupdown-extra package to reload routes has this line:

...
add_global_routes() {
        ret=0
    cat $ROUTEFILE | egrep "^[^#].*any$" | 
    while read network netmask gateway interface ; do
...

and because of the final espaces the routes are ignored.
The route file created is valid for the ifupdown script run in the system boot (when the interface is initialized). The problem is with the script provided to reload routes without shutting down interfaces.
I have also checked that the script provided with the package for ubuntu 16.04 uses a different grep, so the file produced is compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants