Combining KVM and NFS4 I manage to have test/development environment on my laptop.Using KVM virtual machines images it is easy to clone them for various purposes.For software repository I use combination of ‘createrepo’ and repositories exported via NFS.
Recently I moved KVM test environment to ipv6 address space (will blog about procedure how to instruct KVM to start to use ipv6) and first thing I noticed is that nfs shares are not accessible any more on my quests systems as they were exported via ipv4 from host systems
# cat /etc/exports
NFS4 supports ipv6, but we need to export nfs shares to ipv6 addresses.In my case,I decided to assign addresses from ipv6 address set 2000:aabb:ccdd:a::/64 and due to this added to /etc/exports below
with this I exported nfs shares to all hosts in ipv6 2000:aabb:ccdd:a::/64 network segment
ipv6 uses ip6tables,so it also necessary to edit /etc/sysconfig/ip6tables and open there access to port 2049/tcp ( nfs4 needs only this port to be open on server side )
We need ip6talbes rule as below
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
this is actually iptables syntax,but it only goes to ip6talbes file instead to iptables.
On RHEL/CentOS, you simply edit /etc/sysconfig/ip6tables and add there new rule
After this reload ip6tables rules,restart nfs,and re-export shares
# service ip6tables restart
- service nfs restart
- exportfs -av
On client side,mount command will be ( assuming nfs server has ipv6 address 2000:aabb:ccdd:a::1 )
# mount -t nfs4 '[2000:aabb:ccdd:a::1]':/ /home/nfs
Note that,in order to mount ipv6 nfs4 share,you will need to put ipv6 address between
''.Of course you can use hostnames instead of ipv6 addresses,but you will need to configure correct AAAA/PTR records in bind/dns configuration before dns names will work.