I have a Windows Hyper-V Free Edition R2 2012 server and I need to create a static route for Hyper-V to communicate with private internal addresses and vice-versa.
I tried to add the route manually, but when Windows restarts, it doesn't work (but the route appears in route print table).
I tried to create a scheduled task that executes a batch script (
.bat
) to add the route. This method adds the route only if I add-P
option in the command line, but neither works.I tried to add it with
netsh
, but I can't add the interface because it is private and doesn't appear. I received an error sayingThe filename, directory name, or volume label syntax is incorrect.
all the time.I've also tried to create a
REG_SZ
string in the registry with regedit, but doesn't work.
In 1 and 2, it works when I execute my .bat
file manually later, when I log on. The problem is that I need it to execute automatically.
This is the script:
@ECHO ON
REM ADD THE ROUTE
ROUTE -P ADD 192.168.10.0 MASK 255.255.255.0 192.168.10.1 METRIC 1