# Logstash only listens on IPv6 port

**URL:** https://discuss.elastic.co/t/logstash-only-listens-on-ipv6-port/57507
**Category:** Logstash
**Created:** [August 8, 2016, 5:05pm UTC](https://discuss.elastic.co/t/logstash-only-listens-on-ipv6-port/57507 "2016-08-08T17:05:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Lonck](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@Lonck](https://discuss.elastic.co/u/Lonck)
#### Post date: [August 8, 2016, 5:05pm UTC](https://discuss.elastic.co/t/logstash-only-listens-on-ipv6-port/57507/1 "2016-08-08T17:05:43Z")

</div>

Hi for All,  
I installed the Elastic Stack in Debian 8.5 by repositories.The Logstash do not listen on udp port setting in the conf file (port =\> 9878) for IPv4, but IPv6 only.  
I found the solution to fix the problem (\_JAVA\_OPTIONS: -Djava.net.preferIPv4Stack=true). However I did not understand where this change should be carried out so that the port is listening to IPv4.  
Cold anyone tell me?  
Thanks.

---

<div class="post-metadata">

### Author: ![Lonck](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@Lonck](https://discuss.elastic.co/u/Lonck)
#### Post date: [August 9, 2016, 2:51am UTC](https://discuss.elastic.co/t/logstash-only-listens-on-ipv6-port/57507/2 "2016-08-09T02:51:14Z")

</div>

Hi!  
I found the answer to question.  
The \_JAVA\_OPTIONS=-Djava.net.preferIPv4Stack=true is a variable and must be inserted entered /etc/environment or into /etc/profile.d/new\_file.sh so it available to all users.  
However the solution do no fix the problem! Logstash continues listening on the setting port only to IPv6.  
When I verify the logstash.conf with the configtest -f command, the result is "Configuration OK" and the Java global variable is identified.

root@elk~:# invoke-rc.d logstash configtest -f logstash-to-netflow.conf  
Picked up \_JAVA\_OPTIONS: -Djava.net.preferIPv4Stack=true  
Configuration OK

But the 9878/UDP port does not listen to IPv4.

root@elk:~# lsof -nPi :9878  
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME  
java 1508 logstash 17u IPv6 89766 0t0 UDP \*:9878

Any idea or suggestion?

Thanks.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 4:44am UTC](https://discuss.elastic.co/t/logstash-only-listens-on-ipv6-port/57507/3 "2017-07-06T04:44:16Z")

</div>


