达州做淘宝网站,河北省建设工程质监站网站,h5游戏中心,品牌设计公司的业务领域wsl-oraclelinux 固定ip 0. 引言1. Windows 创建启动脚本2. 配置 wsl Oracle Linux 0. 引言
工作需要#xff0c;安装了一个 wsl Oracle Linux 8.9#xff0c;也想给它一个固定的 ip。
1. Windows 创建启动脚本
删除 PSScheduledJob#xff0c;
notepad $PSHOME\powersh… wsl-oraclelinux 固定ip 0. 引言1. Windows 创建启动脚本2. 配置 wsl Oracle Linux 0. 引言
工作需要安装了一个 wsl Oracle Linux 8.9也想给它一个固定的 ip。
1. Windows 创建启动脚本
删除 PSScheduledJob
notepad $PSHOME\powershell.config.json--- Remove
PSScheduledJob in WindowsPowerShellCompatibilityModuleDenyList
---创建 fix_wsl_ip.ps1 脚本文件
netsh interface ip add address vEthernet (WSLCore) 192.168.99.1 255.255.255.0创建 trigger
$trigger New-ScheduledTaskTrigger -AtStartup -RandomDelay 00:00:15
Register-ScheduledTask -TaskName FixWSLIP -Trigger $trigger -Action (New-ScheduledTaskAction -Execute powershell.exe -Argument -File C:\Users\thinkpad\fix_wsl_ip.ps1)2. 配置 wsl Oracle Linux
安装 hostname
dnf install hostname -y创建了 /etc/wsl.conf
vi /etc/wsl.conf--- add
[boot]
systemd true
[network]
generateHosts false
generateResolvConf false
---修改 /etc/resolve.conf
vi /etc/resolv.conf--- modify
# nameserver 172.25.192.1
nameserver 192.168.31.2
---修改 /etc/hosts
192.168.99.2 thinkpad-pc
127.0.1.1 thinkpad-pc.修改 /etc/rc.local
vi /etc/rc.local--- add
sudo ip addr add 192.168.99.2/24 broadcast 192.168.99.255 dev eth0 label eth0:1
---sudo chmod x /etc/rc.localrefer: https://superuser.com/questions/1191249/unable-to-resolve-host-name-in-wsl
refer: https://superuser.com/questions/1582234/make-ip-address-of-wsl2-static
完结