[{"data":1,"prerenderedAt":2266},["ShallowReactive",2],{"/zh/blog/tag/hyper-v":3},[4,1523],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"date":11,"tags":12,"excerpt":16,"body":26,"_type":1517,"_id":1518,"_source":1519,"_file":1520,"_stem":1521,"_extension":1522},"/zh/blog/hyperv-install-arch","blog",false,"","Hyper-V安装Archlinux","linux内核已经升级到7并且使用了rust大幅提升, 所以在hyperv安装最新Archlinux虚拟机来体验.","2026-07-12 15:27",[13,14,15],"hyper-v","archlinux","linux",{"type":17,"children":18},"root",[19],{"type":20,"tag":21,"props":22,"children":23},"element","p",{},[24],{"type":25,"value":10},"text",{"type":17,"children":27,"toc":1498},[28,32,39,53,60,108,113,134,139,289,294,298,304,309,369,374,394,399,419,424,427,433,438,480,485,499,504,514,517,523,528,533,574,579,610,613,619,640,646,663,689,695,715,728,757,763,787,792,870,935,941,1017,1023,1040,1052,1058,1091,1096,1101,1120,1125,1128,1133,1141,1155,1163,1204,1207,1213,1218,1259,1322,1325,1330,1492],{"type":20,"tag":21,"props":29,"children":30},{},[31],{"type":25,"value":10},{"type":20,"tag":33,"props":34,"children":36},"h2",{"id":35},"安装-arch-linux",[37],{"type":25,"value":38},"安装 Arch Linux",{"type":20,"tag":21,"props":40,"children":41},{},[42,44,51],{"type":25,"value":43},"我选择的是 Arch Linux 官方滚动发布镜像 ",{"type":20,"tag":45,"props":46,"children":48},"code",{"className":47},[],[49],{"type":25,"value":50},"archlinux-x86_64.iso",{"type":25,"value":52},"，体积约 1.5GB，采用最小化安装，适合作为高性能开发服务器。",{"type":20,"tag":54,"props":55,"children":57},"h3",{"id":56},"hyper-v-虚拟机创建要点",[58],{"type":25,"value":59},"Hyper-V 虚拟机创建要点",{"type":20,"tag":61,"props":62,"children":63},"ul",{},[64,81,98],{"type":20,"tag":65,"props":66,"children":67},"li",{},[68,74,76],{"type":20,"tag":69,"props":70,"children":71},"strong",{},[72],{"type":25,"value":73},"代数",{"type":25,"value":75},"：选择",{"type":20,"tag":69,"props":77,"children":78},{},[79],{"type":25,"value":80},"第二代（Gen 2）",{"type":20,"tag":65,"props":82,"children":83},{},[84,89,91,96],{"type":20,"tag":69,"props":85,"children":86},{},[87],{"type":25,"value":88},"安全启动",{"type":25,"value":90},"：务必在虚拟机设置中",{"type":20,"tag":69,"props":92,"children":93},{},[94],{"type":25,"value":95},"取消勾选“启用安全启动”",{"type":25,"value":97},"，否则无法引导",{"type":20,"tag":65,"props":99,"children":100},{},[101,106],{"type":20,"tag":69,"props":102,"children":103},{},[104],{"type":25,"value":105},"网络",{"type":25,"value":107},"：先使用默认网络，后续再切换到内部网络",{"type":20,"tag":21,"props":109,"children":110},{},[111],{"type":25,"value":112},"启动虚拟机后，进入命令行 Live 环境。推荐使用官方安装脚本：",{"type":20,"tag":114,"props":115,"children":119},"pre",{"className":116,"code":117,"language":118,"meta":8,"style":8},"language-bash shiki shiki-themes solarized-light github-dark monokai","archinstall\n","bash",[120],{"type":20,"tag":45,"props":121,"children":122},{"__ignoreMap":8},[123],{"type":20,"tag":124,"props":125,"children":128},"span",{"class":126,"line":127},"line",1,[129],{"type":20,"tag":124,"props":130,"children":132},{"style":131},"--shiki-default:#268BD2;--shiki-dark:#B392F0;--shiki-sepia:#A6E22E",[133],{"type":25,"value":117},{"type":20,"tag":21,"props":135,"children":136},{},[137],{"type":25,"value":138},"关键选项选择：",{"type":20,"tag":140,"props":141,"children":142},"table",{},[143,162],{"type":20,"tag":144,"props":145,"children":146},"thead",{},[147],{"type":20,"tag":148,"props":149,"children":150},"tr",{},[151,157],{"type":20,"tag":152,"props":153,"children":154},"th",{},[155],{"type":25,"value":156},"选项",{"type":20,"tag":152,"props":158,"children":159},{},[160],{"type":25,"value":161},"推荐值",{"type":20,"tag":163,"props":164,"children":165},"tbody",{},[166,188,207,234,247,270],{"type":20,"tag":148,"props":167,"children":168},{},[169,175],{"type":20,"tag":170,"props":171,"children":172},"td",{},[173],{"type":25,"value":174},"镜像源",{"type":20,"tag":170,"props":176,"children":177},{},[178,180,186],{"type":25,"value":179},"中国用户选择 ",{"type":20,"tag":45,"props":181,"children":183},{"className":182},[],[184],{"type":25,"value":185},"China",{"type":25,"value":187}," 下的清华/中科大源加速下载",{"type":20,"tag":148,"props":189,"children":190},{},[191,196],{"type":20,"tag":170,"props":192,"children":193},{},[194],{"type":25,"value":195},"磁盘分区",{"type":20,"tag":170,"props":197,"children":198},{},[199,201],{"type":25,"value":200},"选择 ",{"type":20,"tag":45,"props":202,"children":204},{"className":203},[],[205],{"type":25,"value":206},"Best-effort default partition layout",{"type":20,"tag":148,"props":208,"children":209},{},[210,215],{"type":20,"tag":170,"props":211,"children":212},{},[213],{"type":25,"value":214},"文件系统",{"type":20,"tag":170,"props":216,"children":217},{},[218,224,226,232],{"type":20,"tag":45,"props":219,"children":221},{"className":220},[],[222],{"type":25,"value":223},"ext4",{"type":25,"value":225},"（稳定）或 ",{"type":20,"tag":45,"props":227,"children":229},{"className":228},[],[230],{"type":25,"value":231},"btrfs",{"type":25,"value":233},"（支持快照）, 虚拟机更推荐\"ext4\".",{"type":20,"tag":148,"props":235,"children":236},{},[237,242],{"type":20,"tag":170,"props":238,"children":239},{},[240],{"type":25,"value":241},"用户",{"type":20,"tag":170,"props":243,"children":244},{},[245],{"type":25,"value":246},"为root用户设置密码, 再添加一个用户并作为sudo用户",{"type":20,"tag":148,"props":248,"children":249},{},[250,255],{"type":20,"tag":170,"props":251,"children":252},{},[253],{"type":25,"value":254},"Profile",{"type":20,"tag":170,"props":256,"children":257},{},[258,259,268],{"type":25,"value":200},{"type":20,"tag":69,"props":260,"children":261},{},[262],{"type":20,"tag":45,"props":263,"children":265},{"className":264},[],[266],{"type":25,"value":267},"Minimal",{"type":25,"value":269},"（无界面，高性能）",{"type":20,"tag":148,"props":271,"children":272},{},[273,278],{"type":20,"tag":170,"props":274,"children":275},{},[276],{"type":25,"value":277},"网络配置",{"type":20,"tag":170,"props":279,"children":280},{},[281,283],{"type":25,"value":282},"保持默认 ",{"type":20,"tag":45,"props":284,"children":286},{"className":285},[],[287],{"type":25,"value":288},"NetworkManager",{"type":20,"tag":21,"props":290,"children":291},{},[292],{"type":25,"value":293},"安装完成后，移除 ISO 镜像，重启进入新系统。",{"type":20,"tag":295,"props":296,"children":297},"hr",{},[],{"type":20,"tag":33,"props":299,"children":301},{"id":300},"安装-ssh",[302],{"type":25,"value":303},"安装 SSH",{"type":20,"tag":21,"props":305,"children":306},{},[307],{"type":25,"value":308},"进入 Arch 后安装并启动 SSH：",{"type":20,"tag":114,"props":310,"children":312},{"className":116,"code":311,"language":118,"meta":8,"style":8},"sudo pacman -S openssh\nsudo systemctl enable sshd --now\n",[313],{"type":20,"tag":45,"props":314,"children":315},{"__ignoreMap":8},[316,341],{"type":20,"tag":124,"props":317,"children":318},{"class":126,"line":127},[319,324,330,336],{"type":20,"tag":124,"props":320,"children":321},{"style":131},[322],{"type":25,"value":323},"sudo",{"type":20,"tag":124,"props":325,"children":327},{"style":326},"--shiki-default:#2AA198;--shiki-dark:#9ECBFF;--shiki-sepia:#E6DB74",[328],{"type":25,"value":329}," pacman",{"type":20,"tag":124,"props":331,"children":333},{"style":332},"--shiki-default:#CB4B16;--shiki-dark:#79B8FF;--shiki-sepia:#AE81FF",[334],{"type":25,"value":335}," -S",{"type":20,"tag":124,"props":337,"children":338},{"style":326},[339],{"type":25,"value":340}," openssh\n",{"type":20,"tag":124,"props":342,"children":344},{"class":126,"line":343},2,[345,349,354,359,364],{"type":20,"tag":124,"props":346,"children":347},{"style":131},[348],{"type":25,"value":323},{"type":20,"tag":124,"props":350,"children":351},{"style":326},[352],{"type":25,"value":353}," systemctl",{"type":20,"tag":124,"props":355,"children":356},{"style":326},[357],{"type":25,"value":358}," enable",{"type":20,"tag":124,"props":360,"children":361},{"style":326},[362],{"type":25,"value":363}," sshd",{"type":20,"tag":124,"props":365,"children":366},{"style":332},[367],{"type":25,"value":368}," --now\n",{"type":20,"tag":21,"props":370,"children":371},{},[372],{"type":25,"value":373},"查看 IP：",{"type":20,"tag":114,"props":375,"children":377},{"className":116,"code":376,"language":118,"meta":8,"style":8},"ip a\n",[378],{"type":20,"tag":45,"props":379,"children":380},{"__ignoreMap":8},[381],{"type":20,"tag":124,"props":382,"children":383},{"class":126,"line":127},[384,389],{"type":20,"tag":124,"props":385,"children":386},{"style":131},[387],{"type":25,"value":388},"ip",{"type":20,"tag":124,"props":390,"children":391},{"style":326},[392],{"type":25,"value":393}," a\n",{"type":20,"tag":21,"props":395,"children":396},{},[397],{"type":25,"value":398},"然后在 Windows 终端连接：",{"type":20,"tag":114,"props":400,"children":402},{"className":116,"code":401,"language":118,"meta":8,"style":8},"ssh 用户名@IP地址\n",[403],{"type":20,"tag":45,"props":404,"children":405},{"__ignoreMap":8},[406],{"type":20,"tag":124,"props":407,"children":408},{"class":126,"line":127},[409,414],{"type":20,"tag":124,"props":410,"children":411},{"style":131},[412],{"type":25,"value":413},"ssh",{"type":20,"tag":124,"props":415,"children":416},{"style":326},[417],{"type":25,"value":418}," 用户名@IP地址\n",{"type":20,"tag":21,"props":420,"children":421},{},[422],{"type":25,"value":423},"此时可以正常连接，但如果使用 Hyper-V 默认网络，虚拟机重启后 IP 可能发生变化，因此建议配置固定 IP。",{"type":20,"tag":295,"props":425,"children":426},{},[],{"type":20,"tag":33,"props":428,"children":430},{"id":429},"创建-hyper-v-内部网络",[431],{"type":25,"value":432},"创建 Hyper-V 内部网络",{"type":20,"tag":21,"props":434,"children":435},{},[436],{"type":25,"value":437},"打开：",{"type":20,"tag":114,"props":439,"children":442},{"className":440,"code":441,"language":25,"meta":8,"style":8},"language-text shiki shiki-themes solarized-light github-dark monokai","Hyper-V 管理器\n→ 虚拟交换机管理器\n→ 新建虚拟交换机\n→ 内部网络（Internal）\n",[443],{"type":20,"tag":45,"props":444,"children":445},{"__ignoreMap":8},[446,454,462,471],{"type":20,"tag":124,"props":447,"children":448},{"class":126,"line":127},[449],{"type":20,"tag":124,"props":450,"children":451},{},[452],{"type":25,"value":453},"Hyper-V 管理器\n",{"type":20,"tag":124,"props":455,"children":456},{"class":126,"line":343},[457],{"type":20,"tag":124,"props":458,"children":459},{},[460],{"type":25,"value":461},"→ 虚拟交换机管理器\n",{"type":20,"tag":124,"props":463,"children":465},{"class":126,"line":464},3,[466],{"type":20,"tag":124,"props":467,"children":468},{},[469],{"type":25,"value":470},"→ 新建虚拟交换机\n",{"type":20,"tag":124,"props":472,"children":474},{"class":126,"line":473},4,[475],{"type":20,"tag":124,"props":476,"children":477},{},[478],{"type":25,"value":479},"→ 内部网络（Internal）\n",{"type":20,"tag":21,"props":481,"children":482},{},[483],{"type":25,"value":484},"例如命名为：",{"type":20,"tag":114,"props":486,"children":488},{"className":440,"code":487,"language":25,"meta":8,"style":8},"VM-Internal\n",[489],{"type":20,"tag":45,"props":490,"children":491},{"__ignoreMap":8},[492],{"type":20,"tag":124,"props":493,"children":494},{"class":126,"line":127},[495],{"type":20,"tag":124,"props":496,"children":497},{},[498],{"type":25,"value":487},{"type":20,"tag":21,"props":500,"children":501},{},[502],{"type":25,"value":503},"创建完成后，还需要进入虚拟机设置，将网卡切换到这个新的虚拟交换机。",{"type":20,"tag":21,"props":505,"children":506},{},[507,512],{"type":20,"tag":69,"props":508,"children":509},{},[510],{"type":25,"value":511},"注意",{"type":25,"value":513},"：切换网络后原来的 SSH 连接会立即失效，因此建议先完成 Windows 端网络配置，再切换虚拟机网络。",{"type":20,"tag":295,"props":515,"children":516},{},[],{"type":20,"tag":33,"props":518,"children":520},{"id":519},"配置-windows-nat",[521],{"type":25,"value":522},"配置 Windows NAT",{"type":20,"tag":21,"props":524,"children":525},{},[526],{"type":25,"value":527},"以管理员身份打开 PowerShell：",{"type":20,"tag":21,"props":529,"children":530},{},[531],{"type":25,"value":532},"为 Hyper-V 创建的虚拟网卡配置网关地址：",{"type":20,"tag":114,"props":534,"children":538},{"className":535,"code":536,"language":537,"meta":8,"style":8},"language-powershell shiki shiki-themes solarized-light github-dark monokai","New-NetIPAddress `\n  -IPAddress 192.168.100.1 `\n  -PrefixLength 24 `\n  -InterfaceAlias \"vEthernet (VM-Internal)\"\n","powershell",[539],{"type":20,"tag":45,"props":540,"children":541},{"__ignoreMap":8},[542,550,558,566],{"type":20,"tag":124,"props":543,"children":544},{"class":126,"line":127},[545],{"type":20,"tag":124,"props":546,"children":547},{},[548],{"type":25,"value":549},"New-NetIPAddress `\n",{"type":20,"tag":124,"props":551,"children":552},{"class":126,"line":343},[553],{"type":20,"tag":124,"props":554,"children":555},{},[556],{"type":25,"value":557},"  -IPAddress 192.168.100.1 `\n",{"type":20,"tag":124,"props":559,"children":560},{"class":126,"line":464},[561],{"type":20,"tag":124,"props":562,"children":563},{},[564],{"type":25,"value":565},"  -PrefixLength 24 `\n",{"type":20,"tag":124,"props":567,"children":568},{"class":126,"line":473},[569],{"type":20,"tag":124,"props":570,"children":571},{},[572],{"type":25,"value":573},"  -InterfaceAlias \"vEthernet (VM-Internal)\"\n",{"type":20,"tag":21,"props":575,"children":576},{},[577],{"type":25,"value":578},"创建 NAT：",{"type":20,"tag":114,"props":580,"children":582},{"className":535,"code":581,"language":537,"meta":8,"style":8},"New-NetNat `\n  -Name \"VM-NAT\" `\n  -InternalIPInterfaceAddressPrefix \"192.168.100.0/24\"\n",[583],{"type":20,"tag":45,"props":584,"children":585},{"__ignoreMap":8},[586,594,602],{"type":20,"tag":124,"props":587,"children":588},{"class":126,"line":127},[589],{"type":20,"tag":124,"props":590,"children":591},{},[592],{"type":25,"value":593},"New-NetNat `\n",{"type":20,"tag":124,"props":595,"children":596},{"class":126,"line":343},[597],{"type":20,"tag":124,"props":598,"children":599},{},[600],{"type":25,"value":601},"  -Name \"VM-NAT\" `\n",{"type":20,"tag":124,"props":603,"children":604},{"class":126,"line":464},[605],{"type":20,"tag":124,"props":606,"children":607},{},[608],{"type":25,"value":609},"  -InternalIPInterfaceAddressPrefix \"192.168.100.0/24\"\n",{"type":20,"tag":295,"props":611,"children":612},{},[],{"type":20,"tag":33,"props":614,"children":616},{"id":615},"配置-arch-linux-固定-ip",[617],{"type":25,"value":618},"配置 Arch Linux 固定 IP",{"type":20,"tag":21,"props":620,"children":621},{},[622,624,630,632,638],{"type":25,"value":623},"Arch Linux 使用 ",{"type":20,"tag":45,"props":625,"children":627},{"className":626},[],[628],{"type":25,"value":629},"systemd-networkd",{"type":25,"value":631}," 管理网络，配置文件位于 ",{"type":20,"tag":45,"props":633,"children":635},{"className":634},[],[636],{"type":25,"value":637},"/etc/systemd/network/",{"type":25,"value":639},"。",{"type":20,"tag":54,"props":641,"children":643},{"id":642},"_1-查看网卡名称",[644],{"type":25,"value":645},"1. 查看网卡名称",{"type":20,"tag":114,"props":647,"children":648},{"className":116,"code":376,"language":118,"meta":8,"style":8},[649],{"type":20,"tag":45,"props":650,"children":651},{"__ignoreMap":8},[652],{"type":20,"tag":124,"props":653,"children":654},{"class":126,"line":127},[655,659],{"type":20,"tag":124,"props":656,"children":657},{"style":131},[658],{"type":25,"value":388},{"type":20,"tag":124,"props":660,"children":661},{"style":326},[662],{"type":25,"value":393},{"type":20,"tag":21,"props":664,"children":665},{},[666,668,674,676,682,683],{"type":25,"value":667},"常见名称：",{"type":20,"tag":45,"props":669,"children":671},{"className":670},[],[672],{"type":25,"value":673},"eth0",{"type":25,"value":675},"、",{"type":20,"tag":45,"props":677,"children":679},{"className":678},[],[680],{"type":25,"value":681},"ens160",{"type":25,"value":675},{"type":20,"tag":45,"props":684,"children":686},{"className":685},[],[687],{"type":25,"value":688},"enp0s3",{"type":20,"tag":54,"props":690,"children":692},{"id":691},"_2-检查并清理已有配置",[693],{"type":25,"value":694},"2. 检查并清理已有配置",{"type":20,"tag":114,"props":696,"children":698},{"className":116,"code":697,"language":118,"meta":8,"style":8},"ls /etc/systemd/network/\n",[699],{"type":20,"tag":45,"props":700,"children":701},{"__ignoreMap":8},[702],{"type":20,"tag":124,"props":703,"children":704},{"class":126,"line":127},[705,710],{"type":20,"tag":124,"props":706,"children":707},{"style":131},[708],{"type":25,"value":709},"ls",{"type":20,"tag":124,"props":711,"children":712},{"style":326},[713],{"type":25,"value":714}," /etc/systemd/network/\n",{"type":20,"tag":21,"props":716,"children":717},{},[718,720,726],{"type":25,"value":719},"如果存在 DHCP 配置文件（如 ",{"type":20,"tag":45,"props":721,"children":723},{"className":722},[],[724],{"type":25,"value":725},"10-eth0.network",{"type":25,"value":727},"），先将其删除或备份，避免与静态配置冲突（systemd 按文件名顺序加载，优先匹配第一个）：",{"type":20,"tag":114,"props":729,"children":731},{"className":116,"code":730,"language":118,"meta":8,"style":8},"sudo mv /etc/systemd/network/10-eth0.network /etc/systemd/network/10-eth0.network.bak\n",[732],{"type":20,"tag":45,"props":733,"children":734},{"__ignoreMap":8},[735],{"type":20,"tag":124,"props":736,"children":737},{"class":126,"line":127},[738,742,747,752],{"type":20,"tag":124,"props":739,"children":740},{"style":131},[741],{"type":25,"value":323},{"type":20,"tag":124,"props":743,"children":744},{"style":326},[745],{"type":25,"value":746}," mv",{"type":20,"tag":124,"props":748,"children":749},{"style":326},[750],{"type":25,"value":751}," /etc/systemd/network/10-eth0.network",{"type":20,"tag":124,"props":753,"children":754},{"style":326},[755],{"type":25,"value":756}," /etc/systemd/network/10-eth0.network.bak\n",{"type":20,"tag":54,"props":758,"children":760},{"id":759},"_3-创建静态-ip-配置文件",[761],{"type":25,"value":762},"3. 创建静态 IP 配置文件",{"type":20,"tag":114,"props":764,"children":766},{"className":116,"code":765,"language":118,"meta":8,"style":8},"sudo vim /etc/systemd/network/20-wired.network\n",[767],{"type":20,"tag":45,"props":768,"children":769},{"__ignoreMap":8},[770],{"type":20,"tag":124,"props":771,"children":772},{"class":126,"line":127},[773,777,782],{"type":20,"tag":124,"props":774,"children":775},{"style":131},[776],{"type":25,"value":323},{"type":20,"tag":124,"props":778,"children":779},{"style":326},[780],{"type":25,"value":781}," vim",{"type":20,"tag":124,"props":783,"children":784},{"style":326},[785],{"type":25,"value":786}," /etc/systemd/network/20-wired.network\n",{"type":20,"tag":21,"props":788,"children":789},{},[790],{"type":25,"value":791},"写入以下内容（请根据实际情况修改 IP）：",{"type":20,"tag":114,"props":793,"children":797},{"className":794,"code":795,"language":796,"meta":8,"style":8},"language-ini shiki shiki-themes solarized-light github-dark monokai","[Match]\nName=eth0\n\n[Network]\nAddress=192.168.100.10/24\nGateway=192.168.100.1\nDNS=1.1.1.1\nDNS=8.8.8.8\n","ini",[798],{"type":20,"tag":45,"props":799,"children":800},{"__ignoreMap":8},[801,809,817,826,834,843,852,861],{"type":20,"tag":124,"props":802,"children":803},{"class":126,"line":127},[804],{"type":20,"tag":124,"props":805,"children":806},{},[807],{"type":25,"value":808},"[Match]\n",{"type":20,"tag":124,"props":810,"children":811},{"class":126,"line":343},[812],{"type":20,"tag":124,"props":813,"children":814},{},[815],{"type":25,"value":816},"Name=eth0\n",{"type":20,"tag":124,"props":818,"children":819},{"class":126,"line":464},[820],{"type":20,"tag":124,"props":821,"children":823},{"emptyLinePlaceholder":822},true,[824],{"type":25,"value":825},"\n",{"type":20,"tag":124,"props":827,"children":828},{"class":126,"line":473},[829],{"type":20,"tag":124,"props":830,"children":831},{},[832],{"type":25,"value":833},"[Network]\n",{"type":20,"tag":124,"props":835,"children":837},{"class":126,"line":836},5,[838],{"type":20,"tag":124,"props":839,"children":840},{},[841],{"type":25,"value":842},"Address=192.168.100.10/24\n",{"type":20,"tag":124,"props":844,"children":846},{"class":126,"line":845},6,[847],{"type":20,"tag":124,"props":848,"children":849},{},[850],{"type":25,"value":851},"Gateway=192.168.100.1\n",{"type":20,"tag":124,"props":853,"children":855},{"class":126,"line":854},7,[856],{"type":20,"tag":124,"props":857,"children":858},{},[859],{"type":25,"value":860},"DNS=1.1.1.1\n",{"type":20,"tag":124,"props":862,"children":864},{"class":126,"line":863},8,[865],{"type":20,"tag":124,"props":866,"children":867},{},[868],{"type":25,"value":869},"DNS=8.8.8.8\n",{"type":20,"tag":871,"props":872,"children":873},"blockquote",{},[874,884],{"type":20,"tag":21,"props":875,"children":876},{},[877,882],{"type":20,"tag":69,"props":878,"children":879},{},[880],{"type":25,"value":881},"重要",{"type":25,"value":883},"：",{"type":20,"tag":61,"props":885,"children":886},{},[887,898,917],{"type":20,"tag":65,"props":888,"children":889},{},[890,896],{"type":20,"tag":45,"props":891,"children":893},{"className":892},[],[894],{"type":25,"value":895},"Name",{"type":25,"value":897}," 必须与网卡名称完全一致",{"type":20,"tag":65,"props":899,"children":900},{},[901,903,909,911],{"type":25,"value":902},"子网掩码使用 ",{"type":20,"tag":45,"props":904,"children":906},{"className":905},[],[907],{"type":25,"value":908},"/24",{"type":25,"value":910}," 格式，不要写 ",{"type":20,"tag":45,"props":912,"children":914},{"className":913},[],[915],{"type":25,"value":916},"255.255.255.0",{"type":20,"tag":65,"props":918,"children":919},{},[920,933],{"type":20,"tag":69,"props":921,"children":922},{},[923,925,931],{"type":25,"value":924},"不要添加任何 ",{"type":20,"tag":45,"props":926,"children":928},{"className":927},[],[929],{"type":25,"value":930},"#",{"type":25,"value":932}," 注释或中文",{"type":25,"value":934},"，否则 systemd-networkd 可能会解析失败",{"type":20,"tag":54,"props":936,"children":938},{"id":937},"_4-启用并重启网络服务",[939],{"type":25,"value":940},"4. 启用并重启网络服务",{"type":20,"tag":114,"props":942,"children":944},{"className":116,"code":943,"language":118,"meta":8,"style":8},"sudo systemctl enable systemd-networkd --now\nsudo systemctl enable systemd-resolved --now\nsudo systemctl restart systemd-networkd\n",[945],{"type":20,"tag":45,"props":946,"children":947},{"__ignoreMap":8},[948,972,996],{"type":20,"tag":124,"props":949,"children":950},{"class":126,"line":127},[951,955,959,963,968],{"type":20,"tag":124,"props":952,"children":953},{"style":131},[954],{"type":25,"value":323},{"type":20,"tag":124,"props":956,"children":957},{"style":326},[958],{"type":25,"value":353},{"type":20,"tag":124,"props":960,"children":961},{"style":326},[962],{"type":25,"value":358},{"type":20,"tag":124,"props":964,"children":965},{"style":326},[966],{"type":25,"value":967}," systemd-networkd",{"type":20,"tag":124,"props":969,"children":970},{"style":332},[971],{"type":25,"value":368},{"type":20,"tag":124,"props":973,"children":974},{"class":126,"line":343},[975,979,983,987,992],{"type":20,"tag":124,"props":976,"children":977},{"style":131},[978],{"type":25,"value":323},{"type":20,"tag":124,"props":980,"children":981},{"style":326},[982],{"type":25,"value":353},{"type":20,"tag":124,"props":984,"children":985},{"style":326},[986],{"type":25,"value":358},{"type":20,"tag":124,"props":988,"children":989},{"style":326},[990],{"type":25,"value":991}," systemd-resolved",{"type":20,"tag":124,"props":993,"children":994},{"style":332},[995],{"type":25,"value":368},{"type":20,"tag":124,"props":997,"children":998},{"class":126,"line":464},[999,1003,1007,1012],{"type":20,"tag":124,"props":1000,"children":1001},{"style":131},[1002],{"type":25,"value":323},{"type":20,"tag":124,"props":1004,"children":1005},{"style":326},[1006],{"type":25,"value":353},{"type":20,"tag":124,"props":1008,"children":1009},{"style":326},[1010],{"type":25,"value":1011}," restart",{"type":20,"tag":124,"props":1013,"children":1014},{"style":326},[1015],{"type":25,"value":1016}," systemd-networkd\n",{"type":20,"tag":54,"props":1018,"children":1020},{"id":1019},"_5-确认-ip",[1021],{"type":25,"value":1022},"5. 确认 IP",{"type":20,"tag":114,"props":1024,"children":1025},{"className":116,"code":376,"language":118,"meta":8,"style":8},[1026],{"type":20,"tag":45,"props":1027,"children":1028},{"__ignoreMap":8},[1029],{"type":20,"tag":124,"props":1030,"children":1031},{"class":126,"line":127},[1032,1036],{"type":20,"tag":124,"props":1033,"children":1034},{"style":131},[1035],{"type":25,"value":388},{"type":20,"tag":124,"props":1037,"children":1038},{"style":326},[1039],{"type":25,"value":393},{"type":20,"tag":21,"props":1041,"children":1042},{},[1043,1045,1051],{"type":25,"value":1044},"此时应显示 ",{"type":20,"tag":45,"props":1046,"children":1048},{"className":1047},[],[1049],{"type":25,"value":1050},"inet 192.168.100.10/24",{"type":25,"value":639},{"type":20,"tag":54,"props":1053,"children":1055},{"id":1054},"_6-测试网络",[1056],{"type":25,"value":1057},"6. 测试网络",{"type":20,"tag":114,"props":1059,"children":1061},{"className":116,"code":1060,"language":118,"meta":8,"style":8},"ping 1.1.1.1\nping google.com\n",[1062],{"type":20,"tag":45,"props":1063,"children":1064},{"__ignoreMap":8},[1065,1079],{"type":20,"tag":124,"props":1066,"children":1067},{"class":126,"line":127},[1068,1073],{"type":20,"tag":124,"props":1069,"children":1070},{"style":131},[1071],{"type":25,"value":1072},"ping",{"type":20,"tag":124,"props":1074,"children":1076},{"style":1075},"--shiki-default:#D33682;--shiki-dark:#79B8FF;--shiki-sepia:#AE81FF",[1077],{"type":25,"value":1078}," 1.1.1.1\n",{"type":20,"tag":124,"props":1080,"children":1081},{"class":126,"line":343},[1082,1086],{"type":20,"tag":124,"props":1083,"children":1084},{"style":131},[1085],{"type":25,"value":1072},{"type":20,"tag":124,"props":1087,"children":1088},{"style":326},[1089],{"type":25,"value":1090}," google.com\n",{"type":20,"tag":21,"props":1092,"children":1093},{},[1094],{"type":25,"value":1095},"如果能够正常访问互联网，说明 NAT 和 DNS 配置已经生效。",{"type":20,"tag":21,"props":1097,"children":1098},{},[1099],{"type":25,"value":1100},"之后即可固定使用：",{"type":20,"tag":114,"props":1102,"children":1104},{"className":116,"code":1103,"language":118,"meta":8,"style":8},"ssh 用户名@192.168.100.10\n",[1105],{"type":20,"tag":45,"props":1106,"children":1107},{"__ignoreMap":8},[1108],{"type":20,"tag":124,"props":1109,"children":1110},{"class":126,"line":127},[1111,1115],{"type":20,"tag":124,"props":1112,"children":1113},{"style":131},[1114],{"type":25,"value":413},{"type":20,"tag":124,"props":1116,"children":1117},{"style":326},[1118],{"type":25,"value":1119}," 用户名@192.168.100.10\n",{"type":20,"tag":21,"props":1121,"children":1122},{},[1123],{"type":25,"value":1124},"连接虚拟机，而不用担心 IP 变化。",{"type":20,"tag":295,"props":1126,"children":1127},{},[],{"type":20,"tag":33,"props":1129,"children":1131},{"id":1130},"配置免密连接",[1132],{"type":25,"value":1130},{"type":20,"tag":61,"props":1134,"children":1135},{},[1136],{"type":20,"tag":65,"props":1137,"children":1138},{},[1139],{"type":25,"value":1140},"在 Windows 生成 SSH 密钥对，如果以前生成过就不用再生成：",{"type":20,"tag":114,"props":1142,"children":1144},{"className":535,"code":1143,"language":537,"meta":8,"style":8},"ssh-keygen -t rsa -b 4096\n",[1145],{"type":20,"tag":45,"props":1146,"children":1147},{"__ignoreMap":8},[1148],{"type":20,"tag":124,"props":1149,"children":1150},{"class":126,"line":127},[1151],{"type":20,"tag":124,"props":1152,"children":1153},{},[1154],{"type":25,"value":1143},{"type":20,"tag":61,"props":1156,"children":1157},{},[1158],{"type":20,"tag":65,"props":1159,"children":1160},{},[1161],{"type":25,"value":1162},"复制密钥到 Arch Linux：",{"type":20,"tag":114,"props":1164,"children":1166},{"className":116,"code":1165,"language":118,"meta":8,"style":8},"cat ~/.ssh/id_rsa.pub | ssh 用户名@192.168.100.10 \"mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys\"\n",[1167],{"type":20,"tag":45,"props":1168,"children":1169},{"__ignoreMap":8},[1170],{"type":20,"tag":124,"props":1171,"children":1172},{"class":126,"line":127},[1173,1178,1183,1189,1194,1199],{"type":20,"tag":124,"props":1174,"children":1175},{"style":131},[1176],{"type":25,"value":1177},"cat",{"type":20,"tag":124,"props":1179,"children":1180},{"style":326},[1181],{"type":25,"value":1182}," ~/.ssh/id_rsa.pub",{"type":20,"tag":124,"props":1184,"children":1186},{"style":1185},"--shiki-default:#859900;--shiki-dark:#F97583;--shiki-sepia:#F92672",[1187],{"type":25,"value":1188}," |",{"type":20,"tag":124,"props":1190,"children":1191},{"style":131},[1192],{"type":25,"value":1193}," ssh",{"type":20,"tag":124,"props":1195,"children":1196},{"style":326},[1197],{"type":25,"value":1198}," 用户名@192.168.100.10",{"type":20,"tag":124,"props":1200,"children":1201},{"style":326},[1202],{"type":25,"value":1203}," \"mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys\"\n",{"type":20,"tag":295,"props":1205,"children":1206},{},[],{"type":20,"tag":33,"props":1208,"children":1210},{"id":1209},"额外推荐安装基础工具",[1211],{"type":25,"value":1212},"额外推荐：安装基础工具",{"type":20,"tag":21,"props":1214,"children":1215},{},[1216],{"type":25,"value":1217},"最小化系统缺少一些常用工具，建议安装：",{"type":20,"tag":114,"props":1219,"children":1221},{"className":116,"code":1220,"language":118,"meta":8,"style":8},"sudo pacman -S git less vim fish\n",[1222],{"type":20,"tag":45,"props":1223,"children":1224},{"__ignoreMap":8},[1225],{"type":20,"tag":124,"props":1226,"children":1227},{"class":126,"line":127},[1228,1232,1236,1240,1245,1250,1254],{"type":20,"tag":124,"props":1229,"children":1230},{"style":131},[1231],{"type":25,"value":323},{"type":20,"tag":124,"props":1233,"children":1234},{"style":326},[1235],{"type":25,"value":329},{"type":20,"tag":124,"props":1237,"children":1238},{"style":332},[1239],{"type":25,"value":335},{"type":20,"tag":124,"props":1241,"children":1242},{"style":326},[1243],{"type":25,"value":1244}," git",{"type":20,"tag":124,"props":1246,"children":1247},{"style":326},[1248],{"type":25,"value":1249}," less",{"type":20,"tag":124,"props":1251,"children":1252},{"style":326},[1253],{"type":25,"value":781},{"type":20,"tag":124,"props":1255,"children":1256},{"style":326},[1257],{"type":25,"value":1258}," fish\n",{"type":20,"tag":61,"props":1260,"children":1261},{},[1262,1273,1292,1311],{"type":20,"tag":65,"props":1263,"children":1264},{},[1265,1271],{"type":20,"tag":45,"props":1266,"children":1268},{"className":1267},[],[1269],{"type":25,"value":1270},"git",{"type":25,"value":1272},"：版本控制",{"type":20,"tag":65,"props":1274,"children":1275},{},[1276,1282,1284,1290],{"type":20,"tag":45,"props":1277,"children":1279},{"className":1278},[],[1280],{"type":25,"value":1281},"less",{"type":25,"value":1283},"：Git 分页器（否则 ",{"type":20,"tag":45,"props":1285,"children":1287},{"className":1286},[],[1288],{"type":25,"value":1289},"git log",{"type":25,"value":1291}," 会报错）",{"type":20,"tag":65,"props":1293,"children":1294},{},[1295,1301,1303,1309],{"type":20,"tag":45,"props":1296,"children":1298},{"className":1297},[],[1299],{"type":25,"value":1300},"vim",{"type":25,"value":1302}," 或 ",{"type":20,"tag":45,"props":1304,"children":1306},{"className":1305},[],[1307],{"type":25,"value":1308},"nano",{"type":25,"value":1310},"：文本编辑器",{"type":20,"tag":65,"props":1312,"children":1313},{},[1314,1320],{"type":20,"tag":45,"props":1315,"children":1317},{"className":1316},[],[1318],{"type":25,"value":1319},"fish",{"type":25,"value":1321},"：友好的交互式 Shell（可选）",{"type":20,"tag":295,"props":1323,"children":1324},{},[],{"type":20,"tag":33,"props":1326,"children":1328},{"id":1327},"常见问题",[1329],{"type":25,"value":1327},{"type":20,"tag":140,"props":1331,"children":1332},{},[1333,1349],{"type":20,"tag":144,"props":1334,"children":1335},{},[1336],{"type":20,"tag":148,"props":1337,"children":1338},{},[1339,1344],{"type":20,"tag":152,"props":1340,"children":1341},{},[1342],{"type":25,"value":1343},"问题",{"type":20,"tag":152,"props":1345,"children":1346},{},[1347],{"type":25,"value":1348},"解决方法",{"type":20,"tag":163,"props":1350,"children":1351},{},[1352,1368,1384,1421,1460],{"type":20,"tag":148,"props":1353,"children":1354},{},[1355,1363],{"type":20,"tag":170,"props":1356,"children":1357},{},[1358],{"type":20,"tag":69,"props":1359,"children":1360},{},[1361],{"type":25,"value":1362},"重启后仍然进入安装界面",{"type":20,"tag":170,"props":1364,"children":1365},{},[1366],{"type":25,"value":1367},"移除虚拟机中的 ISO 镜像",{"type":20,"tag":148,"props":1369,"children":1370},{},[1371,1379],{"type":20,"tag":170,"props":1372,"children":1373},{},[1374],{"type":20,"tag":69,"props":1375,"children":1376},{},[1377],{"type":25,"value":1378},"重启后不进入系统",{"type":20,"tag":170,"props":1380,"children":1381},{},[1382],{"type":25,"value":1383},"启动顺序里把磁盘提升到第一个",{"type":20,"tag":148,"props":1385,"children":1386},{},[1387,1395],{"type":20,"tag":170,"props":1388,"children":1389},{},[1390],{"type":20,"tag":69,"props":1391,"children":1392},{},[1393],{"type":25,"value":1394},"固定 IP 不生效",{"type":20,"tag":170,"props":1396,"children":1397},{},[1398,1400,1406,1408,1414,1416],{"type":25,"value":1399},"检查是否有多个 ",{"type":20,"tag":45,"props":1401,"children":1403},{"className":1402},[],[1404],{"type":25,"value":1405},".network",{"type":25,"value":1407}," 文件冲突（如 ",{"type":20,"tag":45,"props":1409,"children":1411},{"className":1410},[],[1412],{"type":25,"value":1413},"10-",{"type":25,"value":1415}," 开头的文件优先级更高），清理冲突文件后重启 ",{"type":20,"tag":45,"props":1417,"children":1419},{"className":1418},[],[1420],{"type":25,"value":629},{"type":20,"tag":148,"props":1422,"children":1423},{},[1424,1443],{"type":20,"tag":170,"props":1425,"children":1426},{},[1427],{"type":20,"tag":69,"props":1428,"children":1429},{},[1430,1435,1437],{"type":20,"tag":45,"props":1431,"children":1433},{"className":1432},[],[1434],{"type":25,"value":1289},{"type":25,"value":1436}," 报错 ",{"type":20,"tag":45,"props":1438,"children":1440},{"className":1439},[],[1441],{"type":25,"value":1442},"cannot run less",{"type":20,"tag":170,"props":1444,"children":1445},{},[1446,1448,1453,1454],{"type":25,"value":1447},"安装 ",{"type":20,"tag":45,"props":1449,"children":1451},{"className":1450},[],[1452],{"type":25,"value":1281},{"type":25,"value":883},{"type":20,"tag":45,"props":1455,"children":1457},{"className":1456},[],[1458],{"type":25,"value":1459},"sudo pacman -S less",{"type":20,"tag":148,"props":1461,"children":1462},{},[1463,1479],{"type":20,"tag":170,"props":1464,"children":1465},{},[1466],{"type":20,"tag":69,"props":1467,"children":1468},{},[1469,1471,1477],{"type":25,"value":1470},"网络不通但 ",{"type":20,"tag":45,"props":1472,"children":1474},{"className":1473},[],[1475],{"type":25,"value":1476},"ip a",{"type":25,"value":1478}," 有 IP",{"type":20,"tag":170,"props":1480,"children":1481},{},[1482,1484,1490],{"type":25,"value":1483},"检查 DNS 配置，确保 ",{"type":20,"tag":45,"props":1485,"children":1487},{"className":1486},[],[1488],{"type":25,"value":1489},"systemd-resolved",{"type":25,"value":1491}," 已启用",{"type":20,"tag":1493,"props":1494,"children":1495},"style",{},[1496],{"type":25,"value":1497},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html .sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}html.sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}",{"title":8,"searchDepth":343,"depth":343,"links":1499},[1500,1503,1504,1505,1506,1514,1515,1516],{"id":35,"depth":343,"text":38,"children":1501},[1502],{"id":56,"depth":464,"text":59},{"id":300,"depth":343,"text":303},{"id":429,"depth":343,"text":432},{"id":519,"depth":343,"text":522},{"id":615,"depth":343,"text":618,"children":1507},[1508,1509,1510,1511,1512,1513],{"id":642,"depth":464,"text":645},{"id":691,"depth":464,"text":694},{"id":759,"depth":464,"text":762},{"id":937,"depth":464,"text":940},{"id":1019,"depth":464,"text":1022},{"id":1054,"depth":464,"text":1057},{"id":1130,"depth":343,"text":1130},{"id":1209,"depth":343,"text":1212},{"id":1327,"depth":343,"text":1327},"markdown","content:zh:blog:971.hyperv-install-arch.md","content","zh/blog/971.hyperv-install-arch.md","zh/blog/971.hyperv-install-arch","md",{"_path":1524,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":1525,"description":1526,"date":1527,"tags":1528,"excerpt":1531,"body":1537,"_type":1517,"_id":2263,"_source":1519,"_file":2264,"_stem":2265,"_extension":1522},"/zh/blog/hyperv-debian-network","Hyper-V安装Debian和配置网络, wsl2的替代","因为想升级wsl2的Ubuntu20而引发的一系列问题.","2026-06-09 23:51",[13,1529,1530,15],"debian","wsl",{"type":17,"children":1532},[1533],{"type":20,"tag":21,"props":1534,"children":1535},{},[1536],{"type":25,"value":1526},{"type":17,"children":1538,"toc":2254},[1539,1543,1548,1568,1582,1593,1598,1610,1615,1620,1626,1631,1636,1641,1654,1659,1663,1668,1713,1717,1734,1738,1755,1760,1764,1768,1802,1806,1819,1823,1828,1833,1837,1841,1845,1879,1883,1910,1916,1921,1938,1942,1973,1978,2002,2007,2021,2026,2073,2078,2105,2110,2127,2132,2146,2151,2179,2183,2187,2204,2208,2212,2237,2242,2250],{"type":20,"tag":21,"props":1540,"children":1541},{},[1542],{"type":25,"value":1526},{"type":20,"tag":21,"props":1544,"children":1545},{},[1546],{"type":25,"value":1547},"删除最后一个 WSL 子系统后，我重新安装新的 Linux 发行版时发现安装进度一直卡住。",{"type":20,"tag":21,"props":1549,"children":1550},{},[1551,1553,1558,1560,1566],{"type":25,"value":1552},"安装 WSL 发行版时，系统需要依赖 ",{"type":20,"tag":69,"props":1554,"children":1555},{},[1556],{"type":25,"value":1557},"VirtualMachinePlatform（虚拟机平台）",{"type":25,"value":1559}," 功能。可以按下 ",{"type":20,"tag":45,"props":1561,"children":1563},{"className":1562},[],[1564],{"type":25,"value":1565},"Win + R",{"type":25,"value":1567},"，输入：",{"type":20,"tag":114,"props":1569,"children":1571},{"className":440,"code":1570,"language":25,"meta":8,"style":8},"optionalfeatures\n",[1572],{"type":20,"tag":45,"props":1573,"children":1574},{"__ignoreMap":8},[1575],{"type":20,"tag":124,"props":1576,"children":1577},{"class":126,"line":127},[1578],{"type":20,"tag":124,"props":1579,"children":1580},{},[1581],{"type":25,"value":1570},{"type":20,"tag":21,"props":1583,"children":1584},{},[1585,1587,1592],{"type":25,"value":1586},"打开“启用或关闭 Windows 功能”，确认已经勾选 ",{"type":20,"tag":69,"props":1588,"children":1589},{},[1590],{"type":25,"value":1591},"VirtualMachinePlatform",{"type":25,"value":639},{"type":20,"tag":21,"props":1594,"children":1595},{},[1596],{"type":25,"value":1597},"不过在我的电脑上，勾选后按确定进行windows功能安装也会卡住，原因和之前一样。",{"type":20,"tag":21,"props":1599,"children":1600},{},[1601,1603,1608],{"type":25,"value":1602},"经过排查，发现系统中 ",{"type":20,"tag":69,"props":1604,"children":1605},{},[1606],{"type":25,"value":1607},"VBS（基于虚拟化的安全性）",{"type":25,"value":1609}," 处于运行状态。理论上，关闭“内存完整性”后 VBS 通常会被关闭，但在我的 Windows 11 24H2 系统中，即使关闭内存完整性，VBS 仍然保持运行状态。",{"type":20,"tag":21,"props":1611,"children":1612},{},[1613],{"type":25,"value":1614},"部分资料建议进入 BIOS 关闭 CPU 虚拟化（Intel VT-x / AMD SVM），但我的主板 BIOS 中没有相关选项，因此无法尝试这种方法。",{"type":20,"tag":21,"props":1616,"children":1617},{},[1618],{"type":25,"value":1619},"最终我选择使用 Hyper-V 直接运行 Linux 虚拟机来代替 WSL。",{"type":20,"tag":33,"props":1621,"children":1623},{"id":1622},"安装-debian",[1624],{"type":25,"value":1625},"安装 Debian",{"type":20,"tag":21,"props":1627,"children":1628},{},[1629],{"type":25,"value":1630},"我选择的是 Debian 网络安装版（Netinst），镜像大小约 700MB，占用资源较小，适合作为开发服务器。",{"type":20,"tag":21,"props":1632,"children":1633},{},[1634],{"type":25,"value":1635},"安装时选择“图形化安装（Graphical Install）”即可。",{"type":20,"tag":21,"props":1637,"children":1638},{},[1639],{"type":25,"value":1640},"在软件选择界面，建议取消勾选桌面环境，只保留：",{"type":20,"tag":61,"props":1642,"children":1643},{},[1644,1649],{"type":20,"tag":65,"props":1645,"children":1646},{},[1647],{"type":25,"value":1648},"SSH Server",{"type":20,"tag":65,"props":1650,"children":1651},{},[1652],{"type":25,"value":1653},"Standard System Utilities",{"type":20,"tag":21,"props":1655,"children":1656},{},[1657],{"type":25,"value":1658},"这样安装完成后就是一个纯命令行服务器，占用内存更低。",{"type":20,"tag":33,"props":1660,"children":1661},{"id":300},[1662],{"type":25,"value":303},{"type":20,"tag":21,"props":1664,"children":1665},{},[1666],{"type":25,"value":1667},"进入 Debian 后安装并启动 SSH：",{"type":20,"tag":114,"props":1669,"children":1671},{"className":116,"code":1670,"language":118,"meta":8,"style":8},"sudo apt update\nsudo apt install openssh-server\n",[1672],{"type":20,"tag":45,"props":1673,"children":1674},{"__ignoreMap":8},[1675,1692],{"type":20,"tag":124,"props":1676,"children":1677},{"class":126,"line":127},[1678,1682,1687],{"type":20,"tag":124,"props":1679,"children":1680},{"style":131},[1681],{"type":25,"value":323},{"type":20,"tag":124,"props":1683,"children":1684},{"style":326},[1685],{"type":25,"value":1686}," apt",{"type":20,"tag":124,"props":1688,"children":1689},{"style":326},[1690],{"type":25,"value":1691}," update\n",{"type":20,"tag":124,"props":1693,"children":1694},{"class":126,"line":343},[1695,1699,1703,1708],{"type":20,"tag":124,"props":1696,"children":1697},{"style":131},[1698],{"type":25,"value":323},{"type":20,"tag":124,"props":1700,"children":1701},{"style":326},[1702],{"type":25,"value":1686},{"type":20,"tag":124,"props":1704,"children":1705},{"style":326},[1706],{"type":25,"value":1707}," install",{"type":20,"tag":124,"props":1709,"children":1710},{"style":326},[1711],{"type":25,"value":1712}," openssh-server\n",{"type":20,"tag":21,"props":1714,"children":1715},{},[1716],{"type":25,"value":373},{"type":20,"tag":114,"props":1718,"children":1719},{"className":116,"code":376,"language":118,"meta":8,"style":8},[1720],{"type":20,"tag":45,"props":1721,"children":1722},{"__ignoreMap":8},[1723],{"type":20,"tag":124,"props":1724,"children":1725},{"class":126,"line":127},[1726,1730],{"type":20,"tag":124,"props":1727,"children":1728},{"style":131},[1729],{"type":25,"value":388},{"type":20,"tag":124,"props":1731,"children":1732},{"style":326},[1733],{"type":25,"value":393},{"type":20,"tag":21,"props":1735,"children":1736},{},[1737],{"type":25,"value":398},{"type":20,"tag":114,"props":1739,"children":1740},{"className":116,"code":401,"language":118,"meta":8,"style":8},[1741],{"type":20,"tag":45,"props":1742,"children":1743},{"__ignoreMap":8},[1744],{"type":20,"tag":124,"props":1745,"children":1746},{"class":126,"line":127},[1747,1751],{"type":20,"tag":124,"props":1748,"children":1749},{"style":131},[1750],{"type":25,"value":413},{"type":20,"tag":124,"props":1752,"children":1753},{"style":326},[1754],{"type":25,"value":418},{"type":20,"tag":21,"props":1756,"children":1757},{},[1758],{"type":25,"value":1759},"此时可以正常连接，但如果使用 Hyper-V 默认网络，虚拟机重启后 IP 可能发生变化，因此可以配置固定 IP。",{"type":20,"tag":33,"props":1761,"children":1762},{"id":429},[1763],{"type":25,"value":432},{"type":20,"tag":21,"props":1765,"children":1766},{},[1767],{"type":25,"value":437},{"type":20,"tag":114,"props":1769,"children":1770},{"className":440,"code":441,"language":25,"meta":8,"style":8},[1771],{"type":20,"tag":45,"props":1772,"children":1773},{"__ignoreMap":8},[1774,1781,1788,1795],{"type":20,"tag":124,"props":1775,"children":1776},{"class":126,"line":127},[1777],{"type":20,"tag":124,"props":1778,"children":1779},{},[1780],{"type":25,"value":453},{"type":20,"tag":124,"props":1782,"children":1783},{"class":126,"line":343},[1784],{"type":20,"tag":124,"props":1785,"children":1786},{},[1787],{"type":25,"value":461},{"type":20,"tag":124,"props":1789,"children":1790},{"class":126,"line":464},[1791],{"type":20,"tag":124,"props":1792,"children":1793},{},[1794],{"type":25,"value":470},{"type":20,"tag":124,"props":1796,"children":1797},{"class":126,"line":473},[1798],{"type":20,"tag":124,"props":1799,"children":1800},{},[1801],{"type":25,"value":479},{"type":20,"tag":21,"props":1803,"children":1804},{},[1805],{"type":25,"value":484},{"type":20,"tag":114,"props":1807,"children":1808},{"className":440,"code":487,"language":25,"meta":8,"style":8},[1809],{"type":20,"tag":45,"props":1810,"children":1811},{"__ignoreMap":8},[1812],{"type":20,"tag":124,"props":1813,"children":1814},{"class":126,"line":127},[1815],{"type":20,"tag":124,"props":1816,"children":1817},{},[1818],{"type":25,"value":487},{"type":20,"tag":21,"props":1820,"children":1821},{},[1822],{"type":25,"value":503},{"type":20,"tag":21,"props":1824,"children":1825},{},[1826],{"type":25,"value":1827},"注意：",{"type":20,"tag":21,"props":1829,"children":1830},{},[1831],{"type":25,"value":1832},"切换网络后原来的 SSH 连接会立即失效，因此建议先完成 Windows 端网络配置，再切换虚拟机网络。",{"type":20,"tag":33,"props":1834,"children":1835},{"id":519},[1836],{"type":25,"value":522},{"type":20,"tag":21,"props":1838,"children":1839},{},[1840],{"type":25,"value":527},{"type":20,"tag":21,"props":1842,"children":1843},{},[1844],{"type":25,"value":532},{"type":20,"tag":114,"props":1846,"children":1847},{"className":535,"code":536,"language":537,"meta":8,"style":8},[1848],{"type":20,"tag":45,"props":1849,"children":1850},{"__ignoreMap":8},[1851,1858,1865,1872],{"type":20,"tag":124,"props":1852,"children":1853},{"class":126,"line":127},[1854],{"type":20,"tag":124,"props":1855,"children":1856},{},[1857],{"type":25,"value":549},{"type":20,"tag":124,"props":1859,"children":1860},{"class":126,"line":343},[1861],{"type":20,"tag":124,"props":1862,"children":1863},{},[1864],{"type":25,"value":557},{"type":20,"tag":124,"props":1866,"children":1867},{"class":126,"line":464},[1868],{"type":20,"tag":124,"props":1869,"children":1870},{},[1871],{"type":25,"value":565},{"type":20,"tag":124,"props":1873,"children":1874},{"class":126,"line":473},[1875],{"type":20,"tag":124,"props":1876,"children":1877},{},[1878],{"type":25,"value":573},{"type":20,"tag":21,"props":1880,"children":1881},{},[1882],{"type":25,"value":578},{"type":20,"tag":114,"props":1884,"children":1885},{"className":535,"code":581,"language":537,"meta":8,"style":8},[1886],{"type":20,"tag":45,"props":1887,"children":1888},{"__ignoreMap":8},[1889,1896,1903],{"type":20,"tag":124,"props":1890,"children":1891},{"class":126,"line":127},[1892],{"type":20,"tag":124,"props":1893,"children":1894},{},[1895],{"type":25,"value":593},{"type":20,"tag":124,"props":1897,"children":1898},{"class":126,"line":343},[1899],{"type":20,"tag":124,"props":1900,"children":1901},{},[1902],{"type":25,"value":601},{"type":20,"tag":124,"props":1904,"children":1905},{"class":126,"line":464},[1906],{"type":20,"tag":124,"props":1907,"children":1908},{},[1909],{"type":25,"value":609},{"type":20,"tag":33,"props":1911,"children":1913},{"id":1912},"配置-debian-固定-ip",[1914],{"type":25,"value":1915},"配置 Debian 固定 IP",{"type":20,"tag":21,"props":1917,"children":1918},{},[1919],{"type":25,"value":1920},"查看网卡名称：",{"type":20,"tag":114,"props":1922,"children":1923},{"className":116,"code":376,"language":118,"meta":8,"style":8},[1924],{"type":20,"tag":45,"props":1925,"children":1926},{"__ignoreMap":8},[1927],{"type":20,"tag":124,"props":1928,"children":1929},{"class":126,"line":127},[1930,1934],{"type":20,"tag":124,"props":1931,"children":1932},{"style":131},[1933],{"type":25,"value":388},{"type":20,"tag":124,"props":1935,"children":1936},{"style":326},[1937],{"type":25,"value":393},{"type":20,"tag":21,"props":1939,"children":1940},{},[1941],{"type":25,"value":667},{"type":20,"tag":114,"props":1943,"children":1945},{"className":440,"code":1944,"language":25,"meta":8,"style":8},"eth0\nens160\nenp0s3\n",[1946],{"type":20,"tag":45,"props":1947,"children":1948},{"__ignoreMap":8},[1949,1957,1965],{"type":20,"tag":124,"props":1950,"children":1951},{"class":126,"line":127},[1952],{"type":20,"tag":124,"props":1953,"children":1954},{},[1955],{"type":25,"value":1956},"eth0\n",{"type":20,"tag":124,"props":1958,"children":1959},{"class":126,"line":343},[1960],{"type":20,"tag":124,"props":1961,"children":1962},{},[1963],{"type":25,"value":1964},"ens160\n",{"type":20,"tag":124,"props":1966,"children":1967},{"class":126,"line":464},[1968],{"type":20,"tag":124,"props":1969,"children":1970},{},[1971],{"type":25,"value":1972},"enp0s3\n",{"type":20,"tag":21,"props":1974,"children":1975},{},[1976],{"type":25,"value":1977},"编辑配置：",{"type":20,"tag":114,"props":1979,"children":1981},{"className":116,"code":1980,"language":118,"meta":8,"style":8},"sudo nano /etc/network/interfaces\n",[1982],{"type":20,"tag":45,"props":1983,"children":1984},{"__ignoreMap":8},[1985],{"type":20,"tag":124,"props":1986,"children":1987},{"class":126,"line":127},[1988,1992,1997],{"type":20,"tag":124,"props":1989,"children":1990},{"style":131},[1991],{"type":25,"value":323},{"type":20,"tag":124,"props":1993,"children":1994},{"style":326},[1995],{"type":25,"value":1996}," nano",{"type":20,"tag":124,"props":1998,"children":1999},{"style":326},[2000],{"type":25,"value":2001}," /etc/network/interfaces\n",{"type":20,"tag":21,"props":2003,"children":2004},{},[2005],{"type":25,"value":2006},"将：",{"type":20,"tag":114,"props":2008,"children":2010},{"className":440,"code":2009,"language":25,"meta":8,"style":8},"iface eth0 inet dhcp\n",[2011],{"type":20,"tag":45,"props":2012,"children":2013},{"__ignoreMap":8},[2014],{"type":20,"tag":124,"props":2015,"children":2016},{"class":126,"line":127},[2017],{"type":20,"tag":124,"props":2018,"children":2019},{},[2020],{"type":25,"value":2009},{"type":20,"tag":21,"props":2022,"children":2023},{},[2024],{"type":25,"value":2025},"修改为：",{"type":20,"tag":114,"props":2027,"children":2029},{"className":440,"code":2028,"language":25,"meta":8,"style":8},"iface eth0 inet static\n  address 192.168.100.10\n  netmask 255.255.255.0\n  gateway 192.168.100.1\n  dns-nameservers 1.1.1.1 8.8.8.8\n",[2030],{"type":20,"tag":45,"props":2031,"children":2032},{"__ignoreMap":8},[2033,2041,2049,2057,2065],{"type":20,"tag":124,"props":2034,"children":2035},{"class":126,"line":127},[2036],{"type":20,"tag":124,"props":2037,"children":2038},{},[2039],{"type":25,"value":2040},"iface eth0 inet static\n",{"type":20,"tag":124,"props":2042,"children":2043},{"class":126,"line":343},[2044],{"type":20,"tag":124,"props":2045,"children":2046},{},[2047],{"type":25,"value":2048},"  address 192.168.100.10\n",{"type":20,"tag":124,"props":2050,"children":2051},{"class":126,"line":464},[2052],{"type":20,"tag":124,"props":2053,"children":2054},{},[2055],{"type":25,"value":2056},"  netmask 255.255.255.0\n",{"type":20,"tag":124,"props":2058,"children":2059},{"class":126,"line":473},[2060],{"type":20,"tag":124,"props":2061,"children":2062},{},[2063],{"type":25,"value":2064},"  gateway 192.168.100.1\n",{"type":20,"tag":124,"props":2066,"children":2067},{"class":126,"line":836},[2068],{"type":20,"tag":124,"props":2069,"children":2070},{},[2071],{"type":25,"value":2072},"  dns-nameservers 1.1.1.1 8.8.8.8\n",{"type":20,"tag":21,"props":2074,"children":2075},{},[2076],{"type":25,"value":2077},"重启网络：",{"type":20,"tag":114,"props":2079,"children":2081},{"className":116,"code":2080,"language":118,"meta":8,"style":8},"sudo systemctl restart networking\n",[2082],{"type":20,"tag":45,"props":2083,"children":2084},{"__ignoreMap":8},[2085],{"type":20,"tag":124,"props":2086,"children":2087},{"class":126,"line":127},[2088,2092,2096,2100],{"type":20,"tag":124,"props":2089,"children":2090},{"style":131},[2091],{"type":25,"value":323},{"type":20,"tag":124,"props":2093,"children":2094},{"style":326},[2095],{"type":25,"value":353},{"type":20,"tag":124,"props":2097,"children":2098},{"style":326},[2099],{"type":25,"value":1011},{"type":20,"tag":124,"props":2101,"children":2102},{"style":326},[2103],{"type":25,"value":2104}," networking\n",{"type":20,"tag":21,"props":2106,"children":2107},{},[2108],{"type":25,"value":2109},"确认 IP：",{"type":20,"tag":114,"props":2111,"children":2112},{"className":116,"code":376,"language":118,"meta":8,"style":8},[2113],{"type":20,"tag":45,"props":2114,"children":2115},{"__ignoreMap":8},[2116],{"type":20,"tag":124,"props":2117,"children":2118},{"class":126,"line":127},[2119,2123],{"type":20,"tag":124,"props":2120,"children":2121},{"style":131},[2122],{"type":25,"value":388},{"type":20,"tag":124,"props":2124,"children":2125},{"style":326},[2126],{"type":25,"value":393},{"type":20,"tag":21,"props":2128,"children":2129},{},[2130],{"type":25,"value":2131},"此时应显示：",{"type":20,"tag":114,"props":2133,"children":2135},{"className":440,"code":2134,"language":25,"meta":8,"style":8},"192.168.100.10\n",[2136],{"type":20,"tag":45,"props":2137,"children":2138},{"__ignoreMap":8},[2139],{"type":20,"tag":124,"props":2140,"children":2141},{"class":126,"line":127},[2142],{"type":20,"tag":124,"props":2143,"children":2144},{},[2145],{"type":25,"value":2134},{"type":20,"tag":21,"props":2147,"children":2148},{},[2149],{"type":25,"value":2150},"测试网络：",{"type":20,"tag":114,"props":2152,"children":2153},{"className":116,"code":1060,"language":118,"meta":8,"style":8},[2154],{"type":20,"tag":45,"props":2155,"children":2156},{"__ignoreMap":8},[2157,2168],{"type":20,"tag":124,"props":2158,"children":2159},{"class":126,"line":127},[2160,2164],{"type":20,"tag":124,"props":2161,"children":2162},{"style":131},[2163],{"type":25,"value":1072},{"type":20,"tag":124,"props":2165,"children":2166},{"style":1075},[2167],{"type":25,"value":1078},{"type":20,"tag":124,"props":2169,"children":2170},{"class":126,"line":343},[2171,2175],{"type":20,"tag":124,"props":2172,"children":2173},{"style":131},[2174],{"type":25,"value":1072},{"type":20,"tag":124,"props":2176,"children":2177},{"style":326},[2178],{"type":25,"value":1090},{"type":20,"tag":21,"props":2180,"children":2181},{},[2182],{"type":25,"value":1095},{"type":20,"tag":21,"props":2184,"children":2185},{},[2186],{"type":25,"value":1100},{"type":20,"tag":114,"props":2188,"children":2189},{"className":116,"code":1103,"language":118,"meta":8,"style":8},[2190],{"type":20,"tag":45,"props":2191,"children":2192},{"__ignoreMap":8},[2193],{"type":20,"tag":124,"props":2194,"children":2195},{"class":126,"line":127},[2196,2200],{"type":20,"tag":124,"props":2197,"children":2198},{"style":131},[2199],{"type":25,"value":413},{"type":20,"tag":124,"props":2201,"children":2202},{"style":326},[2203],{"type":25,"value":1119},{"type":20,"tag":21,"props":2205,"children":2206},{},[2207],{"type":25,"value":1124},{"type":20,"tag":33,"props":2209,"children":2210},{"id":1130},[2211],{"type":25,"value":1130},{"type":20,"tag":61,"props":2213,"children":2214},{},[2215,2226],{"type":20,"tag":65,"props":2216,"children":2217},{},[2218,2220],{"type":25,"value":2219},"在Windows生成ssh密钥对, 如果以前生成过就不用再生成了. ",{"type":20,"tag":45,"props":2221,"children":2223},{"className":2222},[],[2224],{"type":25,"value":2225},"ssh-keygen -t rsa -b 4096",{"type":20,"tag":65,"props":2227,"children":2228},{},[2229,2231],{"type":25,"value":2230},"复制密钥到debian: ",{"type":20,"tag":45,"props":2232,"children":2234},{"className":2233},[],[2235],{"type":25,"value":2236},"cat ~/.ssh/id_rsa.pub | ssh 用户名@服务器IP \"mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys\"",{"type":20,"tag":33,"props":2238,"children":2240},{"id":2239},"vscode快速打开项目",[2241],{"type":25,"value":2239},{"type":20,"tag":61,"props":2243,"children":2244},{},[2245],{"type":20,"tag":65,"props":2246,"children":2247},{},[2248],{"type":25,"value":2249},"vscode可以通过左下角的\"连接到远程主机\"连接到项目. 如果在\"最近打开的文件\"里没有历史记录, 想要快速打开项目, 可以安装扩展\"Project Manager\", 保存项目.",{"type":20,"tag":1493,"props":2251,"children":2252},{},[2253],{"type":25,"value":1497},{"title":8,"searchDepth":343,"depth":343,"links":2255},[2256,2257,2258,2259,2260,2261,2262],{"id":1622,"depth":343,"text":1625},{"id":300,"depth":343,"text":303},{"id":429,"depth":343,"text":432},{"id":519,"depth":343,"text":522},{"id":1912,"depth":343,"text":1915},{"id":1130,"depth":343,"text":1130},{"id":2239,"depth":343,"text":2239},"content:zh:blog:972.hyperv-debian-network.md","zh/blog/972.hyperv-debian-network.md","zh/blog/972.hyperv-debian-network",1783843576763]