- 论坛徽章:
- 0
|
在虚拟机中搭建nfs server。
环境:
host : RHEL 7
guest: Fedora 19
都已经安装nfs-utils 和 rpcbind
host ip: 192.168.2.104
guest ip: 192.168.2.134
步骤:
1.编辑/etc/exports,内容如下:
/home/lqf/Maxwit/share/book *(ro)
2.依次启动guest的rpcbind,nfs-server,运行状态如下:
rpcbind.service - RPC bind service
Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; enabled)
Active: active (running) since Sat 2014-05-03 22:26:57 EDT; 21min ago
Process: 2616 ExecStart=/sbin/rpcbind -w ${RPCBIND_ARGS} (code=exited, status=0/SUCCESS)
Main PID: 2617 (rpcbind)
CGroup: name=systemd:/system/rpcbind.service
└─2617 /sbin/rpcbind -w
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled)
Active: active (exited) since Sat 2014-05-03 22:27:01 EDT; 22min ago
Process: 2643 ExecStartPost=/usr/lib/nfs-utils/scripts/nfs-server.postconfig (code=exited, status=0/SUCCESS)
Process: 2627 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS $RPCNFSDCOUNT (code=exited, status=0/SUCCESS)
Process: 2626 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 2624 ExecStartPre=/usr/lib/nfs-utils/scripts/nfs-server.preconfig (code=exited, status=0/SUCCESS)
3.guest使用showmount -e localhost 查看:
Export list for localhost:
/home/lqf/Maxwit/share/book *
4.host也开启rpcbind和nfs服务。
5.host使用showmount -e 192.168.2.134查看 报错:
clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)
尝试:
1.分别查看host guest的iptables的服务是否开启:
iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
Active: inactive (dead)
都显示的是没有开启。
2.还不放心,使用sudo iptablse -A IPUNT -p tcp --dport 111 -j ACCEPT 将host和guest的111和2049端口全部打开,然后使用sudo iptables -L -n 查看状态如下:
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:111
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:111
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:111
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2049
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:2049
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2049
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2049
再次运行showmount 命令还是报错:clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)。
为什么会No Route to host,guest和host明明可以ping的通,不知道该怎么思考了?
|
|