Add these options to your bitcoin.conf configuration file and save it (on Linux it is usually located in the ~/.bitcoin/ directory, and on macOS in ~/Library/Application\ Support/Bitcoin):
i2psam=127.0.0.1:7656 debug=i2p
Restart your node with Bitcoin Core version 22 and up.
For Bitcoiners who run nodes:
https://jonatack.github.io/articles/using-alternative-p2p-networks-with-bitcoin-core
You can start running your node over I2P, for example in addition to over Tor, in less than 5 minutes:
Linux:
$ apt install i2pd && systemctl enable i2pd.service && systemctl start i2pd.service
MacOS:
$ brew install i2pd && brew services start i2pd
i2psam=127.0.0.1:7656
debug=i2p