今天想要修改Server Core VM的IP,但是使用sconfig卻看不到我想要修改的網卡。
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corp. 1996-2006, 著作權所有,並保留一切權利
正在檢查系統...
===============================================================================
伺服器設定
===============================================================================
1) 網域/工作群組: 工作群組: WORKGROUP
2) 電腦名稱: SWARMNODE1
3) 新增本機系統管理員
4) 設定遠端管理 已啟用
5) Windows Update 設定: 手動
6) 下載並安裝更新
7) 遠端桌面: 已停用
8) 網路設定
9) 日期和時間
10) 遙測設定未知
11) Windows 啟用
12) 登出使用者
13) 重新啟動伺服器
14) 關閉伺服器
15) 結束並返回命令列
輸入數字即可選取選項: 8
--------------------------------
網路設定
--------------------------------
可用的網路介面卡
索引# IP 位址 描述
3 172.18.80.1 Hyper-V Virtual Ethernet Adapter
選取網路介面卡索引# (空白=取消):
但是用Powershell看是可以看到3張網卡的,我在想應該是在sconfig看不到虛擬的網卡。
PS C:\> Get-NetAdapter -Name *
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
---- -------------------- ------- ------ ---------- ---------
vEthernet (nat) Hyper-V Virtual Ethernet Adapter 16 Up 00-15-5D-D1-B4-AB 10 Gbps
乙太網路 Microsoft Hyper-V Network Adapter 8 Up 00-15-5D-2B-DD-04 10 Gbps
vEthernet (乙太網路) Hyper-V Virtual Ethernet Adapter #2 5 Up 00-15-5D-2B-DD-04 10 Gbps
還好萬能的Powershell可以直接修改(其實也沒那麼直接)
#查看IP,從上個指令(Get-NetAdapter)可以看到 InterfaceIndex 就是ifIndex這個欄位
Get-NetIPAddress -InterfaceIndex 5
#移除IP
Remove-NetIPAddress -InterfaceIndex 5
#設定IP及遮罩
New-NetIPAddress -InterfaceIndex 5 -IPAddress 192.168.100.2 -PrefixLength 24
#移除gateway
Remove-NetRoute -InterfaceIndex 5
#設定gateway
New-NetRoute -InterfaceIndex 5 -NextHop 192.168.100.1 -DestinationPrefix 0.0.0.0/0
#測試
ping 192.168.100.1
ping 1.1.1.1
#查看DNS
Get-DnsClientServerAddress -InterfaceIndex 5
#設定DNS
Set-DnsClientServerAddress -InterfaceIndex 5 -ServerAddresses @("8.8.8.8","8.8.4.4")
#測試
ping www.google.com
powershell
Server Core
借用保哥的範例:https://blog.miniasp.com/post/2021/09/02/Batch-replace-Office-365-to-Microsoft-365-License-using-PowerShell 只是保哥的例子,不是完整的範例,借這篇把內容補齊而己 安裝 AzureAD Module 系統管理員身分執行 PowerShell 命令提示字元視窗。 執行︰ Install-Module -Name AzureAD
Oct 5, 2021先到IP的組態裡幫IP設個DNS名稱 DNS 名稱標籤 (選用): 選一個可以代表這個IP功用的名字。Azure 會自動加上尾碼。 設定 ReverseFqdn。由於 UI 上並沒有提供設定的功能,所以要使用Azure Powershell來設定。 $pip = Get-AzPublicIpAddress -Name "Public的名字" -ResourceGroupName "ResourceGroup的名字" $pip.DnsSettings.ReverseFqdn = "www.domain.com." #這裡注意fqdn最後要有個. Set-AzPublicIpAddress -PublicIpAddress $pip
Sep 13, 2021啟用VM的巢狀虛擬化 注意: Guest OS 的版本要在 Windows Server build 18945 版本以上,這裡的範例是使用 Windows Server 2004的版本 在VM安裝完成後,第一步就是先啟用VM的巢狀虛擬化 以Hyper-V為例(使用powershell) Get-VM "VM的名字" | Set-VMProcessor -ExposeVirtualizationExtensions $true 各種VM啟用的方式,參考資料如下
Jul 20, 2021情境 當使用指令 docker service logs [service name] 要讀取log時,如果發生下列錯誤。 error from daemon in stream: Error grabbing logs: rpc error: code = Unknown desc = warning: incomplete log stream. some logs could not be retrieved for the following reasons: node XXXXXXXXXXXXXXXXXXXXXXXXXXXXX is not available 這似乎是docker 的bug ,在2017年就有人在docker的官方github發這個issue,但是到今天(2021年3月,版本19.03.14)為止都還沒解決。 看起來,把host重新開機或者把Service 移除再重新部署都沒有辦法。 解決方法
Feb 26, 2021or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up