portillosjohn
asked on
Set Default Gateway With Bat File
How does one set the default gateway for all NIC's with a bat file?
And you would normally only want one default gateway, can you explain please?
ASKER
I only want one default gateway. Its just that the nics are named differently on the machines that I will be using the script on.
You can do it using netsh. If you do
netsh dump > x.txt
and have a look at x.txt it will give you an idea of the commands.
e.g.
netsh interface ipv4 delete route prefix=0.0.0.0/0 interface="Local Area Connection"
netsh interface ipv4 add route prefix=0.0.0.0/0 interface="Local Area Connection" nexthop=x.x.x.x publish=Yes
Steve
netsh dump > x.txt
and have a look at x.txt it will give you an idea of the commands.
e.g.
netsh interface ipv4 delete route prefix=0.0.0.0/0 interface="Local Area Connection"
netsh interface ipv4 add route prefix=0.0.0.0/0 interface="Local Area Connection" nexthop=x.x.x.x publish=Yes
Steve
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If it is temporary you can remove the default route and point it elsewhere using:
route delete 0.0.0.0
route add 0.0.0.0 mask 0.0.0.0 x.x.x.x
steve