LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-12-2021, 10:09 AM   #1
lattimro
Member
 
Registered: Jul 2021
Distribution: SOLARIS/BSD-like, some Debian-like, some Arch-like, some GENTO-like, some RH-like, some slacky-like
Posts: 385

Rep: Reputation: Disabled
nginx fails to listen on specific IPv6 address


Ubuntu 20.04.3
nginx version: nginx/1.18.0 (Ubuntu)

Hello,

I just followed a simple procedure to set ngnix to listen to a specific IPv6 address https://geekflare.com/enable-ipv6-nginx-apache/ and we encountered an error. Below are some relevant info:

ip a |g inet6
Code:
inet6 ::1/128 scope host 
inet6 fe80::6e35:7039:2681:db1f/64 scope link noprefixroute 
inet6 fe80::42:d3ff:feaf:2ad/64 scope link
changed /etc/nginx/sites-available/default to listen to IPv6 address, note the '[]' were included:

Code:
listen [fe80::6e35:7039:2681:db1f]:80 default_server;
no other servers listen on p:80:

Code:
lsof -i :80 | grep LISTEN
and succesfully fails:

Code:
nginx[16359]: nginx: [emerg] bind() to [fe80::6e35:7039:2681:db1f]:80 failed (22: Invalid argument)
found out something weird at least at my level of understanding I do not know if it is related but I do not think that is what ping should normally reply:
Code:
ping -I wlp4s0 fe80::6e35:7039:2681:db1f
ping: Warning: source address might be selected on device other than: wlp4s0
PING fe80::6e35:7039:2681:db1f(fe80::6e35:7039:2681:db1f) from :: wlp4s0: 56 data bytes
However
Code:
ping fe80::6e35:7039:2681:db1f%wlp4s0
PING fe80::6e35:7039:2681:db1f%wlp4s0(fe80::6e35:7039:2681:db1f%wlp4s0) 56 data bytes
64 bytes from fe80::6e35:7039:2681:db1f%wlp4s0: icmp_seq=1 ttl=64 time=0.060 ms
64 bytes from fe80::6e35:7039:2681:db1f%wlp4s0: icmp_seq=2 ttl=64 time=0.104 ms
works but I do not know how to add this workaround to /etc/nginx/sites-available/default


Thanks!

Last edited by lattimro; 12-12-2021 at 08:41 PM.
 
Old 12-13-2021, 11:23 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
I just followed a simple procedure to set ngnix to listen to a specific IPv6 address https://geekflare.com/enable-ipv6-nginx-apache/ and we encountered an error. Below are some relevant info:

ip a |g inet6
Code:

inet6 ::1/128 scope host
inet6 fe80::6e35:7039:2681:db1f/64 scope link noprefixroute
inet6 fe80::42:d3ff:feaf:2ad/64 scope link

changed /etc/nginx/sites-available/default to listen to IPv6 address, note the '[]' were included:

Code:

listen [fe80::6e35:7039:2681:db1f]:80 default_server;

no other servers listen on p:80:

Code:

lsof -i :80 | grep LISTEN

and succesfully fails:

Code:

nginx[16359]: nginx: [emerg] bind() to [fe80::6e35:7039:2681:db1f]:80 failed (22: Invalid argument)

AFAIK ipv6 addresses starting with fe80 are link-local addresses. I guess you cannot assign such an address to a webserver.
You may give a valid ipv6 address to your interface and test.
 
1 members found this post helpful.
Old 12-13-2021, 01:39 PM   #3
lattimro
Member
 
Registered: Jul 2021
Distribution: SOLARIS/BSD-like, some Debian-like, some Arch-like, some GENTO-like, some RH-like, some slacky-like
Posts: 385

Original Poster
Rep: Reputation: Disabled
I see, I did not know that, thanks!
then how come IPv4 can listen on local address?

Last edited by lattimro; 12-13-2021 at 10:06 PM.
 
Old 12-18-2021, 04:15 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by lattimro View Post
I see, I did not know that, thanks!
then how come IPv4 can listen on local address?
You very clearly did not even start reading the article linked.
tl;dr: link-local is not the same as local. IPv6 can listen on (most) local addresses.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] have access to ipv6.google.com but not other ipv6 address superweijiafeng Linux - Networking 6 12-08-2014 02:28 PM
Cannot connect to ipv6 website with ipv6 address superweijiafeng Linux - Networking 3 07-08-2014 03:55 PM
[SOLVED] Getting PostgreSQL to listen only on a specific IP address: Possible? rnturn Linux - Server 1 03-24-2013 12:29 PM
How to set IPv6 address on IPv6 router tlemons Linux - Networking 3 09-17-2007 01:25 PM
apache security for intranet: "listen 80" vs. "listen 127.0.0.1:80" pulper Linux - Software 3 09-27-2006 06:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration