最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
CentOS 7 上NFS共享服务器iptables 规则写法
时间:2022-06-30 20:50:32 编辑:袖梨 来源:一聚教程网
为了写iptables规则,这个端口肯定是要固定的才还好用,于是在/usr/lib/systemd/scripts/nfs-utils_env.sh发现了个很有趣的事情

于是我就直接写sysctl文件了
echo -e '###NFS ADDnfs.nfs.nlm_tcpport = 32803nfs.nfs.nlm_udpport = 32769' >> /etc/sysctl.conf
sysctl -p

然后再次测试发现端口果然固定了,我了个去,这还是很好玩的
于是后面就可以直接做iptables规则了
iptables -N NFS
iptables -R INPUT 8 -p udp -m state --state NEW -m multiport --dports $(rpcinfo -p|awk 'NR>1&&$3~/udp/&&!a[$4]++{c=c?c","$4:$4}END{print c}') -j NFS
iptables -R INPUT 7 -p tcp -m state --state NEW -m multiport --dports $(rpcinfo -p|awk 'NR>1&&$3~/tcp/&&!a[$4]++{c=c?c","$4:$4}END{print c}') -j NFS
iptables -I NFS -s 10.0.0.0/8 -p tcp -j ACCEPT
iptables -A NFS -s 10.0.0.0/8 -p udp -j ACCEPT

相关文章
- 驱动精灵检测不到显卡驱动解决方法 03-24
- picacg哔咔真的无法注销吗 03-24
- 骁龙8gen2提升大吗 03-24
- 豆包官网网页版-豆包电脑版在线登录 03-24
- 推特网页版极速打开-推特网页版一键登陆 03-24
- 畅玩空间怎么玩游戏 03-24