Setting IP address to Static

I found this code snippet for the command prompt online

netsh interface ip set address ”(your connection name)” static 192.168.0.1 255.255.255.0 192.168.0.254

and when i hit enter, there are no errors in the console. However, i am still connected to the network, yet i have no internet access. when i open up internet explorer it says that it cannot display the webpage.

I have found this code snippet everywhere on the internet. I know that the syntax is correct. So what is going wrong?

Yes, explaining this would require pages of explanation on how a network works.

Shortest version: Don’t try to understand what you don’t know and don’t use the script. It’s a case of monkeys with guns.

Short version: You overwrite your external IP from the DHCP connecting you to the WAN with a static internal IP connecting you to the LAN.

As I assume you want a static IP from the outside. No. You want to ask… No! :stuck_out_tongue:
The IP pool is limited, that’s why port-forwarding was introduced and your ISP will use a lorry to drive away the money you pay for a static IP lease - usually only offered for business plans.

I’d recommend to create an account on dyndns.org, basic account is free and it has scripts supported by Windows, OSX and Linux as well as most routers already support it OOTB.

It updates your current external IP to a hostname of your choosing, like http://goshfather.dyndns.org and redirects all DNS calls to this URL to your external IP. If you run any services you want accessible from the WAN you have to forward the correct ports to it.

Since you’re using 192.168.* addresses, I’m assuming you just want a static address within your own network and aren’t trying to have a static external address.

Also assuming your info is correct (like the gateway address, subnet, etc.) - what is likely happening is that when you get your new static address and are no longer using DHCP, your machine is not configured to resolve DNS any more (as it gets DNS server info from the DHCP). That would be consistent with you showing as connected, but not resolving any web addresses.

You’ll have to manually set the DNS servers so your machine knows how to resolve addresses.

OR

An alternate option would be to have your router hand out “static” addresses via DHCP. Most of the routers I’ve seen can do this. You can tell it to always assign a specific IP address to a specific network adapter (identified by its MAC address). This will allow you to stay configured with DHCP, still get DNS automatically from the DHCP server, but have a locally “static” address on your network in the event you want to run servers, etc. This is especially good for laptops (machines that join various networks routinely(, as you typically never need to change your networking settings - you just always stay DHCP - but still get a (mostly) static address on your own network.

(Different routers will call this by different terms in their control panels. Look for address reservation, static DHCP, IP address affinity, etc.)

Was this command recommended to be used?

It sounds like pressing <alt+F4> to solve browser problems on Windows.

Have you tried “netsh -?” first?

thanks. So by setting a new ip address via the command prompt…also changes my WAN address? So does doing this affect my routers ip address?

your first statement hit the nail on the head…And to my knowledge now, I can set my internal address to static with the command prompt…but if i want to change my wan address, i have to contact my isp right?

yes I have found this code snippet everywhere.

You can “soft set” your home network IP to something specific by changing connection settings (assuming you’re on Windows its connection properties -> TCP/IP properties -> etc.) not to get IP from DHCP but rather specifying your own IP. Or many routers even have option to enable static IP on certain MAC address. This depends on which router you have.

Thanks for sharing…

hybrid network