You are about 49% right. There is not much preventing you from using an arbitrary IP address. This can be done like this:
ifconfig eth0 99.99.99.99 up
(this appears to be a not actually used, but public address owned by AT&T, so please don't try this at home).
The first problem is to connect your host to the Internet. In my home my router provides 192.168.178.1
as the gateway to the Internet (the actual address the router of your ISP may vary). You have to send your packets to this address, since there's no other way to the Internet. Unfortunately, this gateway only accepts packets from 192.168.178/24
, which 99.99.99.99
is not part of.
That's the first 1% of the problem you might face. With some manual routing table tweaking you may overcome this by persuading your network to send your packets to this gateway anyway.
Once you overcome this first obstacle, your packets will probably (with some luck) actually reach their final destination and will be processed there. A great share of layer 4 protocols in the Internet are TCP connections, though. They require the famous 3-way-handshake: So after the first SYN
packet reached its destination the target host responds with a SYN|ACK
package and sends it to the sender's address, which is 99.99.99.99
.
Now your packet has to deal with the real 50% challenge: How to find its way home? Unfortunately you have told no one except yourself that you expect 99.99.99.99
to be delivered to your own host. And that is the main problem you have.
You may argue now, "Why can't I tell the Internet that I now have 99.99.99.99 on my computer?". Well actually, you could. You had to find a way for distributing this information to virtually the whole Internet (or at least all public Internet routers). Fortunately there is a means to do so. That's what we call BGP. It is run by a community of big boys that take care that a few rules are obeyed. This is more or less what we know as "buying and registering official IP addresses".
With some effort you could try and succeed to become one of the big boys and eventually become part of the community that runs the BGP infrastructure. If you managed to do so, you could actually tell the global BGP network to route 99.99.99.99 to your home. If you did so, you would have been expelled pretty quickly from that club, though, I dare to predict.
The short version of your question is it is easy to pretend you own a public IP address, but virtually nobody would take you seriously.