This repository contains a PowerShell script to remove NAT from WSL2 and set up bridged networking. By following the steps outlined in this script, you can configure your WSL2 instance to have an IP address on the same subnet as your host machine, allowing for better network integration and connectivity.
- Improved Network Integration: By using bridged networking, your WSL2 instance will have an IP address on the same subnet as your host machine, making it easier to access network resources and services.
- Enhanced Connectivity: Bridged networking allows for seamless communication between your WSL2 instance and other devices on the network, improving overall connectivity.
- Static IP Configuration: The script allows you to assign a static IP address to your WSL2 instance, ensuring consistent network configuration across reboots.
- Automated Setup: The provided script automates the process of setting up bridged networking, saving you time and effort.
- Direct Network Access: Bridged networking provides your WSL2 instance with direct access to the network, allowing you to perform more realistic penetration tests. This setup mimics the behavior of an insider threat, enabling you to test internal security measures effectively.
- Unrestricted Exploit Traffic: With bridged networking, exploit traffic can flow freely between your WSL2 instance and target machines without being blocked or altered by the host's firewall or antivirus software. This ensures that your penetration tests are accurate and effective.
- Improved Network Visibility: Bridged networking enhances network visibility, allowing you to use tools like
nmap
to scan the network for vulnerabilities more effectively. You can also capture and analyze network traffic directly from the network, providing deeper insights into potential security issues. - Access to Broadcast Traffic: Bridged networking enables your WSL2 instance to access broadcast traffic on the network, which can be useful for discovering devices and services that are not directly reachable. This can help identify additional attack vectors and potential targets.
- Consistent Testing Environment: By assigning a static IP address to your WSL2 instance, you ensure that your network configuration remains consistent across reboots. This stability is crucial for maintaining a reliable testing environment and for automating penetration testing tasks.
-
Save the Script: Save the provided PowerShell script as
SetupWSLBridgedNetwork.ps1
. -
Run the Script with Administrative Privileges:
- Open PowerShell as an administrator.
- Navigate to the directory where the script is saved.
- Execute the script using the command:
.\SetupWSLBridgedNetwork.ps1
-
Automate the Script Execution on Startup:
- Use Task Scheduler to run the script at startup, ensuring that the network configuration persists across reboots.
-
Open Task Scheduler:
- Press
Win + R
, typetaskschd.msc
, and press Enter.
- Press
-
Create a New Task:
- Click on "Create Task" in the right-hand Actions pane.
- Name the task (e.g., "WSL Bridged Network Setup").
- Under the "General" tab, select "Run with highest privileges".
-
Set the Trigger:
- Go to the "Triggers" tab and click "New".
- Set the trigger to "At startup".
-
Set the Action:
- Go to the "Actions" tab and click "New".
- Set the action to "Start a program".
- In the "Program/script" field, enter
powershell.exe
. - In the "Add arguments (optional)" field, enter the path to your script:
-File "C:\Path\To\SetupWSLBridgedNetwork.ps1"
-
Finish and Save:
- Click "OK" to save the task.
This project is licensed under the MIT License - see the LICENSE file for details.