Giter Club home page Giter Club logo

bw.bundle.dhcp's Introduction

bw.bundle.dhcp

Bundlewrap Bundle for isc dhcp

default Metadata

'dhcp': {
    'authoritative': True,
    'bootp': True,
    'log': 'local7',

    'lease-time': 7200,
    'max-lease-time': 43200,

    'vendor_options': {
        'snom': {
            'tftp-server-name': {
                'code': 66,
                'type': 'text',
            },
            'bootfile-name': {
                'code': 67,
                'type': 'text',

            },
        },
    },

    'classes': {
        'snom': {
            'match': 'if substring (option vendor-class-identifier, 0, 4) = "snom"',
            'vendors': ['snom', ],
            'options': {
                'tftp-server-name': '"tftp://192.168.0.1"',
                'snom.tftp-server-name': '"tftp://192.168.0.1"',
                'ntp-servers': '192.168.0.1',
                'bootfile-name': '= concat("snom/",option vendor-class-identifier,".htm")',
                'snom.bootfile-name': '= concat("snom/",option vendor-class-identifier,".htm")',
            },
            'add_raw_parameter': [
                'next-server 192.168.0.1;',
                'filename "snom/snom370.cfg";',
            ]
        },
    },

    'subnets': {
        '192.168.0.0/24': {
            'range': ['192.168.0.100', '192.168.0.190'],
            'options': {
                'routers': '192.168.0.1',
                'broadcast-address': '192.168.0.255',
                'domain-name': '"home"',
                'domain-name-servers': '192.168.0.1',
            },
            'on': {
                'commit': [
                    'set ClientIP = binary-to-ascii(10, 8, ".", leased-address);',
                    'set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));',
                    'set ClientName = pick-first-value ( option fqdn.hostname, option host-name );',

                    'log("=============[ START COMMIT ]================");',
                    'log("The host name is:");',
                    'log(ClientName);',

                    'log(concat("Commit: IP: " , ClientIP, " Mac: ", ClientMac, " Hostname: " , ClientName));',
                    'execute("/etc/dhcp/dhcp-event","commit", ClientIP, ClientMac, ClientName, "auth");',
                    'log("============[ END COMMIT ]==================");',
                ],
                'release': [
                    'set ClientIP = binary-to-ascii(10, 8, ".", leased-address);',
                    'set ClientMac = binary-to-ascii(16, 8, ":", substring(hradware, 1, 6));',
                    'set ClientName = pick-first-value ( option fqdn.hostname, option host-name );',

                    'log("============[ START RELEASE ]===============");',
                    'log(concat("Release: IP: ", ClientIP, " Mac: ", ClientMac, " Hostname: ", ClientName));',
                    'execute("/etc/dhcp/dhcp-event", "release", ClientIP, ClientMac, ClientName, "auth");',
                    'log("===========[ END RELEASE ]==================");',
                ],
                'expiry': [
                    'set ClientIP = binary-to-ascii(10, 8, ".", leased-address);',
                    'set ClientMac = binary-to-ascii(16, 8, ":" , substring(hardware, 1, 6));',
                    'set ClientName = pick-first-value ( option fqdn.hostname, option host-name );',

                    'log("===========[ START EXPIRY ]================");',
                    'log(concat("Expiry: IP: ", ClientIP, " Mac: ", ClientMac, " Hostname: ", ClientName));',
                    'execute("/etc/dhcp/dhcp-event", "expiry", ClientIP, ClientMac, ClientName, "auth");',
                    'log("===========[ END EXPIRY ] =================");',
                ],
            }
        },
    },

    'hosts': {
        # rechner
        'host1': {
            'mac': '00:23:32:xx:xx:xx',
            'ip': '192.168.0.2',
            'options': {
                'host-name': '"host1"',
            }
        },
        'host2': {
            'mac': '00:01:02:xx:xx:xx',
            'ip': '192.168.0.3',
        },
    },
},

The Hosts are extendet by all hosts managed in Bundlewrap which have networks, which are defined (192.168.0.0/24 in this example). There will be an exception, if a mac or ip is used twice.

bw.bundle.dhcp's People

Watchers

 avatar  avatar  avatar

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.