VirtualBox 브리징 Bat 스크립트를 통해 모든 IP 트래픽을 모든 게스트와 모든 호스트로 전환

VirtualBox 브리징 Bat 스크립트를 통해 모든 IP 트래픽을 모든 게스트와 모든 호스트로 전환

에서 "게스트 전용 네트워크 어댑터 설정" 게스트 OS(Windows Server 2003) 또는 HOST OS(Windows Server 2012)에서 개인 tfpt 부팅 네트워크를 실행할 수 있었습니다. 이를 통해 임베디드 시스템에서 현재 및 레거시 소프트웨어 테스트를 실행할 수 있습니다.

브리징 중인 NIC 카드의 드라이버를 선택/선택 취소하는 스크립트를 갖고 싶습니다.

  • 게스트 OS의 경우 "VirtualBox NDIS6 브리지 네트워킹 드라이버"를 제외한 모든 항목을 비활성화하고 싶습니다. 현재는 이 작업을 수동으로 수행합니다.

  • 호스트 OS로 전환할 때 "VirtualBox NDIS6 브리지 네트워킹 드라이버"를 비활성화하고 다른 모든 드라이버를 활성화하고 싶습니다.

    • Microsoft 네트워크용 클라이언트
    • 인터넷 프로토콜 버전 6(TCP/IPv6)
    • 인터넷 프로토콜 버전 4(TCP/IPv4)
    • ...(넷바이오스 등)

"netsh .." 또는 "wmic nic"을 사용할 수 있어야 한다고 생각합니다. 이것을하기 위해. 지금까지는 netsh 인터페이스 덤프 > configA.dat 및 netsh -f configA.dat 또는 netsh -f configB.dat 명령을 사용하면 변경되지 않습니다. 이 작업은 여전히 ​​수동으로 수행해야 합니다. 이 문제를 해결하는 방법에 대한 아이디어가 있습니까?

스크린샷:

로컬 영역 연결 속성 스크린샷

답변1

이것은 나를 위해 문제를 해결하기 위해 내가 생각해낸 스크립트입니다.

#######################################################################
# SelectLAN.ps1
#
#  Simple? Windows PowerShell Script to select between 
#   1) Win2012 HOST system controlling 10.1.1.100 (Tester network)
#   2) Win2003 VirtualBox Guest Operating System controlling 10.1.100  (Tester network)
#
########################################################################
#
#  Revision History
#  0.0 10/18/2016  R.Youngblood 
#
########################################################################

function win2012 {
  ""  
  " Applying WIN2012 LAN Configuration"
  ""
  " Enabling Local Reciept of IPV4 and IPV6 packets"
  " Disable VirtualBox Driver"
  Get-NetAdapterBinding -InterfaceAlias "LAN2"
  Enable-NetAdapterBinding -Name "LAN2" -ComponentID     oracle_vboxnetlwf
  Disable-NetAdapterBinding -Name "LAN2" -ComponentID ms_rspndr
  Disable-NetAdapterBinding -Name "LAN2" -ComponentID ms_lltdio
  Disable-NetAdapterBinding -Name "LAN2" -ComponentID ms_implat
  Disable-NetAdapterBinding -Name "LAN2" -ComponentID ms_msclient
  Disable-NetAdapterBinding -Name "LAN2" -ComponentID vflt
  Disable-NetAdapterBinding -Name "LAN2" -ComponentID ms_pacer 
  Disable-NetAdapterBinding -Name "LAN2" -ComponentID ms_server
  Disable-NetAdapterBinding -Name "LAN2" -ComponentID ms_tcpip
  Disable-NetAdapterBinding -Name "LAN2" -ComponentID ms_tcpip6 
}



function win2003VM {
   ""
   " Applying WIN2003 LAN Configuration"
   ""
   " Disable Local IPV4 and IPV6 Packet reciept"
   " Enable VirtualBox Driver"
   ""
   Get-NetAdapterBinding -InterfaceAlias "LAN2"
   Disable-NetAdapterBinding -Name "LAN2" -ComponentID oracle_vboxnetlwf
   Enable-NetAdapterBinding -Name "LAN2" -ComponentID ms_rspndr
   Enable-NetAdapterBinding -Name "LAN2" -ComponentID ms_lltdio
   Enable-NetAdapterBinding -Name "LAN2" -ComponentID ms_implat
   Enable-NetAdapterBinding -Name "LAN2" -ComponentID ms_msclient
   Enable-NetAdapterBinding -Name "LAN2" -ComponentID vflt
   Enable-NetAdapterBinding -Name "LAN2" -ComponentID ms_pacer
   Enable-NetAdapterBinding -Name "LAN2" -ComponentID ms_server
   Enable-NetAdapterBinding -Name "LAN2" -ComponentID ms_tcpip
   Enable-NetAdapterBinding -Name "LAN2" -ComponentID ms_tcpip6
}





function endprint {
  " Final Network Adapter configuration:"
  Get-NetAdapterBinding -InterfaceAlias "LAN2"
  " -- Done"
}

cls
""
"IP Configuration"
""
" 1. Win2012                 Owns 10.1.1.100 IP"
" 2. Win2003 Virtual Machine Owns 10.1.1.100 IP"
""

$option = Read-Host -Prompt 'Enter your choice'
if ($option -eq 1 ) { win2012 }
if ($option -eq 2 ) { win2003VM }
endprint

관련 정보