惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
V
V2EX
The GitHub Blog
The GitHub Blog
T
Threatpost
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
A
Arctic Wolf
Google DeepMind News
Google DeepMind News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
P
Proofpoint News Feed
W
WeLiveSecurity
Cloudbric
Cloudbric
C
Check Point Blog
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
T
The Exploit Database - CXSecurity.com
U
Unit 42
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
PCI Perspectives
PCI Perspectives
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Spread Privacy
Spread Privacy
Hugging Face - Blog
Hugging Face - Blog
O
OpenAI News
N
News and Events Feed by Topic
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Privacy & Cybersecurity Law Blog
T
Threat Research - Cisco Blogs
博客园 - 聂微东
V
Visual Studio Blog
美团技术团队
Security Archives - TechRepublic
Security Archives - TechRepublic
G
GRAHAM CLULEY
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CERT Recently Published Vulnerability Notes
Know Your Adversary
Know Your Adversary
小众软件
小众软件
Engineering at Meta
Engineering at Meta
NISL@THU
NISL@THU
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
Martin Fowler
Martin Fowler
T
Troy Hunt's Blog

博客园 - zakun

适配 WSL 的 proxy 完整脚本 Gitlab CI 本地开发部署 Golang grpc 实践 Mongo 聚合演示 真・一键激活 JetBrains 全家桶! Kafka 分区细说 解决国内Homebrew安装 Homebrew How to Install PHP Install Elasticsearch with Docke php docker image nginx 反向代理常用设置说明 Golang常见的并发模式 Gin框架的几种热加载方法 协程 Mysql Full-Text Index 介绍 gitlab runner 使用摘要 Gitlab Docker 使用摘要 Docker 简介 linux-查看文件夹大小 Linux 如何删除乱码文件-inode删除 Nginx反爬虫: 禁止某些User Agent抓取网站 PHP添加$_SERVER服务器环境变量
wsl2 网络相关设置
zakun · 2024-10-16 · via 博客园 - zakun

ws2 相关设置

参考链接:jump here

从window主机查看linx子系统ip【win->wsl】

wsl -d <DistributionName> hostname -I

从linux子系统查看windown主机ip【wsl->win】

ip route show | grep -i default | awk '{ print $3}'

获取 WSL GUID

Get-NetFirewallHyperVVMCreator

输出包含具有唯一标识符 VMCreatorId 和 friendly name 属性的 VmCreator 对象类型。 例如,以下输出显示了 WSL 的属性

Get-NetFirewallHyperVVMCreator
VMCreatorId : {40E0AC32-46A5-438A-A0B2-2B479E8F2E90}
FriendlyName : WSL

备注

WSL VMCreatorId 为 {40E0AC32-46A5-438A-A0B2-2B479E8F2E90}。

验证 Hyper-V 防火墙设置

Hyper-V 防火墙具有通常应用于 VMCreatorId 的设置。 使用 Get-NetFirewallHyperVVMSetting cmdlet 检查设置。 例如,可以使用 命令获取应用于 WSL 的策略:

Get-NetFirewallHyperVVMSetting -PolicyStore ActiveStore -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}'

备注

-PolicyStore ActiveStore 返回 应用的 设置。

输出包含以下值:

描述
Enabled (True/False) 如果为 WSL VM 启用了 Hyper-V 防火墙,则为 True。
DefaultInboundAction, DefaultOutboundAction 这些是应用于进入或离开 WSL 容器的数据包的默认规则策略。 可以修改规则策略,如本文所述。
LoopbackEnabled 跟踪是否允许主机和容器之间的环回流量,而无需任何 Hyper-V 防火墙规则。 WSL 默认启用它,以允许 Windows 主机与 WSL 通信,WSL 与 Windows 主机通信。
AllowHostPolicyMerge 确定 Windows 主机防火墙企业设置 (GPO) 、Hyper-V 防火墙企业设置 (CSP) 、Windows 主机防火墙企业设置 (CSP) 、本地 Hyper-V 防火墙设置和本地主机防火墙设置的交互方式。Set-NetFirewallHyperVVMSetting cmdlet 详细介绍了此设置。

配置 Hyper-V 防火墙

Set-NetFirewallHyperVVMSetting -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -DefaultInboundAction Allow

或者

New-NetFirewallHyperVRule -Name "MyWebServer" -DisplayName "My Web Server" -Direction Inbound -VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -Protocol TCP -LocalPorts 80