Here at F5's LineRate division we often write about our Node.js scripting engine and its use cases by way of script examples. But today I am going to describe to you a less talked about feature in our product.  In the world of applications it is not uncommon to have multiple domains mapped to the same IP address. 

LineRate provides the ability to attach the same virtual IP to more than one virtual server.  This can be useful where an organisation has several applications for its customers, or the case were organisations have merged and IT systems are being rationalized. 

In such cases (as shown in the figure below) applications and their domains can have dedicated virtual servers on a LineRate load balancer.  When a client makes an HTTP request, the LineRate load balancer inspects the 'Host' field in the HTTP header and directs it to the appropriate virtual server.  This is accomplished with the hostname configuration on the virtual server.

hostname-example

Step-by-step guide

  1. Configure a virtual IP (eg. vipweb1 in the below configuration example) for the services or applications
  2. Configure a virtual server (eg. example-com) that is dedicated for a service or application using the hostname configuration - hostname www.example.com
  3. Configure another virtual server (eg. example-net) that is dedicated for another service or application using the hostname configuration - hostname www.example.net
  4. Attach the same virtual IP (vipweb1) common to these services that their virtual servers will listen on
  5. Configure a virtual server that is the default (eg. default-server) for a same virtual IP - ' attach virtual-ip default' - this will be the 'catch-all virtual server' for all HTTP requests that don't have a dedicated virtual server

hostname configuration example

!
virtual-ip vipweb1
 ip address 192.0.2.1 80
 base vipbase_vip1
 admin-status online
!
virtual-server example-com
 lb-algorithm round-robin
 service http
  hostname www.example.com
 attach virtual-ip vipweb1
 attach real-server rsweb1
 attach real-server rsweb2
!
virtual-server example-net
 lb-algorithm round-robin
 service http
  hostname www.example.net
 attach virtual-ip vipweb1
 attach real-server rsweb3
!
virtual-server default-server
 lb-algorithm round-robin
 service http
 attach virtual-ip vipweb1 default
 attach real-server rsweb4
 attach real-server rsweb5
!

 

If you happen to experience a '404 not found' response to an HTTP request for a host that does not have a default virtual server i.e. a virtual server without an explicit hostname attached, please check that you have followed step 5 correctly. The 404 response in this case indicates that the host lookup resulted in no default virtual server to service the request.

 

If you haven't tried out LineRate, have a go, it's free.  If you have further questions on this or any of the related articles on LineRate at DevCentral, reach out to us. We are here to help.

Related articles

LineRate on DevCentral