It is very helpful when working with electronic devices to read their data sheet. The electronics equivalent of RTFM, "Read the fine manual" is RTFDS. It will explain the features and electrical characteristics of the device as well as often giving example circuits and even example code. Simply typing the part number of the device into a search engine is usually enough to find a PDF data sheet. Link here for DS2431.
According to the memory map from the data sheet, you can put each of the 4 memory pages into write protect mode by writing the hex value "55h" to their corresponding protection control byte.
In your case you will need to write the hex value "55h" to addresses "0080h" and "0081h" to write protect the first two pages.
If you have set up your Pi like the example that you linked, you can do the following (there is probably a more elegant way to do this but this should work) to write the values:
printf '\x55' | sudo dd of=/sys/bus/w1/devices/2d-000022b489f8/eeprom bs=1 seek=128 conv=notrunc
This will use the hex value "55h" as input for the dd command (
printf '\x55' | sudo dd), which will then skip to the 128th (128 = 80h) byte (
seek=128) of the eeprom device (
of=/sys/bus/w1/devices/2d-000022b489f8/eeprom) and write one byte of the input data (
bs=1), without affecting the rest of the data (
You can repeat the same thing but change to
seek=129 to write protect the second memory page (129 = 81h).
Unfortunately the module
w1_ds2431 which mounts the EEPROM as a filesystem does not allow access to the protection registers.