docsis_server How To

SQL Configuration Settings

  • Enter the "config_nets" data
    INSERT INTO config_nets VALUES
    ('CM' , '10.1.1.1', 1,'10.1.0.0/16', '10.1.1.1', 'NO', 'NO', 'NO','10.1.1.5', '10.1.254.254', 86400,  10,0,0),
    ('CPE', '10.1.1.1', 1,'24.27.1.0/24','24.27.1.1','YES','NO', 'NO','24.27.1.2','24.27.1.254',  86400, 100,0,0),
    ('CPE', '10.1.1.1', 1,'24.27.2.0/24','24.27.2.1','YES','YES','NO','24.27.2.2','24.27.2.254',  86400, 100,0,0);
          

    This assumes that you use the network 10.1.0.0/16 to number your cable modems. I prefer to use a /16 as it gives me about 65,000 modem IPs. If you are a really big provider you would probably rethink this strategy, but it works fine for anyone with a couple thousand modems. We have multiple communites with multiple servers. Each community gets its own 10.x.0.0/16 subnet. We also use the Cisco VRF technology (a type of VLAN) which requires at least 3 of the 10.x networks.
    The CPE equipment have their own IP ranges. When the CMTS alters the GIADDR of the DHCP packet most CMTSs have the option of selecting the GIADDR for CPE queries. On a cisco this would be either "cable dhcp-giaddr primary" to select the primary IP on the interface or "cable dhcp-giaddr policy" which would use the secondary IP address for the GIADDR field of CPE DHCP requests. I use primary. There are good reasons for choosing either.
    • nettype - either 'CM', 'CPE' or 'MTA'. The MTA is for future use.
    • cmts_ip - this what the GIADDR field will be when the DHCP packet is sent from the CMTS.
    • cmts_vlan - If you are using Cisco VRF then you can use this. otherwise just set everything to 1.
    • network - This is the network as specified with the network IP and a subnet mask.
    • gateway - This is the gateway for the network. This IP will usually be found on the cable interface of the CMTS.
    • grant_flag - If this is set to 'NO' the server will not give away IP addresses within this IP range. Usually set to 'NO' for CM ranges and set to 'YES' for CPE ranges. If you have a network set aside for businesses then you can manualy assign them to this network and not worry about the server giving them to regular customers.
    • dynamic_flag - If you set this to 'YES', when a lease expires on a CPE it requests an updated lease, the server will give the CPE a different IP address. In other words the CPE gets a different IP everytime his lease expires.
    • full_flag - When the server has exausted the all the IP addresses in this network it will update the full_flag with a 1 to prevent searching it needlessly.
      The "Delete_Old_Leases" can be used to remove old customer leases.
      The "Count_IPs" program will count all the unused IP addresses and update the full_flag if IPs are now available.
    • range_min - The Lowest IP address in this network to give away a lease for. I usually set the gateway to .1 and then the range_min to .2
    • range_max - The Highest IP address in this network to give away a lease for. I usually set this 1 less than the broadcast address of the net.
    • lease_time - The time in seconds for the lease of these IPs to last. 1 or 2 days is usually good. (1 day = 86400 seconds).
    • config_optX - There are 3 pointers to the config_opts table.

  • Enter the "config_opts" data
    -- These are my options for CM.
    INSERT INTO config_opts VALUES
    (10, 54,  4, 'IP',     '24.27.0.5',           0, 'Lease Server IP'),
    (10,  6,  8, '2IP',    '24.27.0.6,24.27.0.7', 0, 'DNS Servers'),
    (10, 15, 14, 'CHAR',   'domainname.com',      0, 'Domain Name' ),
    (10, 2,   4, 'INT32',  '-21600',              0, 'Time Offset'),
    (10, 4,   4, 'IP',     '24.27.0.5',           0, 'Time Server'),
    (10, 7,   4, 'IP',     '24.27.0.5',           0, 'Log Server'),
    (10, 66,  4, 'CHAR',   '24.27.0.5',           0, 'TFTP Server');
    
    -- These are my options for CPE.
    INSERT INTO config_opts VALUES 
    (100, 54,  4, 'IP',     '24.27.0.5',           0, 'Lease Server IP'),
    (100,  6,  8, '2IP',    '24.27.0.6,24.27.0.7', 0, 'DNS Servers'),
    (100, 15, 14, 'CHAR',   'domainname.com',      0, 'Domain Name');
          

    There is a file included called "dhcpd_option_values" that I borrowed from the ISC dhcp server. Future versions of this file will be a bit more readable as well as giving the correct credit. The config_opts table lets you set the DHCP options that will be sent to CM and CPE. I wrote it this way to support special DHCP options that the packetcable MTAs have or VLAN options for some CMTSs.
    • opt_id - The config_nets table can point to a group of options grouped together by this opt_id.
    • opt_type - A value from 0 to 255 that represents the data type needed. The file included called "dhcpd_option_values" has a list of all known options.
    • opt_len - this value is not actually used anymore, but it looks better if its filled in with the correct number of bytes.
    • opt_dtype - This enumerated type is one of the following
      • IP - This 4 byte type is evaluated from a dot 4 notation into a 32-bit value. ie. xxx.xxx.xxx.xxx = 32-bit IPv4 address.
      • 2IP - Like the IP type except if there is a comma and a 2nd IP address this will produce 2 32-bit IPv4 addresses.
      • INT8 - A signed 8-bit value.
      • UINT8 - An unsigned 8-bit value.
      • INT16 - A signed 16-bit value.
      • UINT16 - An unsigned 16-bit value.
      • INT32 - A signed 32-bit value.
      • UINT32 - An unsigned 32-bit value.
      • CHAR - a character string.
      • SUB-OPT - Some proprietary vendor options require sub-options. This will also be used for packetcable MTAs.
    • opt_value - The actual value that will be encoded. Either a string, an IP or an integer.
    • sub_opt - If a sub-option is needed this will be the id number.
    • comment - A text comment so that when you view the table you know what your looking at. Without comments its difficult to tell what value does what.

    I included all the config_opts that I use. Change the IP addresses to suit your network.
  • Enter the "config_modem" data
    INSERT INTO config_modem (cfg_id, comment, cfg_txt) VALUES
    (1,    '1 IP Address','MaxCPE 1;'),
    (2,    '2 IPs Address','MaxCPE 2;'),
    (1000, 'Network Access Denied',    'NetworkAccess 0;'),
    (1001, 'Network Access Authorized','NetworkAccess 1;');
          

    There is a file "usefull_scripts/Modem_Configs" that has an example of the type of config file snippets you might install. After you add your snippets the BACKG process will convert them from text bits to binary bits. If you wish to hurry the process (and see any errors that might crop up) run the "DB_Config_Encoder" program. It will encode 1 outstanding snippet. compiled fragments are stored in the config_modem_bin table.
    • cfg_id - This is the id number used to identify the code snippet.
    • comment - a short comment about the snippet.
    • cfg_txt - the text of the config snippet.
    • cfg_errors - if their were errors trying to compile the snippet, they will show up here.
    • cfg_update - a date/time stamp used to compare against the config_modem_bin table to see if the option needs to be recompiled.

  • Enter the "docsismodem" data
    INSERT INTO docsis_modem VALUES
    ('009083450E9F', '0.0.1.5', 1, 'serial_001', 501, 'customer.cfg', 303, 0, 1001, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0 ),
    ('00A0732269B6', '0.0.1.6', 1, 'serial_002', 503, 'auto',         301, 0, 1001, 607, 0, 0, 0, 0, 0, 700, 803, 0, 1, 0 ),
    ('00A0732273F0', '0.0.1.7', 1, 'serial_003', 505, 'auto',         301, 0, 1001, 608, 0, 0, 0, 0, 0, 700, 803, 0, 1, 0 ),
    ('00A073227314', '0.0.1.8', 1, 'serial_004', 507, 'auto',         301, 0, 1000, 606, 0, 0, 0, 0, 0, 700, 803, 0, 1, 0 ),
    ('00A0732273F2', '0.0.1.9', 1, 'serial_005', 509, 'auto',         301, 0, 1001, 608, 0, 0, 0, 0, 0, 700, 803, 0, 1, 0 );
          

    You need to pre-enter all your cable modem MAC and IP addresses before those modem can come online. Unknown modems will not authenticate properly. The only significant digits of the modem IP address are those outside of the network mask for the CM net. ie. if you are using 10.1.0.0/16 as your cable modem net then only the last 16 bits of the IP address are used. You can pre-assign an IP address for every modem in your inventory and not worry about which network it is actually on. You can use the vlan id for that.
    • modem_macaddr - The RF MAC address of the cable modem. Must be unique.
    • ipaddr - The IP address of the cable modem. Must be unique.
    • cmts_vlan - This vlan id is used for Cisco VRF type VLANS.
    • serialnum - The serialnumber of the cable modem. Not really used for anything. In our inventory system we key by serialnumber so we have a unique contraint on this column.
    • subnum - We have a unique id number for each of our customers. Not used for anything else.
    • config_file - The name of the cable modem config file. If this file is in a sub-directory below the "tftp-dir" then you must include the directory name. I would avoid sub-directories. If the config file does not exist it will try to generate a config file from the following options.
    • cfg_freq_ds, cfg_freq_us, cfg_auth, cfg_sclass, cfg_sflow_ds, cfg_sflow_us, cfg_sflow_sp1, cfg_sflow_sp2, cfg_bpi, cfg_filter1, cfg_filter2, cfg_filter3 - These options combine together to create a config file from the parts stored in the config_modem table. The names of the columns to not obligate you to use it for that purpose. Options values less than 16 are reserved for the following 2 options.
    • cfg_static_ip, cfg_dynamic_ip - the number of IP addresses reserved for the specific CPE devices.