Author Archives: Kristian

Eksempel på isc-dhcp kode som netbooter mac

For å kunne installere mac maskiner på en bra måte trenger vi å kunne tilby image fra dhcp.

Dette er fryktelig dårlig dokumentert på nettet, men under kan du se en konfigurasjon som er godt dokumentert. Denne danner grunnlaget for oppsettet vårt på alfaalfa, og skal etterhvert være identisk med de delene av dhcp konfigurasjonen som er relevant for Apple Mac. Innholdet er hentet fra: http://brandon.penglase.net/index.php?title=Getting_*nix_to_Netboot_Macs , og tilpasset UIB

Referanser til lesestoff:

DHCP referanse – http://www.isc.org/software/dhcp ISC DHCP

BOOTP referanse – http://opensource.apple.com/source/bootp/bootp-198.1/Documentation/BSDP.doc

Vi tilbyr pr.idag to images DSR-PROD og DSR-TEST:

– Når du holder nede ALT-tasten på macen får du opp de to imagene vi har spesifisert.

– Når du holder nede CMD-tasten på macen booter du direkte til default image (DSR-PROD)

Imagene våre har følgende ID’er og navn:

  • ID: 137, navn: DSR-PROD (Default image) , lengde: 08, hex: 44:53:52:2d:50:52:4f:44
  • ID: 138, navn: DSR-TEST , lengde: 08, hex: 44:53:52:2d:54:45:53:54
class "Apple-Intel-Netboot" {
	# Limit this class to only Intel Apple machines
	match if substring (option vendor-class-identifier, 0, 14) = "AAPLBSDPC/i386";
	option dhcp-parameter-request-list 1,3,17,43,60; # Send these options to the client
                   if (option dhcp-message-type = 8) {# on DHCPInform Messages, Us/Our (Server), Them (Client)
	    option vendor-class-identifier "AAPLBSDPC"; # Let Them know we're responding with Apple BSDP Information
		if (substring(option vendor-encapsulated-options, 0, 3) = 01:01:01) {
		    log(info, "BSDP_LIST");# BSDP List
		    # Let Them know this is the let, what server, the server's priority, what Our default image is, and provide the image list
		    option vendor-encapsulated-options
				01:01:01:			                   # Start BSDP Inform/List Option 1 (01:), Length 1 (01:), Message Type List(1) (01:)
				03:04:				# BSDP option code 3 (length 04) -- Server Identifier
				00:00:00:00:		                   # Server IP (xxx.xxx.x.xx), Dec->Hex, was 0A:00:03:02 (10.0.3.2)
				04:02:				# BSDP option code 4 (length 02) -- Server Priority
				80:00:			                   # Priority (32768) Dec->Hex
				07:04:				# BSDP option code 7 (length 04) -- Default Image ID
				81:00:00:89:		                   # Image ID - (137) Dec->Hex
								# This is what is picked as Default when you only hold down N on the client
								#
								# 81 breaks into: 0 or 8 for Non-Install (NetBoot) set or Install (NetInstal) set,
								# Most, including DeployStudio default to NetInstall set.
								# Then 0 for Mac OS 9, 1 for Mac OS X (Client)
								# 2 for OS X Server, and 3 for Hardware Diagnostics
								# 4- through 127 (x4:00-xf:ff) reversed for future use
								# And the last two are for the Image ID (Dec->Hex)
								# IDs 1-4095 (00:01-0F:FF) are for Server-Specific Images (You will probably want an ID in this range)
								# IDs 4096-65535 (10:00-FF:FF) Are "Globally-Unique", Multiple servers can present this same ID
								# and the client will only see one image, and pick a random(?) server to talk to.
								#
				09:				# BSDP option code 9 -- Boot image list
				1A:			                   # Length = 5*<numofimages>+<sumofallimagenames>, eg =5*2+(8+8), =10+16 = 26, Dec->Hex =1A
								# This only appears once in the pacakge, no matter how many images you have below
				81:00:00:89:	                                     # Image ID --137, uib prod image -- dec->hex, see above (Default Image ID) for how to forumlate the full ID
				08:44:53:52:2d:50:52:4f:44:                        # Name of the image "DSR-PROD" # Length(08 dec):Name 'DS-PROD' ascii->hex
				81:00:00:8A:	                                     # Image ID -- 138 , uib test image
				08:44:53:52:2d:54:45:53:54;                       # Length(08 dec):Name  of the image "DSR-TEST"

		} elsif (substring(option vendor-encapsulated-options, 0, 3) = 01:01:02) {
			log(info, "BSDP_SELECT");
			# BSDP Select, This is the client selecting which image they want to boot from
			# Here we basically do if statements to catch what image is referenced
			# Since we MIGHT be clustered, Check to see if we're the server being asked, this is BSDP Option 3 (Length 04)
			if (substring(option vendor-encapsulated-options, 9, 4) = 00:00:00:00) { # Match to IP: xx.xx.x.xx same as above.
				log(info, "BSDP_SELECT-Responding, Client is talking to us"); # Log we're being talked to
				if (substring(option vendor-encapsulated-options, 15, 4) = 81:00:00:89) { # Catch Image ID 81:00:00:89
					log(info, "BSDP_SELECT-Image: id 137:DSR-PROD"); 
					# Insert stuff needed to boot here
					filename "i386/booter";
					next-server yyy.yy.yy.yy;
					option root-path = "nfs:yyy.yy.yy.yy:/netboot:ds-prod.sparseimage";
				} elsif (substring(option vendor-encapsulated-options, 15, 4) = 81:00:00:8A) { # Catch Image ID 81:00:00:8A
					log(info, "BSDP_SELECT-Image: id 138:DSR-TEST");
					# Insert stuff here needed for boot
					filename "i386/booter";
					next-server yyy.yyy.yy.yy;
					option root-path = "nfs:yyy.yy.yy.yy:/netboot:ds-test.sparseimage";
				} else {
					log(info,"BSDP_SELECT-ERROR: Client responded with an image we don't have a match for! -- (Image added to list, but not in select catch?)");
				} 	# End Image Selection Response
			} else {
				log(info,"BSDP_SELECT-Ignoring, Client is talking to another server--We're not worthy!"); # Log that we are not worthy of the client's time
			} 		# End Server Check
		} 			# End BSDP Options Check
	} 				# End DHCPInform Messages
} 					# End Class

Unix klientdrift blogg

Unix klientdrift blogg.

Her vil vi prøve å legge ut kodesnutter, tips og triks +++ som kan være av interesse for andre.

Det kan være anonymiserte versjoner av konfigurasjoner / oppsett vi bruker, eller kopier av dokumentasjon som ellers er begrenset (men ikke burde være det) til spesifikke nett.

Alt som legges ut på bloggen skal være tilgjengelig for alle og enhver!

Kode og annet som trives best i versjonskontroll publiserer vi selvfølgelig på GitHub: https://github.com/uib