version=pmwiki-2.2.130 ordered=1 urlencoded=1 agent=w3m/0.5.3+git20210102 author=jrmu charset=UTF-8 csum= ctime=1597982362 host=38.87.162.8 name=Openbsd.Vhost rev=7 targets=Openbsd.Openbsd,Openbsd.Znc,Openbsd.Psybnc text=(:redirect dns.vhost:)%0a(:title Configuring unique vhosts:)%0a%0aIRC users often ask for custom vhosts.%0a%0a!! How IRC servers check vhosts%0a%0aWhen an IRC client first connects to an IRC server, the server will take your IP address and perform a [[openbsd|rDNS/reverse lookup]]. For example, suppose your IP address is @@192.168.0.1@@. To perform a reverse lookup, run:%0a%0a[@%0a$ dig -x 192.168.0.1%0a%0a;; ANSWER SECTION:%0a1.0.168.19.in-addr.arpa. 60 IN PTR example.ircnow.org.%0a@]%0a%0aThis means that the IP address 192.168.0.1 is pointed to by the domain example.ircnow.org. Now, the IRC client will perform forward DNS resolution, which you can perform yourself by running:%0a%0a[@%0a$ dig example.ircnow.org%0a%0a;; ANSWER SECTION:%0aexample.ircnow.org. 3600 IN A 192.168.0.1%0a@]%0a%0aNotice how the reverse and forward DNS lookups both match and confirm one another. When this happens, anyone IRC connection that connects from this IPv4 address will have the vhost example.ircnow.org. So, if you logged in with nickname @@john@@ and ident @@brown@@, you would have the following hostmask: @@john!brown@example.ircnow.org@@.%0a%0a!! IPv6 to the Rescue%0a%0aNotice however that a single IP address can only have one possible vhost. Even if you have multiple domains pointing to the same IP address, each IP address can only have a single rDNS entry associated with it. In other words, when you run @@$ dig -x 192.168.0.1@@, you only get one possible answer.%0a%0aIf we only had IPv4 addresses, each IPv4 address can only have one possible vhost. Since the world is running out of IPv4 addresses, it would cost a lot of money to assign unique vhosts using IPv4 addresses only.%0a%0aThis is why we rely upon IPv6 addresses to provide unique vhosts. Normally, the ISP will provide an entire /64 or /48 subnet of IPv6 addresses for each server instead of a single IPv4 address.%0a%0aNow you can assign vhosts to your heart's content. All you need is one AAAA record for each hostname and to configure the rDNS entry for the IPv6 address.%0a%0aFor example, suppose you configure cooldude.ircnow.org to point to 2001:db8::c001:d00d, and you configure the rDNS of 2001:db8::c001:d00d to point to cooldude.ircnow.org. Then, when you bind to the IPv6 address 2001:db8::c001:d00d to connect to an IRC network which supports IPv6 connections, the IPv6 server will give you the vhost @@cooldude.ircnow.org@@.%0a%0a!! Binding to an IP address%0a%0aWhen you use a bouncer (such as [[openbsd/znc|znc]] or [[openbsd/psybnc|psybnc]]), you tell the bouncer to set the bindhost of a user to a specific IPv6 address or hostname. That way, the bouncer will use that IP address to connect. If you want a custom vhost, set it to the hostname or IPv6 address that you want to give to the user. And remember -- both the forward and reverse DNS must be configured properly!%0a%0aWhen creating DNS records, I recommend creating both an A and AAAA record for each hostname. This will provide a fallback for networks that only support either IPv4 or IPv6. For example, cooldude.ircnow.org could have both an A record of 192.168.0.1 and an AAAA record of 2001:db8::c001:d00d. That way, when the bouncer binds to the hostname cooldude.ircnow.org, it can choose the IPv6 address if the IRC network supports IPv6, and it can choose IPv4 if the IRC network only supports IPv4.%0a time=1627871572 title=Configuring unique vhosts author:1627871572=jrmu diff:1627871572:1597983996:=1d0%0a%3c (:redirect dns.vhost:)%0a44c43%0a%3c When creating DNS records, I recommend creating both an A and AAAA record for each hostname. This will provide a fallback for networks that only support either IPv4 or IPv6. For example, cooldude.ircnow.org could have both an A record of 192.168.0.1 and an AAAA record of 2001:db8::c001:d00d. That way, when the bouncer binds to the hostname cooldude.ircnow.org, it can choose the IPv6 address if the IRC network supports IPv6, and it can choose IPv4 if the IRC network only supports IPv4.%0a---%0a> When creating DNS records, I recommend creating both an A and AAAA record for each hostname. This will provide a fallback for networks that only support either IPv4 or IPv6. For example, cooldude.ircnow.org could have both an A record of 192.168.0.1 and an AAAA record of 2001:db8::c001:d00d. That way, when the bouncer binds to the hostname cooldude.ircnow.org, it can choose the IPv6 address if the IRC network supports IPv6, and it can choose IPv4 if the IRC network only supports IPv4.%0a\ No newline at end of file%0a host:1627871572=38.87.162.8 author:1597983996=jrmu diff:1597983996:1597983811:=38,39d37%0a%3c %0a%3c !! Binding to an IP address%0a host:1597983996=38.81.163.143 author:1597983811=jrmu diff:1597983811:1597983680:=41c41,51%0a%3c When creating DNS records, I recommend creating both an A and AAAA record for each hostname. This will provide a fallback for networks that only support either IPv4 or IPv6. For example, cooldude.ircnow.org could have both an A record of 192.168.0.1 and an AAAA record of 2001:db8::c001:d00d. That way, when the bouncer binds to the hostname cooldude.ircnow.org, it can choose the IPv6 address if the IRC network supports IPv6, and it can choose IPv4 if the IRC network only supports IPv4.%0a\ No newline at end of file%0a---%0a> When configuring%0a> %0a> 11:53 %3c%25jrmu> so the way vhosts work gry is%0a> 11:53 %3c%25jrmu> i recommend actually you test this manually first%0a> 11:53 %3c%25jrmu> without psybnc, so you can see how it works%0a> 11:54 %3c%25jrmu> vhosts work with both IPv4 and IPv6%0a> 11:54 %3c%25jrmu> what you need is a unique A/AAAA record and a matching rDNS record%0a> 11:54 %3c%25jrmu> of course, you only have one ipv4 address%0a> 11:54 %3c%25jrmu> and you get a billion ipv6 addresses%0a> 11:54 %3c%25jrmu> so unless you want to pay $5 per vhost you give out%0a> 11:54 %3c%25jrmu> custom vhosts use ipv6 :)%0a host:1597983811=38.81.163.143 author:1597983680=jrmu diff:1597983680:1597982893:=36,41d35%0a%3c %0a%3c For example, suppose you configure cooldude.ircnow.org to point to 2001:db8::c001:d00d, and you configure the rDNS of 2001:db8::c001:d00d to point to cooldude.ircnow.org. Then, when you bind to the IPv6 address 2001:db8::c001:d00d to connect to an IRC network which supports IPv6 connections, the IPv6 server will give you the vhost @@cooldude.ircnow.org@@.%0a%3c %0a%3c When you use a bouncer (such as [[openbsd/znc|znc]] or [[openbsd/psybnc|psybnc]]), you tell the bouncer to set the bindhost of a user to a specific IPv6 address or hostname. That way, the bouncer will use that IP address to connect. If you want a custom vhost, set it to the hostname or IPv6 address that you want to give to the user. And remember -- both the forward and reverse DNS must be configured properly!%0a%3c %0a%3c When configuring%0a host:1597983680=38.81.163.143 author:1597982893=jrmu diff:1597982893:1597982685:=26,35d25%0a%3c %0a%3c !! IPv6 to the Rescue%0a%3c %0a%3c Notice however that a single IP address can only have one possible vhost. Even if you have multiple domains pointing to the same IP address, each IP address can only have a single rDNS entry associated with it. In other words, when you run @@$ dig -x 192.168.0.1@@, you only get one possible answer.%0a%3c %0a%3c If we only had IPv4 addresses, each IPv4 address can only have one possible vhost. Since the world is running out of IPv4 addresses, it would cost a lot of money to assign unique vhosts using IPv4 addresses only.%0a%3c %0a%3c This is why we rely upon IPv6 addresses to provide unique vhosts. Normally, the ISP will provide an entire /64 or /48 subnet of IPv6 addresses for each server instead of a single IPv4 address.%0a%3c %0a%3c Now you can assign vhosts to your heart's content. All you need is one AAAA record for each hostname and to configure the rDNS entry for the IPv6 address.%0a host:1597982893=38.81.163.143 author:1597982685=jrmu diff:1597982685:1597982362:=11,13d10%0a%3c %0a%3c ;; ANSWER SECTION:%0a%3c 1.0.168.19.in-addr.arpa. 60 IN PTR example.ircnow.org.%0a16,25d12%0a%3c This means that the IP address 192.168.0.1 is pointed to by the domain example.ircnow.org. Now, the IRC client will perform forward DNS resolution, which you can perform yourself by running:%0a%3c %0a%3c [@%0a%3c $ dig example.ircnow.org%0a%3c %0a%3c ;; ANSWER SECTION:%0a%3c example.ircnow.org. 3600 IN A 192.168.0.1%0a%3c @]%0a%3c %0a%3c Notice how the reverse and forward DNS lookups both match and confirm one another. When this happens, anyone IRC connection that connects from this IPv4 address will have the vhost example.ircnow.org. So, if you logged in with nickname @@john@@ and ident @@brown@@, you would have the following hostmask: @@john!brown@example.ircnow.org@@.%0a host:1597982685=38.81.163.143 author:1597982362=jrmu diff:1597982362:1597982362:=1,22d0%0a%3c (:title Configuring unique vhosts:)%0a%3c %0a%3c IRC users often ask for custom vhosts.%0a%3c %0a%3c !! How IRC servers check vhosts%0a%3c %0a%3c When an IRC client first connects to an IRC server, the server will take your IP address and perform a [[openbsd|rDNS/reverse lookup]]. For example, suppose your IP address is @@192.168.0.1@@. To perform a reverse lookup, run:%0a%3c %0a%3c [@%0a%3c $ dig -x 192.168.0.1%0a%3c @]%0a%3c %0a%3c %0a%3c 11:53 %3c%25jrmu> so the way vhosts work gry is%0a%3c 11:53 %3c%25jrmu> i recommend actually you test this manually first%0a%3c 11:53 %3c%25jrmu> without psybnc, so you can see how it works%0a%3c 11:54 %3c%25jrmu> vhosts work with both IPv4 and IPv6%0a%3c 11:54 %3c%25jrmu> what you need is a unique A/AAAA record and a matching rDNS record%0a%3c 11:54 %3c%25jrmu> of course, you only have one ipv4 address%0a%3c 11:54 %3c%25jrmu> and you get a billion ipv6 addresses%0a%3c 11:54 %3c%25jrmu> so unless you want to pay $5 per vhost you give out%0a%3c 11:54 %3c%25jrmu> custom vhosts use ipv6 :)%0a host:1597982362=38.81.163.143