Code Monkey home page Code Monkey logo

Comments (12)

zachfi avatar zachfi commented on August 12, 2024

Hi, Does the gateway get set in rc.conf? I don't think we'll remove the DHCP option if you set a gateway, but I have bsd::network::v4gateway set on all my systems and I get an entry in rc.conf to match.

from puppet-bsd.

da125 avatar da125 commented on August 12, 2024

Hi,

I see my error. What I meant to say was that the default route in netstat -rn get's removed but not set to the one I define in bsd::network::v4gateway. /etc/rc.conf has no "defaultrouter" option when setting an interface to DHCP.

Your module does the right job in setting the "defaultrouter" option in /etc/rc.conf but when restarting the routing service, I think it fails because it first does a "status" on the rc.d script and that parameter does not exist for /etc/rc.d/routing (as can be seen from the puppet client debug output).

from puppet-bsd.

zachfi avatar zachfi commented on August 12, 2024

I've just pushed a status branch with a change that should disable the status lookup. Are you in a position to test that branch?

from puppet-bsd.

da125 avatar da125 commented on August 12, 2024

Let me fire up my vm's and test; will take some time.

As long as the /etc/rc.d/routing just receives a "onerestart", I think everything should work.

from puppet-bsd.

da125 avatar da125 commented on August 12, 2024

Interesting enough, nothing changes. I see the same messages in the puppet agent debug:

Debug: Executing: '/etc/rc.d/routing onestatus'
Debug: /Stage[main]/Bsd::Network/Service[routing]: Skipping restart; service is not running

As a very crude test, I did this:

'FreeBSD': {
  Shellvar {
    target => '/etc/rc.conf',
    notify => Exec['restart_routing']
  }

  exec { 'restart_routing':
    command     => '/etc/rc.d/routing onerestart',
    refreshonly => true
  }

And it works as long as in the manifest I specify a relation, like so:

bsd::network::interface { 'em0':
description => 'Primary Interface',
addresses => [ '192.168.157.133/24', '192.168.157.134/24' ]
}->
class { 'bsd::network':
v4gateway => '192.168.157.2'
}

Yes i know, my ruby/puppet skills need a lot of work...

from puppet-bsd.

zachfi avatar zachfi commented on August 12, 2024

The solution you've outlined makes good sense, though is there a more targeted approach that we could take to avoid any rc.conf change restarting the routing? Only route option changes would need, necessarily, to restart routing. The netif script seems to do the right thing most of the time if you're not adjusting routes.

from puppet-bsd.

da125 avatar da125 commented on August 12, 2024
@@ -73,7 +73,6 @@
    'FreeBSD': {
      Shellvar {
        target => '/etc/rc.conf',
-        notify => Service['routing'],
      }

      # Should we enable IPv4 forwarding?
@@ -104,6 +103,7 @@
      if $v4gateway {
        shellvar { 'defaultrouter':
          value => $v4gateway,
+          notify => Exec['restart_routing']
        }
       } else {
         shellvar { 'defaultrouter':
@@ -116,6 +116,7 @@
      if $v6gateway {
        shellvar { 'ipv6_defaultrouter':
          value => $v6gateway,
+          notify => Exec['restart_routing']
         }
       } else {
         shellvar { 'ipv6_defaultrouter':
 @@ -126,6 +127,11 @@
 
       service { 'routing':
       }
+
+      exec { 'restart_routing':
+        command     => '/etc/rc.d/routing onerestart',
+        refreshonly => true
+      }
     }
     default: {
       notify { 'Not supported': }

That should be better but it still requires the "->" in the manifest. Ex:

bsd::network::interface { 'em0':
description => 'Primary Interface',
addresses => [ '192.168.157.133/24', '192.168.157.134/24' ]
}->
class { 'bsd::network':
v4gateway => '192.168.157.2'
}

And I think this breaks the design of the module. Maybe it makes sense to adjust it so that the defaultroute get's called last, after the last IP is set? (I checked the code but don't realize where this is happening).

from puppet-bsd.

da125 avatar da125 commented on August 12, 2024

any updates on this?

from puppet-bsd.

zachfi avatar zachfi commented on August 12, 2024

Apologies for the delay. That looks like a reasonable change to me. Were you able to test that it worked as you expected?

from puppet-bsd.

da125 avatar da125 commented on August 12, 2024

It works but only if you run the routing after setting the IP for the interface and I think this breaks the module.

from puppet-bsd.

xbeaudouin avatar xbeaudouin commented on August 12, 2024

Have another issue on FreeBSD 12 :

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: no parameter named 'value' (file: /usr/local/etc/puppet/environments/production/modules/bsd/manifests/network.pp, line: 32) on Sysctl[net.inet.ip.forwarding] (file: /usr/local/etc/puppet/environments/production/modules/bsd/manifests/network.pp, line: 32) on node rprng1.prod.hotcity.lu
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

The configuration part on my side was really simple:

class { 'bsd::network':
       v4gateway       => '10.194.57.1',
       v4forwarding    => false,
       v6forwarding    => false,
}
bsd::network::interface { 'vmx0':
       addresses => [ '10.194.57.10/24'],
}

Puppet barf itself on the forwarding stuff... I dunno why, but is there a way to ignore it ?

Regards

from puppet-bsd.

zachfi avatar zachfi commented on August 12, 2024

All my hardware is on 12 and I'm not seeing this. Which version of the module are you running @xbeaudouin? This seems like a different issue than the OP.

from puppet-bsd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.