newtekie1
Semi-Retired Folder
- Joined
- Nov 22, 2005
- Messages
- 28,472 (4.23/day)
- Location
- Indiana, USA
Processor | Intel Core i7 10850K@5.2GHz |
---|---|
Motherboard | AsRock Z470 Taichi |
Cooling | Corsair H115i Pro w/ Noctua NF-A14 Fans |
Memory | 32GB DDR4-3600 |
Video Card(s) | RTX 2070 Super |
Storage | 500GB SX8200 Pro + 8TB with 1TB SSD Cache |
Display(s) | Acer Nitro VG280K 4K 28" |
Case | Fractal Design Define S |
Audio Device(s) | Onboard is good enough for me |
Power Supply | eVGA SuperNOVA 1000w G3 |
Software | Windows 10 Pro x64 |
I have a friend that carries his laptop back and forth between his home and his office. At the office he has to use a static IP, and at home the static IP doesn't work so he has to use DHCP(or set a static IP that does work). So a did a little research and found out how to set a static IP via the command prompt and then how to remove that static IP and go back to DHCP.
The command lines to set a static IP are:
So it would look like this:
The command lines to set everything back to DHCP are:
I've included a zip file with two bat files that do this that I created for him so he doesn't have to run the commands manually every time he moves between the office and his home.
Hopefully someone else finds this useful.
The command lines to set a static IP are:
Code:
netsh int ip set address "<connection_name>" static <static_ip> <subnet_mask> <default_gateway> 1
netsh int ip set dns "<connection_name>" static <primary_dns> primary
So it would look like this:
Code:
netsh int ip set address "local area connection" static 10.0.0.100 255.0.0.0 10.0.0.1 1
netsh int ip set dns "local area connection" static 10.0.0.1 primary
The command lines to set everything back to DHCP are:
Code:
netsh int ip set address "local area connection" dhcp
netsh int ip set dns "local area connection" dhcp
I've included a zip file with two bat files that do this that I created for him so he doesn't have to run the commands manually every time he moves between the office and his home.
Hopefully someone else finds this useful.