How to configure a jail to only use IPv4

I have a problem with a jail trying to update and install gems from rubygem.org. Apparently this is some problem with IPv6. The Gem utility is reported to prefe IPv6 if it is available. I would like to configure the jail to only use ipv4 and avoid this if this turns out to be the problem. The jail is configured only with an IPv4 address. The Host has IPv6 enabled. I have looked at ail(8) and rc.conf(5) but cannot find a switch or parameter that turns ipv6 off. How does one turn off ipv6 in a jail without impacting the host?
 
I would like to configure the jail to only use ipv4 and avoid this if this turns out to be the problem.
It's not.

How does one turn off ipv6 in a jail without impacting the host?
Don't configure it.

I suspect your analysis is wrong and there's something else not configured correctly. What are the exact error messages you're getting?

Case in point:
Code:
root@molly:~ # jls
   JID  IP Address      Hostname                      Path
     1  192.168.10.202  j-ports.dicelan.home          /jails/j-ports
The host uses both IPv6 and IPv4, this jail only uses IPv4.
 
Well, the fix was to add all of the ipv4 addresses for rubygem.org into the jail's /etc/hosts file.
 
That might indicate that you have an issue with /etc/resolv.conf in the jail. Did you copy it from the host? The host might be configured to use IPv6 DNS addresses, which won't work inside an IPv4 only jail.
 
There was no problem with resolv.conf. The issue is some incompatibility with ipv6 at RubyGem.org. The issue has been widely reported. I just was not current.
 
Good question. I do not have an answer. Not everybody using ipv6 encounters it. Some people have solved this issue for themselves by disabling ipv6 on affected Linux systems. But one of the recommended workarounds is do do as I have done and place all the rubygem.org ipv4 addresses in /etc/hosts. Some folks have speculated that the problem is with the Ruby Gem utility itself.
 
Back
Top