洮南网站建设,文化传媒公司能否建设经营网站,企业信息化建设网站,网站都有什么类型的WSL设置添加固定IP
在Win端添加一个固定IP 192.168.50.99 用于X-Server界面显示.在WSL端添加一个固定IP 192.168.50.16 用于和Win端通讯
在win端创建批处理文件
创建一个批处理文件 我的文件位置是D:\powershell\static_ip.bat 向vEthernet (WSL)网卡添加一个IP 192.168.50.…WSL设置添加固定IP
在Win端添加一个固定IP 192.168.50.99 用于X-Server界面显示.在WSL端添加一个固定IP 192.168.50.16 用于和Win端通讯
在win端创建批处理文件
创建一个批处理文件 我的文件位置是D:\powershell\static_ip.bat 向vEthernet (WSL)网卡添加一个IP 192.168.50.99 向wsl子系统网卡添加一个IP 192.168.50.16
echo off
%1 mshta vbscript:CreateObject(Shell.Application).ShellExecute(cmd.exe,/c %~s0 ::,,runas,1)(window.close)exit
netsh interface ip add address vEthernet (WSL) 192.168.50.99 255.255.255.0
wsl -d Ubuntu-18.04 -u root ip addr add 192.168.50.16/24 broadcast 192.168.50.255 dev eth0 label eth0:1
exitps:运行时使用管理员运行
值得注意的是在添加了网卡后有可能存在网络不通外网的情况
编辑/etc/resolv.conf有可能该文件不存在直接使用vim编辑就好了会自动新建的
这个是dns这里使用的是阿里云的dns当然其他dns也可以
nameserver 223.5.5.5
nameserver 223.6.6.6