Cara Mengubah Dns Windows 8
Untuk mengubah DNS di komputer windows Anda bisa melihat pada langkah dibawah ini: Cara Mengganti DNS Server di PC Windows Perangkat windows merupakan salah satu perangkat lunak operating system yang banyak digunakan oleh pengguna desktop di seluruh dunia.
This batch file script will allow you to set a static or dhcp ip address on a spicific adapter on your pc.
I created this script because I have to change the IP address on my laptop for field troubleshooting. If you have any question please feel free to contact me.
4 Steps total
Step 1: Verify the name of your network connection
The script is very specific to the name of the connection that it is making changes to.
Go to:
Network Connection in the control pannel.
Make a note of the name of the connection that you are anting to control. in my case I am working with the LAN connection. By default that connections are called Local Area Connection (1) etc.
Step 2: Copy this script.
Here is the script that is going to do the work for you. Open Notepad and paste the script into notepad
Script Beginning:
@echo off
echo Choose:
echo [A] Set Static IP
echo [B] Set DHCP
echo.
:choice
SET /P C=[A,B]?
for %%? in (A) do if /I '%C%'%%?' goto A
for %%? in (B) do if /I '%C%'%%?' goto B
goto choice
:A
@echo off
echo 'Please enter Static IP Address Information'
echo 'Static IP Address:'
set /p IP_Addr=
echo 'Default Gateway:'
set /p D_Gate=
echo 'Subnet Mask:'
set /p Sub_Mask=
echo 'Setting Static IP Information'
netsh interface ip set address 'LAN' static %IP_Addr% %Sub_Mask% %D_Gate% 1
netsh int ip show config
pause
goto end
:B
@ECHO OFF
ECHO Resetting IP Address and Subnet Mask For DHCP
netsh int ip set address name = 'LAN' source = dhcp
ipconfig /renew
ECHO Here are the new settings for %computername%:
netsh int ip show config
pause
goto end
:end
Script END!
Step 3: Save the script
Select File Save-AS. in the file type box make sure you select All Files. When you name the file make sure it has a .bat file extension.
Step 4: Enjoy the script
The script when clicked on will display a simple menu. You choose static IP or DHCP. either selection will change the IP address of the adapter you selected.
24 Comments
- CayenneScott D. Apr 28, 2009 at 04:18pm
If there is a way to add a file to this How to I will add the batch file to the post.
- Pure CapsaicinMartin9700 Sep 18, 2009 at 05:59am
Scott, you could add the batch file (now) into the Script Center, then add the link as a reference...
- JalapenoMike4548 Jun 30, 2010 at 09:38am
Is there a way to change DNS for Static IP?
- CayenneScott D. Jun 30, 2010 at 09:49am
The short answer is yes.
example:
netsh interface ip set dns 'Local Area Connection' static 192.168.0.200 - CayenneScott D. Jun 30, 2010 at 09:52am
To change it back to dynamilcy get DNS you can set the interface to get a dhcp address or use the following command.
netsh interface ip set dns 'Local Area Connection' dhcp
- AnaheimBruce_R Jul 21, 2010 at 10:27am
For Windows XP SP3 and above I use the netsh command. Especially powerful in Vista/Windows7/Server 2008.
To change from DHCP to Static I use this script ..
interface ip set address name='Local Area Connection' source=static addr=10.135.150.210 mask=255.255.255.0
interface ip set address name='Local Area Connection' gateway=10.135.150.254 gwmetric=0
interface ip set dns name='Local Area Connection' source=static addr=10.100.14.249 register=NONE
interface ip add dns name='Local Area Connection' addr=10.100.12.249 index=2
interface ip set wins name='Local Area Connection' source=static addr=noneThe script syntax varies with windows versions, mine is for windows 7
- Pimientoamir4401 Aug 9, 2010 at 04:37am
can I use this script in ubuntu linux
- SerranoDMel Oct 27, 2010 at 08:41pm
Is there a way to determine what the name of the connection is? and then insert it into the script?
As in, I have about 100 PCs that I will soon be changing to DHCP they are in AD, so this script would be awesome. Only problem I see is that IF the LOCAL AREA CONNECTION is not what the name of the active connection is, then those PCs won't be changed.
If there was some way to pole the PC in question as to what it's active connection name is, and enter it as a variable and not have user interaction this would be perfect for my needs.
- Pimientolee_hung2002 May 18, 2011 at 12:29am
Thank you very much, Scott. It works well for my needed. Just a quick question.I modified your script. I added the dns on the static setting. It worked fine. But I don't know how to change back the original DNS when select option B. Could you help, please? Thanks, again.
- PimientoKevinJ Jul 9, 2011 at 07:03am
Command line is great, but I recommend to use some tool for that, simplify and automate. I'm using Maxidix IP Switcher for example, it is the simplest way for fast switching between IP settings. I also know that the other program Wifi Suite can switch settings even automatically when you connecting to wireless network.
- PimientoGoks Aug 29, 2011 at 11:51pm
Ah! Brilliant ! I was searching for a script like this. But, I am a noob in scripting. Please help me out Scott. My problem is I have a Internet static IP address for my LAN and I have another Internet Connection which uses DHCP and I have connected to a switch.
So, if the static IP address reads No Internet Access for about 5 mins I want a script to automatically switch to my 2nd Internet Connection which uses DHCP. In short, static should automatically switch to DHCP when it reads 'No Internet Access'... Please help me!
- PimientoBannedAccount Sep 3, 2011 at 09:55pm
how about script to set 'Obtain DNS server address automatically' for windows 7.
- Sonorayaelfabulous Jan 18, 2013 at 10:27pm
thanks for this how-to.
- ChipotleRicardoLopes May 2, 2013 at 11:14am
I think that our LAN will be cleaner this way! Will try to implement it here.
- PimientoAbdul4079 May 10, 2013 at 10:04am
just copy the below code and paste the script into notepad.
I can use netsh to change my entire IP address (IP address, subnet mask, and gateway gwmetric (as 1 in normal, [for secondary ip address for the same nic mentions as 2 in gwmetric ).Script Beginning:
@echo off
echo 'Setting Static IP Information'
netsh interface ip set address 'Local Area Connection' static 192.168.0.111 255.255.0.0 192.168.0.1 1
netsh int ip show config
goto end
:endend of script
- 1
- 2
Windows 10 makes it easy for the users to configure Windows Firewall by using pre-defined configurations of Windows Firewall. By default, there are three network types on which Windows Firewall configurations are used, public, private and domain.
Windows gives users an option to select a network type when a new network is connected to the computer. Windows will set the Windows Firewall rules according to the network type selected. Lets first know more about each network type.
Quick Summary
- 1 Network Types
- 3 Ways to change network types in Windows 10
Network Types
Public Network
A public network is the default network type. If no network type is selected, Windows will configure Windows Firewall using the Public network type rules. In public network, Windows Firewall rules will be the most restrictive. The firewall will block most of the apps from connecting from the Internet and disabling some features like file and printer sharing, network discovery and automatic setup of network devices etc.
You should use this type of network when you have only one computer and do not want to communicate with any other network device.
Cara Mengganti Dns Windows 8
Private Network
The private network can be a home network or work network. This type of network will enable most networking features of Windows 10 like file sharing, network device setup, network discovery etc.
Use this network type if you trust the network you are connecting to.
Cara Merubah Dns Pada Windows 8
Domain Network
The domain network is automatically detected when your computer is a member of Active Directory domain network. Windows should automatically detect this type of network and configure Windows Firewall accordingly. This type of network gives more control to the network administrator and the admin can apply different network security configurations using Active Directory group policies.
In this article, we will be more interested in changing the network type from public to private and vice versa as the domain network is automatically detected by Windows 10 and we don’t need to change anything.
What is the current network type of your computer?
Before going through the ways to change network type in Windows 10, we need to see what is the current network type of the connected network. To check the current network type settings, follow the steps below:
- Go to Control Panel –> Network and Internet –> View Network status and tasks
- You will see the network type under each connected network
Ways to change network types in Windows 10
Let’s go through a few methods to change the network type in Windows 10.
1- Using Windows Settings
To change the network type using Windows Control Panel settings, follow the steps below:
- Go to Control Panel –> Network and Internet –> HomeGroup
- Click on Change Network Location link.
- This will open a charms dialog asking you “Do you want to allow your PC to be discoverable by other PCs and devices on this network”.
- Press the Yes button if you want your network to be set to Home or Work and No button if you want to be in public network.
You can configure each type of these networks in more detail by clicking on the link “Change advanced sharing settings…”.
2- Setting network type using Windows Registry
If you are an advanced user and are comfortable with editing Windows Registry, this method will be easier for you to change the network type especially when you want it to be done on multiple PCs using just a single registry file.
- Go to Run –> regedit
- Go to the following key:
HKEY_LOCAL_MACHINE –> SOFTWARE –> Microsoft –> Windows NT –> CurrentVersion –> NetworkList –> Profiles - Under the Profiles key, you will find some sub-keys with different GUIDs. This corresponds to the no. of network cards you’re using with your computer.
- Select each sub-key of the Profiles and look for the ProfileName key in the right hand pane. This will give you the name of the network so that you can easily recognize which network you want to change.
- After identifying the right sub-key, you can change the Category DWORD value in the right hand pane to change the network type of that particular network.
Value data can be 0 for Public network, 1 for Private network and 2 for Domain network.
3- Change network type using Local Security Policy
- Go to Run –> secpol.msc
- Select Network List Manager Policies. This will list all the networks in the right hand pane.
- Double click your desired network, go to Network Location tab.
- Change the Network location type to either Not configured, private or public.
- If you want to do this for all the connected networks, you can double click All Networks instead of your desired network.
4- Setting network type using PowerShell
Open PowerShell with administrative privileges
- Run the following command:
Get-NetConnectionProfile - See the network name you want to change its type and run the following command:
Set-NetConnectionProfile -Name “ITT” -NetworkCategory Public
Where ITT is the name of your network and you can change the -NetworkCategory switch value to Public or Private.
This will change the network type immediately.