環境:
Host OS : Win 7
vmware : 8.0.0 build-471780
Linux OS : CentOS-6.2-x86_64
如何達到掛載在vmware下的linux也可連到對外跟可以win 7連接到centos的home資料夾
vmware設定
1.新增一張網卡給samba用,所以會有兩張,第一張是給WIFI用可以連外,第二張是samba用
設定如上圖
第一張網卡設定: Bridged
第二張網卡設定: NET
2.設定vmware網路
其中VM1跟VM8把DHCP取消
Centos 6.2設定
1.設定IP
[root@localhost /]# ifconfig eth1 192.168.118.129 netmask 255.255.255.0 #記得118要跟vmware的VM8是相同網域後面的IP就隨便
2.有通,就把他設定到檔案裡
[root@localhost /]# vi etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE="eth1" #BOOTPROTO="dhcp" BOOTPROTO="none" HWADDR="00:0C:29:B4:9F:D9" #網卡號碼不要跟eth0一樣 IPV6INIT="yes" NM_CONTROLLED="yes" ONBOOT="yes" BROADCAST = "192.168.118.255" IPADDR="192.168.118.129" NETMASK="255.255.255.0" NETWORK="192.168.118.0"
[root@localhost /]# ifdown eth1 [root@localhost /]# ifup eth1
[root@localhost /]# ifdown eth1 Error: Device 'eth1' (/org/freedesktop/NetworkManager/Devices/1) disconnecting failed: This device is not active
4.由於原本的公版的Centos 6.2少了一些samba套件
[root@localhost /]# yum install samba
[root@localhost /]# vi etc/samba/smb.conf [global] #security = user security = share ............... ............... 最後面加入 [home] path = /home writable = yes browseable = yes guest ok = yes
[root@localhost /]# sudo /etc/init.d/smb restart
[root@localhost /]# vi /etc/sysconfig/iptables # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT #-A INPUT -j REJECT --reject-with icmp-host-prohibited #-A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT
[root@localhost /]# vi /etc/sysconfig/iptables # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT
[root@localhost /]# sudo etc/init.d/iptables restart
參考資料:
http://ithelp.ithome.com.tw/question/10081253
http://blog.miniasp.com/post/2010/09/13/Windows-Vita-7-can-not-access-NAS-or-SAMBA.aspx
http://blog.segaa.net/blog.php/1/post/6/1221
http://samlee.idv.tw/linux/samba/samba05/samba05.htm
http://teachers.wyes.tn.edu.tw/chris/os/linux/server/samba/samba.htm
http://www.jollen.org/blog/2006/04/embedded_linux_4.html
沒有留言:
張貼留言