2 Replies Latest reply on Dec 20, 2016 5:01 AM by ctomc

    How to bind multiple, but not all, network interfaces to same Instance

    giacomo.genovese

      Hi All,

       

      Some time ago I asked how to set different network interfaces in the same instance ( how to set different network interfaces for each application running in the same CapeDwarf).

      Actually, the scenario is changed a little bit.

      I don't need to bind each applications to different network interfaces anymore.

      I have several Network Interfaces in my VM and I would bind all the "CapeDwarf" apps to two of these Network Interfaces only.

      I used standalone-capedwarf-modules.xml as configuration file to instantiate one Instance of CapeDwarf running several applications.

      I cannot set the CapeDwarf "public" interface to all the net interfaces using "0.0.0.0" because I need the remaining interfaces of my VM.

      I tried to adopt the solution suggested by Tomaz in the previous post (see below).

      IT *is* possible but needs some extra configuration in standalone-??.xml file you are using to run the server.

      first add new interface configuration (see bottom of the file) and than add new socket-binding that uses that interface.

      you need to add new <server> to undertow subsystem and there configure your virtual host but most importantly you need to add new http/https/ajp-listener

      that uses socket binding that you added above.

       

      after all this you will need to tell server that your application needs to be bound to this server, to do so you need to add

      <server-instance>name-of-server-you-added-in-standalone.xml</server-instance> to your WEB-INF/jboss-web.xml

      I tried to add a new interface and a new Server in the xml, as Tomaz suggested, following the example provided at Programming Notes and Examples: Wildfly Multiple IP and Multiple SSL Certificate . However, I can access to the app only by one Interface, the public one. The public_secondary replies with Error404 to my requests.

      Moreover, I read, and Tomaz wrote too, that If I setup different <server> in undertow subsystem and each <server> has its own virtual host, when I deploy a war I have to setup the jboss-web.xml correctly. Considering that I'm deplying a GAE app, How can I setup the "server-instance" of my app?

       

      If it can be useful,  I attach below an extract of my standalone-capedwarf-modules.xml :

       

       

      1.         <subsystem xmlns="urn:jboss:domain:undertow:1.2"> 
      2.             <buffer-cache name="default"/> 
      3.             <server name="default-server"> 
      4.                 <ajp-listener name="ajp" socket-binding="ajp"/> 
      5.                 <http-listener name="default" socket-binding="http"/> 
      6.                 <host name="default-host" alias="localhost"> 
      7.                     <location name="/" handler="welcome-content"/> 
      8.                     <filter-ref name="server-header"/> 
      9.                     <filter-ref name="x-powered-by-header"/> 
      10.                 </host> 
      11.             </server> 
      12.             <server name="server1"> 
      13.                 <ajp-listener name="ajp1" socket-binding="ajp1"/> 
      14.                 <http-listener name="default1" socket-binding="http1"/> 
      15.                 <host name="default-host_secondary" alias="localhost"> 
      16.                     <location name="/" handler="welcome-content"/> 
      17.                     <filter-ref name="server-header"/> 
      18.                     <filter-ref name="x-powered-by-header"/> 
      19.                 </host> 
      20.             </server> 
      21.             <server name="server2"> 
      22.                 <http-listener name="default2" socket-binding="http2"/> 
      23.                 <host name="default-host" alias="localhost"> 
      24.                     <location name="/" handler="welcome-content"/> 
      25.                     <filter-ref name="server-header"/> 
      26.                     <filter-ref name="x-powered-by-header"/> 
      27.                 </host> 
      28.             </server> 
      29.             <servlet-container name="default"> 
      30.                 <jsp-config/> 
      31.                 <websockets/> 
      32.             </servlet-container> 
      33.             <handlers> 
      34.                 <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/> 
      35.             </handlers> 
      36.             <filters> 
      37.                 <response-header name="server-header" header-name="Server" header-value="Wildfly/8"/> 
      38.                 <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="CapeDwarf/2"/> 
      39.             </filters> 
      40.         </subsystem> 
      41.         <subsystem xmlns="urn:jboss:domain:weld:2.0" require-bean-descriptor="true" non-portable-mode="true"/> 
      42.     </profile> 
      43.  
      44.  
      45.     <interfaces> 
      46.         <interface name="management"> 
      47.             <inet-address value="${jboss.bind.address.management:127.0.0.1}"/> 
      48.         </interface> 
      49.         <interface name="public"> 
      50.             <inet-address value="${jboss.bind.address:127.0.0.1}"/> 
      51.         </interface> 
      52.         <interface name="public_secondary"> 
      53.             <inet-address value="${jboss.bind.address:10.0.2.15}"/> 
      54.         </interface> 
      55.         <interface name="unsecure"> 
      56.             <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/> 
      57.         </interface> 
      58.     </interfaces> 
      59.  
      60.  
      61.     <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}"> 
      62.         <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/> 
      63.         <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/> 
      64.         <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/> 
      65.         <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/> 
      66.         <socket-binding name="http" port="${jboss.http.port:8080}"/> 
      67.         <socket-binding name="ajp1" interface="public_secondary" port="${jboss.ajp.port:8009}"/> 
      68.         <socket-binding name="http1" interface="public_secondary" port="${jboss.http1.port:8080}"/> 
      69.         <socket-binding name="http2" port="${jboss.http2.port:8280}"/> 
      70.         <socket-binding name="https" port="${jboss.https.port:8443}"/> 
      71.         <socket-binding name="jacorb" interface="unsecure" port="3528"/> 
      72.         <socket-binding name="jacorb-ssl" interface="unsecure" port="3529"/> 
      73.         <socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/> 
      74.         <socket-binding name="jgroups-tcp" port="7600"/> 
      75.         <socket-binding name="jgroups-tcp-fd" port="57600"/> 
      76.         <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/> 
      77.         <socket-binding name="jgroups-udp-fd" port="54200"/> 
      78.         <socket-binding name="messaging" port="5445"/> 
      79.         <socket-binding name="messaging-group" port="0" multicast-address="${jboss.messaging.group.address:231.7.7.7}" multicast-port="${jboss.messaging.group.port:9876}"/> 
      80.         <socket-binding name="messaging-throughput" port="5455"/> 
      81.         <socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/> 
      82.         <socket-binding name="remoting" port="${jboss.remoting.port:4447}"/> 
      83.         <socket-binding name="txn-recovery-environment" port="4712"/> 
      84.         <socket-binding name="txn-status-manager" port="4713"/> 
      85.         <outbound-socket-binding name="mail-smtp"> 
      86.             <remote-destination host="${jboss.mail.host:localhost}" port="${jboss.mail.port:25}"/> 
      87.         </outbound-socket-binding> 
      88.     </socket-binding-group> 

       

      Thanks a lot for helping me,

      Giacomo.