Can I assign myself any external IP address that I want? [duplicate]

TLDR: No, you can't.

If you have a static IP address from your ISP, they don't usually have a way of assigning that address to your hardware, often because they don't know what hardware you might have and they don't have the ability to change its settings. That's why they tell you what the address is and you need to assign it yourself.

However, within the ISP's network, they have to route the traffic for that address to you. Without that routing information, the traffic will never be delivered to you. While it is certainly possible that an ISP might accidentally misconfigure their systems to allow you to use an address that isn't yours, it is extremely unlikely for that to happen, since the ISP's billing and network management software keep track of address allocations.

Additionally, the address you have has to be "owned" by your ISP. If you would put in an address that belongs to a different ISP, you would not be able to use it because there is no route for the traffic to get to you.

To give an analogy, you can put up any address number on your house, but that won't make your postal carrier deliver the mail for that address to you. If your carrier is inexperienced, they might accidentally deliver your neighbor's mail to you if you change the address by only one or two digits, but an experienced and/or attentive carrier wouldn't make that mistake. Additionally, if you changed your address to say you are in an entirely different city, that doesn't magically transport mail from that city to you.


Does it mean I can go into my router and change the external IP address to any IP that I want

Yep.

and it will work?

Nope.

Without ISP having to assign it to my first?

Very nope.

Why does the ISP have to assign me an IP address?

Because:

You are on your ISPs network. Your ISP controls the router at the edge of it's network, and you need to go through this router to get to anything that's not on your ISP's network. You can't make this router do anything other than what the ISP wants without controlling its configuration.

Your ISP uses a protocol called BGP to find out the routers for other ISPs, which is controlled by backbone providers. No ISP is going to listen to BGP packets from residential addresses, but there are instances of "BGP hijacking" where a compromised ISP or a engineer mistake reroutes vast swaths of traffic due to incorrect modification of the BGP routing table.

How does this work?

ISPs typically use DHCP to assign addresses in their pool, so it works very similarly to your home router and home network. ISPs run a DHCP server on their network and hand them out using a similar process that your home router does.

From a technical point of view, what will happen if I assign myself a new static external IP address an then try to go online?

Outgoing traffic from your modem that has a source IP different than the IP address assigned to you, or the range of IP addresses your ISP owns, will likely be blocked by ISPs routers and your ISP will probably cut off service until you call them and convince them you're not hacked. Your ISP doesn't want to get in trouble with other ISPs, though some providers in lawless areas of the globe may behave differently.

If it wasn't, your IP packets would reach the destination, but they couldn't reply to you, because the destination IP address belongs to a different ISP and wouldn't route back to you. Hackers could use this to DoS/DDoS people, so you can assume any competent ISP would block it. I recommend against testing it.


When using an IP address that wasn't assigned to you, you would be doing a Spoofing attack:

In the context of information security, and especially network security, a spoofing attack is a situation in which a person or program successfully identifies as another by falsifying data, to gain an illegitimate advantage.

It depends on your ISP, but the chances are that the ISP's router will know that this IP address wasn't assigned to your line. It will probably refuse contact, and worse, may even raise the alarm for a hacking attempt, which could get you banned until you furnish an explanation.

Even when using a dynamic IP, it is the ISP that will assign it to your line and your router's MAC address, and it will accept no other IP address. So don't.