NFS multiples NIC
I have install nfs server into Ubuntu Hirsute, using two NIC, like that:
/nfs 172.16.0.0/24(fsid=0,rw,insecure,sync,wdelay,no_subtree_check,no_root_squash)
/nfs 172.18.0.0/24(fsid=0,rw,insecure,sync,wdelay,no_subtree_check,no_root_squash)
/nfs/share1 172.16.0.0/24(rw,insecure,sync,wdelay,no_subtree_check,no_root_squash)
/nfs/share1 172.18.0.0/24(rw,insecure,sync,wdelay,no_subtree_check,no_root_squash)
In the client side, I have mounted the share like this:
mount -t nfs4 172.16.0.100:/nfs /mnt/ -o async,auto,exec,_netdev,nodev,rw,retry=5,rsize=32768,wsize=32768,proto=tcp,hard,intr
mount -t nfs4 172.18.0.100:/nfs /mnt/ -o async,auto,exec,_netdev,nodev,rw,retry=5,rsize=32768,wsize=32768,proto=tcp,hard,intr
As you can see I have mounted twice in the same directory. i.e, /nfs
When I put down the NIC which holds the 172.16.0.100 address, in the client side I still can ls into the /nfs directory. So I check that work with the second interface online and the first offline. Then I brought the first interface on line again. However, when I put down the NIC which holds the 172.18.0.100 address, in the client side the mounted nfs share hangs, and I no longer can access the /nfs directory.
What I doing wrong here??
Thanks for any tips.
Solution 1:
With mounting as in your example
mount -t nfs4 172.16.0.100:/nfs /mnt/ ...
mount -t nfs4 172.18.0.100:/nfs /mnt/ ...
you mount server 172.18.0.100
on top of 172.16.0.100
. NOTE: This is not using both NICs, this is mounting two different servers into a single directory. The last mount wins, e.g. visible. Thus by switching off 172.16.0.100
nothing happens, as it not used anyway.
As linux mount command (and NFS client) doesn't supports multiple servers, you should use NIC bonding if you want redundancy of aggregated bandwidth.