Yes[1], no[2]. An IP address is "personal relationships" data and collecting, processing or using such data is prohibited unless allowed by law or the concerned person gives consent.
[1]: https://en.wikipedia.org/wiki/Bundesdatenschutzgesetz#Types_...
[2]: https://en.wikipedia.org/wiki/Bundesdatenschutzgesetz#Overvi...
The way I interpret this, if you don't collect, process or use the IP address beyond it being incidentally involved in the transmission of anonymized data, it shouldn't require explicit consent.
Otherwise literally everything that connects to the internet in some way would have to treated in that way, and that's not how the law is currently enforced.