The better solution is for Northern Ireland to remain in the European Union, which it voted to do, and the border of non-EU land to be on the British mainland. This would effectively create a united Ireland, though sovereignty could be shared between London and Dublin, as discussed here.
Scotland also voted to remain in the European Union. The Scottish government asked the government in London for a flexible approach to Brexit which would allow Scotland to remain in the EU but that was rejected. A consequent vote of the Scottish Parliament for a new independence referendum has been stalled; PM Theresa May says “Now is not the time” and won’t discuss a date.
Scotland is not Catalonia: it was joined to England in 1707 by the Treaty of Union which was voted on by the Scottish Parliament. It has had centuries of nationhood, with a system of government, its own law, its own Church. The British royal family acceded to the throne through its connection to the unbroken 1000-year line of Stuart kings of Scotland. Scotland has a devolved Parliament which has voted for a referendum. If stonewalling by London continues, Edinburgh may well have a legal and democratic case for calling a referendum on its own behalf which could lead to a unilateral declaration of independence.
One thing is certain, the Scottish Parliament is unlikely to accede indefinitely to London’s requests to put a (sweaty) sock in it.
Gibraltar also voted – almost to a man and woman – to remain in the European Union. Until Spain joined the EU in 1985, there was a gated border on the rock, but Spain opened this under the freedom of movement rules within the European Union. Since then, there has been free movement across the border. But If Gibralter leaves the EU as part of the UK, the bilateral conflict with Spain over its sovereignty obviously re-emerges. The border could end up being closed again. English politicians’ sabre-rattling over this recently was an example of how dangerous this could be.
It makes much more sense for Gibraltar to remain in the EU. Potentially, of course, Gibraltar could be managed by an independent Scotland which remains an EU member.