trusted host patterns in web hosting
No, you only need to add the hostname patterns in settings.php for how the site is being accessed, which normally isn't by IP. settings.local.php shouldn't be involved, as that is typically just for local development (I never adjust trusted patterns for local dev, just staging and production).

Essentially, the portion of code that handles this looks at the HTTP Host header, which is the hostname portion of the URL you requested (unless your webserver does canonical Host normalization, which is different that the rewrite rule for canonical URL).  The IP address never comes into play, unless you browse directly to the a URL where the "hostname" portion is the IP.