Software SysAdmin

Setting NIC IP addresses as environment variables

An easy and reliable method for applying your NIC IP addresses to your environment and scripts.


You are now able to use variables that represent the IP address of each of your system’s NICs. As you see with the Dependencies example in this article, you can quickly bind a service to an interface’s address, regardless of its IP address state as static or dynamic.

To expand upon real-world use cases of this example: when I want a containerized service to bind to VPN connections, I use ${TUN0_IPV4} in place of the ${DEFAULT_IPV4} parameter.

See also

External links

Did this article save you time or money? I'd love a coffee!

Did you find this useful?
Please share with those who you believe would find this useful too!

Leave a Reply

Your email address will not be published. Required fields are marked *