Bind WildFly to a different IP address, or all addresses on multihomed
Interface is a logical name, in WildFly parlance, for a network interface/IP address/host name to which sockets can be bound. There are two interfaces: “public” and “management”.
The “public” interface binding is used for all application related network communication (i.e. Web, Messaging, etc). The “management” interface is used for all components and services that are required by the management layer (i.e. the HTTP Management Endpoint).
By default, “public” interface is configured to listen on the loopback address of 127.0.0.1. So if you start WildFly as:
./bin/standalone.sh
Then WildFly default page can be accessed as http://127.0.0.1:8080. Usually, /etc/hosts
provide a mapping of 127.0.0.1 to localhost, and so the same page is accessible at http://localhost:8080. 8080 is the port where all applications are accessed.
On a multihomed machine, you may like to start WildFly and bind “public” interface to a specific IP address. This can be easily done as:
./bin/standalone.sh -b=192.168.1.1
Now the applications can be accessed at http://192.168.1.1:8080.
For compatibility, -b 192.168.1.1
is also supported but -b=192.168.1.1
is recommended.
Or, if you want to bind to all available IP addresses, then you can do:
./bin/standalone.sh -b=0.0.0.0
Similarly, by default, WildFly can be managed using Admin Console at http://127.0.0.1:9990. 9990 is the management port.
WildFly “management” interface can be bound to a specific IP address as:
./bin/standalone.sh -bmanagement=192.168.1.1
Now Admin Console can be accessed at http://192.168.1.1:9990.
Or, bind “management” interface to all available IP addresses as:
./bin/standalone.sh -bmanagement=0.0.0.0
You can also bind to two specific addresses as explained here.
Of course, you can bind WildFly “public” and “management” interface together as:
./bin/standalone.sh -b=0.0.0.0 -bmanagement=0.0.0.0
Learn more about it Interface and Port Configuration in WildFly. And more about these switches in Controlling the Bind Address with -b.
Reference: | Bind WildFly to a different IP address, or all addresses on multihomed from our JCG partner Arun Gupta at the Miles to go 2.0 … blog. |