KB Article #177125

ERROR "Address family not supported by protocol" running API Gateway processes

Problem

When trying to run API Gateway, errors such as the following are observed:


ERROR 01/Jan/2015:00:00:00.000 [06de:000000000000000000000000] failed to listen on address ::1/18085: Address family not supported by protocol. can't create socket for address
ERROR 01/Jan/2015:10:00:00.000 [0000:000000000000000000000000] can't create socket: Address family not supported by protocol


Resolution


This error will usually indicate there is a problem with the loopback interface containing an invalid address. Often, the issue is that IPv6 is disabled, but the localhost entry contains an IPv6 address like ::1. So when the gateway tries to bind to localhost, it receives the IPv6 address, then fails to bind to it, producing an error.


Check that the /etc/hosts file contains only valid addresses for localhost, for example an IPv4-only host might look like this:


127.0.0.1 localhost


Also, make sure the loopback interface is running:


# ifconfig lo
 lo Link encap:Local Loopback
 inet addr:127.0.0.1 Mask:255.0.0.0
 UP LOOPBACK RUNNING MTU:16436 Metric:1
 RX packets:347819 errors:0 dropped:0 overruns:0 frame:0
 TX packets:347819 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
 RX bytes:82988240 (79.1 MiB) TX bytes:82988240 (79.1 MiB)