vmware使用nat模式启动,在vmware的虚拟网络编辑器的nat的vmnet8网络设置网关地址,在控制面板网络适配器页面设置vmnet8的ip地址,虚拟机启动后,用ifconfig确认Ubuntu的ip地址为nat所在网段
改了之后的IP
ubuntu:192.168.23.128
vmnet8网关:192.168.23.1
vmnet8 ip:192.168.23.5
主机ip:192.168.1.10
然后192.168.1.10和192.168.23.128可以互ping
参考下面这篇文章
https://blog.csdn.net/shipfsh_sh/article/details/90053280
由于网络问题,把apt源替换调,即把下面这个文件
/etc/apt/sources.list
改为
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
我的版本是ubuntu 12,其他版本在清华镜像找到相应版本替换
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
更新apt源
sudo apt-get upgrade
sudo apt-get update
接下来安装samba
sudo apt-get install samba samba-common
使用 sudo gedit /etc/samba/smb.conf 打开配置文件
将文件中的内容做如下相应修改,这是我的
#security=user 后面添加:
security=share
在文件结尾添加如下行:
[share]
comment=this is Linux share directory
path=/home/qxqb/work
public=yes
writable=yes
启动samba
sudo /etc/init.d/smbd start
不行的话再启动一次
iptables -F
service smbd restart
再不行的话如果是提示“此共享需要过时的SMB1协议…",可以参考下面文章解决
https://www.hantao.org/share/gzjd/767.html
想要添加账号密码的话
smbpasswd -a 你的账号
windows密码设置
https://blog.csdn.net/wuyusheng314/article/details/78987351/