Hyper-V and physical switch trunk port SPAN/mirroring - html

I'm new to the Hyper-V and trying to setup a lab. Here is my setup:
Cisco switch with a SPAN port (configured to mirror in/out, replicate the encapsulation, source port for the span is a trunk). I verified that I see all packets on the SPAN port
Server with Hyper-V VM that has two NICs. One is for general connectivity, the other is configured as a mirror destination. Vlan identification is disabled. Mapped to a virtual switch
Virtual switch is mapped to a dedicated server port connected to the Cisco SPAN port. OS sharing is allowed. VLAN identification is disabled. NDIS capture is enabled but NDIF also lists an errors in the window: "The Selected Extension is not operating correctly. Check the event logs for further information. If this is a non-Microsoft Extention, contact the vendor for further troubleshooting steps."
Server NIC is configured as a Hyper-V source as explained here: https://cloudbase.it/hyper-v-promiscuous-mode/
I can only see traffic from the server on the VM port. Nothing from the SPAN.
Is it even possible to setup what I'm trying to achieve? If so, am I missing something?
Thank you very much
VM NIC:
VSwitch:

Related

Can I set a static ip address for WSL 2?

I'm doing some Ruby on Rails development on a WSL 2. The rails app connects to a MySQL server running on my Windows host. When I used WSL 1 it as easy to set the host to 127.0.0.1 but on WSL 2 I have to use the nameserver written in /etc/resolv.conf
But I found out that IP address written in resolv.conf changes on reboots.
Is there a way to set a static IP address for WSL 2 ?
You can consider ocroz/wsl2-boot (see INSTALL for installation instructions)
After running wsl-boot command:
The WSL network is configured as per its predefined definition always (Windows side),
All WSL hosts are configured with their predefined static IP always (Linux side),
All WSL hosts and connected Hyper-V VMs can talk to each other always,
The DNS resolution works however you are connected to Internet or VPN,
You can SSH to WSL host without any delay.
Dec. 2022, microsoft/WSL issue 4210 also adds:
With the latest Windows 11 (22621+), you can already specify the network adapter you want to use for WSL2 in .wslconfig:
[wsl2]
networkingMode=bridged
vmSwitch=my-switch
ipv6=true
So, now you can create a Hyper-V external virtual switch for WSL2 and fix the IP address, no other scripts are required. It works out-of-box.
The same thread adds:
Create a vSwitch in Hyper-V,I Use Hyper-V Gui to do this. Hyper-V has three types of virtual switches -- external, internal, and private.
I choose the "external" type , which is bridge type, the same as VMWare workstation.
set this config in .wslconfig
I find the IP change to the network of my home router,which is replace the old of eth0.
You can set DHCP in you home router, then Fix the IP of the bridge.
To sum up, in the case of bridge, it is essentially DHCP , and whether it is fixed or not depends on the DHCP server.
If you don't want /etc/hosts, /etc/resolv.conf to change after restart, you can create
/etc/wsl.conf
[network]
generateHosts = false
generateResolvConf = false

Oracle Virtualbox Network SPAN/Mirror Port

Is there any way to setup a 'SPAN' or 'Mirror' port using VirtualBox so as to copy/mirror all network traffic from a particular virtual network to a promiscuous-mode adapter on a Virtual machine?
The use case is as follows - I need to teach a class on security and was figuring the easiest way for students to practise. The monitoring machine will likely have Zeek(Bro) installed and will be used to analyse packet metadata.

IPSec tunnel on Google Compute Virtual Machine

I am trying to setup an IPSec tunnel on my virtual machine on Google Compute Engine and it seems all my traffic is blocked. Even though I have open the necessary ports on both the Windows Server 2016 server and Google's Firewall. Question I have is it possible to setup the VPN tunnel on the server it self or should I make use of the Hybrid Connectivity VPN or something else? I have the same setup on a dedicated server but just can't get Main Mode and or Quick Mode functioning at all.
PS I have setup many iPSec tunnels on stand alone server just not on a virtual server using Google Compute Engine.
Thanks in advance for your help on this one.
I was able to set up IPSec VPN server with Debian 10 virtual machine, on Google Compute Engine.
Here's what I did:
While creating virtual machine instance (Debian 10 for example), in "Network interface" window set option "IP forwarding" to "ON";
On "VPC network" page create firewall rule with open ports: "udp: 500, 4500";
Use this script to setup VPN software:
wget https://git.io/vpnsetup -O vpnsetup.sh && sudo sh vpnsetup.sh
It will generate credentials needed for next step. They look like this: "Server IP: ****", "IPsec PSK: ****", "Username: ****", "Password: ****".
For client configuration use credentials generated from above step and IPsec/XAuth protocol while setting vpn connection.
Look here if you encounter problems: https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-xauth.md
Check this guide "IPsec VPN Server Auto Setup Scripts" for more information:
https://github.com/hwdsl2/setup-ipsec-vpn

How can I mount a local drive in remote machine?

I would like to mount a local (one I have physical access to) drive on a google compute engine vm.
Any links on how to do it?
Have a look at this. It's written for Ubuntu, since you have not specified what OS you are running locally. You will need to make sure that your machine is running SSH server.
Another thing to keep in mind is local port forwarding. If you are behind a NAT you must specify the IP of your system in the firewall or router in order to accept incoming connections on port 22 (or whatever port you decide on).
If you provide info on your OS type, I can help you further.

access mysql in host from guest virtualbox

This is my scenario,
I have a Ubuntu 12.10 host and a win 7 guest installed in the virtual box. The Network is configured to be NAT in the virtual box. I have a mysql sever installed in the Ubuntu with “bind_address” in my.cnf is commented out.
How can I access this mysql server from the windows 7 guest? I did some search in Google and came accross with this Host-Only Networking With VirtualBox but I cant get it work as I don't have statics IP with my internet vendor and my network knowledge is very bad. All I know is that I have DHCP enabled Internet connection. So if i do any IP's in the network settings I don't have Internet.
I know that there are plenty of solutions on the other way around (access the guest server from the host) but still cant figure it out.
So any help is appreciated.
Thanks
Your external IP being static or not has no bearing to accessing a virtualized server on your LAN.
Set VirtualBox to bridge mode.
Simply determine your computer's DHCP-selected internal IP (usually 192.168.1.SOMETHING) and replace the last number with another that is less than 250. For example, if your computer was 192.168.1.6, 192.168.1.70 would work fine on the VM(pick a high number to void conflicts).
Set it by using the control panel->adapter settings. Reboot the VM. Connect to MySQL at 192.168.1.70(or the address you picked earlier).
Note: If your computer's address is in a different subnet (192.168.0.XXX, 10.XX.XX.XX, etc) change the last number and keep the first numbers the same as on the host.