If you do ip addr list dev eth2
after your two add
commands, you will see something like this (emphasis mine):
2: eth2: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.1/24 brd 192.168.1.255 scope global eth2
inet 1.1.1.1/24 scope global eth2
inet 1.1.1.2/24 scope global secondary eth2
The important part to notice is that Linux treats the second address as secondary to the first one, as they are in the same logical subnet (/24). Deleting the secondary address has no impact on the primary one, but vice versa.
If you need to add/del addresses in 1.1.1.0/24, you probably should first add one address which is always valid (e.g. 1.1.1.99/24) and then add 1.1.1.1 and 1.1.1.2 as secondary addresses. Then you can add/delete the .1 and .2 address at will.
If this is not possible, then you can also temporarily add 1.1.1.2/32 before deleting 1.1.1.1. This will maintain connectivity for all connections from outside your network. Depending on your network setup (i.e., whether your router supports proxy ARP), you may also be able to use 1.1.1.2/0 temporarily.