Saturday, February 05, 2022

httpd.conf: 2 interfaces, 2 listen, IPv6, only one server works

OpenBSD 7.0 stable amf64

My host has two ethernet interfaces, em0 and em1.
Note: The host is a VM with two virtual interfaces.

Both interfaces are configured like this for IPv6 in the /etc/hostname.em0 and /etc/hostname.em1 files:
inet6 autoconf -temporary -soii

They are connected to the same LAN and each produces a unique IPv6 address using the same prefix and an EUI64 interface identifier as expected*.
$ ifconfig em0|grep inet6|grep -vE '(fe80:| fd|temporary|deprecated)'
inet6 2001:db8::20c:29ff:fd9c:4b7 prefixlen 64 autoconf pltime 1070 vltime 7043
$ ifconfig em1|grep inet6|grep -vE '(fe80:| fd|temporary|deprecated)'
inet6 2001:db8::20c:29ff:fd9c:4c1 prefixlen 64 autoconf pltime 1032 vltime 7005

DNS records have been set up*:
$ dig +short a.example.com aaaa
2001:db8::20c:29ff:fd9c:4b7
$ dig +short b.example.com aaaa
2001:db8::20c:29ff:fd9c:4c1
$

My httpd.conf looks like this*:

ipa = "2001:db8::20c:29ff:fd9c:4b7"
ipb = "2001:db8::20c:29ff:fd9c:4c1"

server "a.example.com" {
listen on $ipa port 80
directory index index.html
location "/*" {
root "/htdocs/a"
}
}

server "b.example.com" {
listen on $ipb port 80
directory index index.html
location "/*" {
root "/htdocs/b"
}
}


/var/www/htdocs/a/index.html and /var/www/htdocs/b/index.html exist and each contains a minimal HTML page.

httpd -n sees no problem.

rcctl start httpd works fine.

However trying to access http://a.example.com or http://[2001:db8::20c:29ff:fd9c:4b7] gets a timeout.

Accessing http://b.example.com or http://[2001:db8::20c:29ff:fd9c:4c1] works fine.


Trying to find the cause I checked:
$ netstat -an|grep LISTEN

tcp6 0 0 2001:db8::.80 *.* LISTEN
tcp6 0 0 2001:db8::.80 *.* LISTEN

$
Which seems weird because only the prefix is listed not the complete IPv6 addresses.


Am I seeing a bug or is my expectation that both servers (virtual hosts) work wrong?


*) Hostnames and IPs anonymized.

Thanks!
Mike

No comments:

Post a Comment