⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omshell.1

📁 DHCP服务器源码
💻 1
字号:
.\"	$Id: omshell.1,v 1.1.2.5 2004/06/10 17:59:24 dhankins Exp $.\".\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC").\" Copyright (c) 2001-2003 by Internet Software Consortium.\".\" Permission to use, copy, modify, and distribute this software for any.\" purpose with or without fee is hereby granted, provided that the above.\" copyright notice and this permission notice appear in all copies..\".\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF.\" MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE..\".\"   Internet Systems Consortium, Inc..\"   950 Charter Street.\"   Redwood City, CA 94063.\"   <info@isc.org>.\"   http://www.isc.org/.\".\" This software has been written for Internet Systems Consortium.\" by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc..\" To learn more about Internet Systems Consortium, see.\" ``http://www.isc.org/''.  To learn more about Vixie Enterprises,.\" see ``http://www.vix.com''.   To learn more about Nominum, Inc., see.\" ``http://www.nominum.com''..TH omshell 1.SH NAMEomshell - OMAPI Command Shell.SH SYNOPSIS.B omshell.SH DESCRIPTIONThe OMAPI Command Shell, omshell, provides an interactive way to connect to,query, and possibly change, the ISC DHCP Server's state via OMAPI, the ObjectManagement API.  By using OMAPI and omshell, you do not have to stop, makechanges, and then restart the DHCP server, but can make the changeswhile the server is running.   Omshell provides a way of accessingOMAPI..PPOMAPI is simply a communications mechanism that allows you tomanipulate objects.   In order to actually \fIuse\fR omshell, you.I mustunderstand what objects are available and how to use them.Documentation for OMAPI objects can be found in the documentation forthe server that provides them - for example, in the \fBdhcpd(1)\fRmanual page and the \fBdhclient(1)\fR manual page..SH CONTRIBUTIONS.PPThis software is free software.  At various times its development hasbeen underwritten by various organizations, including the ISC andVixie Enterprises.  The development of 3.0 has been funded almostentirely by Nominum, Inc..PPAt this point development is being shepherded by Ted Lemon, and hostedby the ISC, but the future of this project depends on you.  If youhave features you want, please consider implementing them..SH LOCAL AND REMOTE OBJECTS.PPThroughout this document, there are references to local and remote objects.Local objects are ones created in omshell with the \fBnew\fR command.  Remoteobjects are ones on the server: leases, hosts, and groups that the DHCPserver knows about.  Local and remote objects are associated together toenable viewing and modification of object attributes.  Also, new remoteobjects can be created to match local objects..SH OPENING A CONNECTION.PPomshell is started from the command line.  Once omshell is started, there areseveral commands that can be issued:.PP.B server \fIaddress\fR.RS 0.5iwhere address is the IP address of the DHCP server to connect to.  If this isnot specified, the default server is 127.0.0.1 (localhost)..RE.PP.B port \fInumber\fR.RS 0.5iwhere number is the port that OMAPI listens on.  By default, this is 7911..RE.PP.B key \fIname secret\fR.RS 0.5iThis specifies the TSIG key to use to authenticate the OMAPI transactions.\fIname\fR is the name of a key defined in \fIdhcpd.conf\fR with the\fBomapi-key\fR statement.  The \fIsecret\fR is the secret generated from\fBdnssec-keygen\fR or another key generation program..RE.PP.B connect.RS 0.5iThis starts the OMAPI connection to the server as specified by the \fIserver\fRstatement..SH CREATING LOCAL OBJECTS.PPAny object defined in OMAPI can be created, queried, and/or modified.  Theobject types available to OMAPI are defined in \fBdhcpd(8)\fR and\fBdhclient\fR.  When using omshell, objects are first defined locally,manipulated as desired, and then associated with an object on the server.Only one object can be manipulated at a time.  To create a local object, use.PP.B new \fIobject-type\fR.RS 0.5i\fIobject-type\fR is one of group, host, or lease..RE.PPAt this point, you now have an object that you can set properties on.  Forexample, if a new lease object was created with \fInew lease\fR, any of alease's attributes can be set as follows:.PP.B set \fIattribute-name = value\fR.RS 0.5i\fBAttribute names are defined in \fBdhcpd(8)\fR and \fBdhclient(8)\fR.Values should be quoted if they are strings.  So, to set a lease's IP address,you would do the following:\fB set ip-address = 192.168.4.50\fR.SH ASSOCIATING LOCAL AND REMOTE OBJECTS.PPAt this point, you can query the server for information about this lease, by.PP.B open.PPNow, the local lease object you created and set the IP address for is associatedwith the corresponding lease object on the DHCP server.  All of the leaseattributes from the DHCP server are now also the attributes on the localobject, and will be shown in omshell..SH VIEWING A REMOTE OBJECT.PPTo query a lease of address 192.168.4.50, and find out its attributes, afterconnecting to the server, take the following steps:.PP.B new "lease".PPThis creates a new local lease object..PP.B set ip-address = 192.168.4.50.PPThis sets the \fIlocal\fR object's IP address to be 192.168.4.50.PP.B open.PPNow, if a lease with that IP address exists, you will see all the informationthe DHCP server has about that particular lease.  Any data that isn't readilyprintable text will show up in colon-separated hexadecimal values.  In thisexample, output back from the server for the entire transaction might looklike this:.nf.sp 1> new "lease"obj: lease> set ip-address = 192.168.4.50obj: leaseip-address = c0:a8:04:32> openobj: leaseip-address = c0:a8:04:32state = 00:00:00:02dhcp-client-identifier = 01:00:10:a4:b2:36:2cclient-hostname = "wendelina"subnet = 00:00:00:06pool = 00:00:00:07hardware-address = 00:10:a4:b2:36:2chardware-type = 00:00:00:01ends = dc:d9:0d:3bstarts = 5c:9f:04:3btstp = 00:00:00:00tsfp = 00:00:00:00cltt = 00:00:00:00.fi.PPAs you can see here, the IP address is represented in hexadecimal, as are thestarting and ending times of the lease..SH MODIFYING A REMOTE OBJECT.PPAttributes of remote objects are updated by using the \fBset\fR command asbefore, and then issuing an \fBupdate\fR command.  The \fBset\fR command setsthe attributes on the current local object, and the \fBupdate\fR commandpushes those changes out to the server..PPContinuing with the previous example, if a \fBset client-hostname ="something-else"\fR was issued, followed by an \fBupdate\fR command, theoutput would look about like this:.nf.sp 1> set client-hostname = "something-else"obj: leaseip-address = c0:a8:04:32state = 00:00:00:02dhcp-client-identifier = 01:00:10:a4:b2:36:2cclient-hostname = "something-else"subnet = 00:00:00:06pool = 00:00:00:07hardware-address = 00:10:a4:b2:36:2chardware-type = 00:00:00:01ends = dc:d9:0d:3bstarts = 5c:9f:04:3btstp = 00:00:00:00tsfp = 00:00:00:00cltt = 00:00:00:00> updateobj: leaseip-address = c0:a8:04:32state = 00:00:00:02dhcp-client-identifier = 01:00:10:a4:b2:36:2cclient-hostname = "something-else"subnet = 00:00:00:06pool = 00:00:00:07hardware-address = 00:10:a4:b2:36:2chardware-type = 00:00:00:01ends = dc:d9:0d:3bstarts = 5c:9f:04:3btstp = 00:00:00:00tsfp = 00:00:00:00cltt = 00:00:00:00.fi.SH NEW REMOTE OBJECTS.PPNew remote objects are created much in the same way that existing serverobjects are modified.  Create a local object using \fBnew\fR, set theattributes as you'd wish them to be, and then create the remote object withthe same properties by using.PP.B create.PPNow a new object exists on the DHCP server which matches the properties thatyou gave your local object.  Objects created via OMAPI are saved into thedhcpd.leases file..PPFor example, if a new host with the IP address of 192.168.4.40 needs to becreated it would be done as follows:.nf.sp 1> new hostobj: host> set name = "some-host"obj: hostname = "some-host"> set hardware-address = 00:80:c7:84:b1:94obj: hostname = "some-host"hardware-address = 00:80:c7:84:b1:94> set hardware-type = 1obj: hostname = "some-host"hardware-address = 00:80:c7:84:b1:94hardware-type = 1> set ip-address = 192.168.4.40obj: hostname = "some-host"hardware-address = 00:80:c7:84:b1:94hardware-type = 1ip-address = c0:a8:04:28> createobj: hostname = "some-host"hardware-address = 00:80:c7:84:b1:94hardware-type = 00:00:00:01ip-address = c0:a8:04:28> .fi.PPYour dhcpd.leases file would then have an entry like this in it:.nf.sp 1host some-host {  dynamic;  hardware ethernet 00:80:c7:84:b1:94;  fixed-address 192.168.4.40;}.fi.PPThe \fIdynamic;\fR line is to denote that this host entry did not come fromdhcpd.conf, but was created dynamically via OMAPI.  .SH RESETTING ATTRIBUTES.PPIf you want to remove an attribute from an object, you can do this with the\fBunset\fR command.   Once you have unset an attribute, you must use the\fBupdate\fR command to update the remote object.  So, if the host "some-host"from the previous example will not have a static IP address anymore, thecommands in omshell would look like this:.nf.sp 1obj: hostname = "some-host"hardware-address = 00:80:c7:84:b1:94hardware-type = 00:00:00:01ip-address = c0:a8:04:28> unset ip-addressobj: hostname = "some-host"hardware-address = 00:80:c7:84:b1:94hardware-type = 00:00:00:01ip-address = <null>> .fi.SH REFRESHING OBJECTS.PPA local object may be refreshed with the current remote object propertiesusing the \fBrefresh\fR command.  This is useful for object that changeperiodically, like leases, to see if they have been updated.  This isn'tparticularly useful for hosts..SH DELETING OBJECTS.PPAny remote object that can be created can also be destroyed.  This is done bycreating a new local object, setting attributes, associating the local andremote object using \fBopen\fI, and then using the \fBremove\fR command. If the host "some-host" from before was created in error, this could becorrected as follows:.nf.sp 1obj: hostname = "some-host"hardware-address = 00:80:c7:84:b1:94hardware-type = 00:00:00:01ip-address = c0:a8:04:28> removeobj: <null>> .fi.SH HELP.PPThe \fBhelp\fR command will print out all of the commands available inomshell, with some syntax pointers..SH SEE ALSOdhcpctl(3), omapi(3), dhcpd(8), dhclient(8), dhcpd.conf(5), dhclient.conf(5)..SH AUTHOR.B omshellwas written by Ted Lemon of Nominum, Inc.  Information about Nominumand support contracts for DHCP and BIND can be found at.B http://www.nominum.com.   This preliminary documentation waswritten by Wendy Verschoor of Nominum, Inc., while she was testingomshell.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -