

convert the first octet from hexadecimal to binary: 52 -> 01010010.reformat to IPv6 notation 5274:f2ff:feb1:a87f.


If you run it with an IP address as an argument, such as ". I am about to convert 10.97.2.31 into hex: When you run this script, it will display this output: & echo "You asked for $1 which is `ip_to_hex $1`"Įcho "I am about to convert 10.97.2.31 into hex:"Įcho "$IP_ADDRESS = `ip_to_hex $IP_ADDRESS`" You can use this function to convert the data in any way you like: convert_ip_to_hex.sh This is useful, because printf, when called as " printf '%02X' 192 168 1 47" will take each of the four arguments, and print them as uppercase hexadecimal strings (as instructed by the '%02X' formatting instruction). The " $" means to transform the first (and only) argument, known as " $1" (eg, "192.168.1.47"), and convert periods to spaces. However, this little function will do it for you: It's possible to sit down with a Hex Calculator (there are many online, mobile apps, etc), and work out each one. So you need to provide files in the /var/lib/tftpboot/pxelinux.cfg/ directory, with names like C0A8012F. The conversion looks like this: Decimal IP Address However, it asks for these in hexidecimal format, which is a bit of a pain if you don't happen to be 100% fluent in all hex values between 0-255. Typically, they will be instructed to download pxelinux.0, which will be passed to the CPU, and result in the client requesting a further file, either the BIOS UUID, or if that fails, then the client MAC address, or if that fails, then the client IP address (which it retries with ever-reducing accuracy: 192.168.1.47, then 192.168.1, then 192.168, then 192). They get their IP address by DHCP, which also sends them extra information - specifically, the IP address of a boot server, and the name of a file to request from the boot server. PXE Boot is a great way to install clients over the network. 11th October 2016 Convert IP Address to Hexadecimal
