How can you prevent and detect unauthorized connections to your wifi network? What can I do as a user to protect my network?
Since the question has been changed, I decided to change the answer which I provided.
To detect unauthorized connections the web-panel on router may be your good friend. Many routers are listing the devices connected on their web panel. Some routers show DHCP table, others name it as 'connected devices' or something similar. Some routers also keep information about all devices that were ever connected (for example BT Hub 3 type A), however this is not always true. Some routers (like mine) automatically forget devices that are not connected for over a specific period of time. This table will be looking different on different routers.
(for own safety I have modified host names as well as clearly I masked MAC addresses)
On some routers you may be able to use remote
ssh to provide remote shell. This however is usually disabled by default, and some routers do not let the users to access them. If this is the case you may be able to use command
arp to list all currently connected devices.
If the router doesn't allow to list connected devices, then you may be able to use 3rd party software on your computer or phone to find connected devices. This is example of one of such software I found by using google. Please however note that I do not have previous experience with this software.
I have decided to leave the old answer as I believe that the tips given in it may be helpful in preventing unauthorized connections.
As an user you can protect your router in few different ways.
First you should always use WPA2 (which is more secure than WPA or WEP). This should be combined with a secure password, at least 10 characters preferably including capitals, numbers and special characters. The longer the password the better. This will stop people from brute-forcing your WiFi password easily. I would personally recommend changing the default WiFi password.
Secondly you should disable WPS (allows to connect to router via 8 digit code, this code can be no longer or shorter). This is because quite a lot of routers do not prevent brute-forcing of the pin codes, and other set the pin to known value. As my personal experience, I have never seen anyone actually use it for their own use, usage of normal password is more often and lots of users will not even know how to connect to WPS enabled router.
Third if your router supports MAC filtering you may enable it. This will not stop hackers getting into your network, however it will stop unskilled users who know the password. As a note here, this may become slightly issue if you want to add new device, as you need to go to router website and add the devices MAC address, in order to be able to connect with this device.
You should also try to keep all software up to date. This is to prevent software bugs for example KRACK (Key Reinstallation Attacks) was a good example. Updating all your clients as well as routers to the newest software and firmware allows to fix such bugs. However please note that flashing routers firmware may cause to brick it, if the power was lost while installation was in progress.
Also you should consider wisely who should have access to your WiFi, for example does your friend really need your WiFi password? This may be a bit controversial but at the end of the day their devices will need to store the passwords, and there are multiple ways to extract known password whatever the device used was computer or phone. At the end of the day, the way they handle their devices may also affect security of your WiFi network.
Another advice is to keep your router away from window or visible space at house. There is a possibility that someone may look at the back of the router to see the password through windows and then use your WiFi, or a guest may assume that you will be alright with him using your WiFi without your knowledge.
While this is not really prevention for unauthorized connection to WiFi, I believe it is worth to note that you should also make sure that you change default administrator password on router's web-panel (usually it is on
192.168.1.1 however this may vary).