Build a network before you start freelancing
Before you start freelancing, you have to have a network. Getting clients is hard, but it is much harder if you have no referrals and don't know anyone who has the power to hire you. So, how do you build it?
In my career, I worked as a project manager in a consultancy. This job brought me in contact with clients directly, and I was able to build trust with them over a while and in a safe environment. If you are working in an agency, make sure to get in touch with clients regularly. As a developer, designer, SEO marketer, or another role that your boss hides from the client, make sure you get invited into meetings and learn everything about your clients. What are they trying to accomplish? What is your role in that project? Can you contribute something to their goal that goes beyond your current position?
Make an impression
I have been in many meetings where the client was leading the meeting. They instructed the agency what to do and how to do it–the only job of the agency was to build things, and we were their technical supplier without a stake in the project itself. Many agencies still work like that, but I don't think that you should go for this position. In this position, you are easily replaceable because you deliver something and don't use your industry expertise to advise the client.
Your client is hiring you because you have expertise in an area that they don't have. You are the expert, and they want to use your knowledge to reach a goal.
If you know their goal, you can bring your skills to the table and provide better solutions to their problem. Your job is to use your expertise and question all their ideas. Please don't do that instantly, but every time you have an idea that solves a problem faster (so it saves money) or better (so that it makes money), bring that to the table. After a while, they won't treat you as a "developer" or "designer" anymore but as a consultant with unique ideas. In this position, you are a relevant contact of their network because you make (or save) money instead of being a cost.
Consultant? I'm a developer!
Of course, but every job in your life as a freelancer will start with consulting. This is part of the process, and if you don't want to do it, you will have a hard time finding clients who stick.
Using your network
Connecting with clients of your current employer doesn't mean that you can take the clients with you when you start with freelancing, and it wouldn't be the best move at all. But it's very likely that some contacts, who are in your network, leave the client of your employer and start a new job somewhere else. Regular job changes happen to contacts on the management level quite often, and these are the contacts you need. These are the people who have the power to hire you as freelancer. If you get a LinkedIn notification that they changed their job, get in touch with them and meet. Don't start by selling your expertise but by asking questions. Why did they leave their previous job, and why are they going for the new one? What is their role, and what are the biggest challenges that they want to solve? Is there anything in these answers that you can solve? If yes, that could be your next project.
A network of peers
Going to conferences and meetups is an essential part of building your network. The downside is that it's harder to get work from these contacts because they are your peers and rarely have the direct need to hire you.
Maintain your network
For me, the hardest part is maintaining my professional network. I'm not even good at this with my friends–if my wife wouldn't be pushing me, I'd see them very rarely.
Maintaining a network is part of your job as a freelancer, and you have to keep that in mind. You don't get requests for work if people don't know you or if they forgot what you could offer. With every finished project, you get more experienced, and your network needs to know about this. Stay connected, and if there is something that you can share with them–do it. If you are in a healthy relationship with your clients and they don't treat you as the technical supplier only, they are interested in the things you are doing and like to stay connected, too.