• Terms and Conditions
  • Contact Us
  • About Us
Friday, December 4, 2026
  • Login
ITZNews
Advertisement
  • Home
  • News
    • All
    • Business
    • Politics
    • Science
    • World
    Electoral College Explained: How 270 Votes Work

    Electoral College Explained: How 270 Votes Work

    OpenAI London Salary: The £2.3m Average Explained

    OpenAI London Salary: The £2.3m Average Explained

    Patch Tuesday October 2026: Microsoft Updates

    Patch Tuesday October 2026: Microsoft Updates

    Unlocking the Impact of Secrets of Garlic on Heart Health

    Unlocking the Impact of Secrets of Garlic on Heart Health

    Hearing Loss and Cognitive Decline In Older Adults

    Hearing Loss and Cognitive Decline In Older Adults

    Intermittent Fasting: Benefits, Methods, and Safety

    Intermittent Fasting: Benefits, Methods, and Safety

    Trending Tags

    • Sports News
    • Best Beaches in the World
    • Millennials
    • PlayStation 6 release date
    • Creative Challenges
  • Tech
    • All
    • Apps
    • Gadget
    • Mobile
    • Startup
    WireGuard Ubuntu Setup: Build Your Own VPN Server

    WireGuard Ubuntu Setup: Build Your Own VPN Server

    Pi-hole Docker Setup: Block Ads on Every Device at Home

    Pi-hole Docker Setup: Block Ads on Every Device at Home

    Time Machine Server on Ubuntu: Back Up Your Mac

    Time Machine Server on Ubuntu: Back Up Your Mac

    Ubuntu WiFi Adapter Not Found? How to Fix It

    Ubuntu WiFi Adapter Not Found? How to Fix It

    Ubuntu Home Server Setup: A Beginner’s Guide

    Ubuntu Home Server Setup: A Beginner’s Guide

    Nextcloud Docker Install: Your Own Cloud at Home

    Nextcloud Docker Install: Your Own Cloud at Home

    Dual Boot Ubuntu and Windows 11: A Safe Guide

    Dual Boot Ubuntu and Windows 11: A Safe Guide

    SSH Key Setup: Log In Without a Password

    SSH Key Setup: Log In Without a Password

    Trending Tags

    • Technology Impact
    • Future of VR
    • Virtual Reality
    • digital transactions
    • Technology Advancements
    • digital advertising
  • Entertainment
    • All
    • Gaming
    • Movie
    • Music
    • Sports
    Avengers Doomsday vs Dune 3: The December 18 Clash

    Avengers Doomsday vs Dune 3: The December 18 Clash

    Rugby League World Cup 2026: Tonga Stun England

    Rugby League World Cup 2026: Tonga Stun England

    Revolutionizing Rhythms Through AI and Web 3.0

    Revolutionizing Rhythms Through AI and Web 3.0

    When Does The PS6 Come Out? Beyond The Powerful PS5

    When Does The PS6 Come Out? Beyond The Powerful PS5

    Top 5 Michelin Star Restaurants in Europe, a Taste of Elegance

    Top 5 Michelin Star Restaurants in Europe, a Taste of Elegance

    5 Best Beaches in the World for 2023: A Journey to Stunning Cliffs

    5 Best Beaches in the World for 2023: A Journey to Stunning Cliffs

  • Lifestyle
    • All
    • Fashion
    • Food
    • Health
    • Travel
    Creatine for Women: How Much to Take and What It Helps

    Creatine for Women: How Much to Take and What It Helps

    Magnesium for Sleep: What the Studies Really Show

    Magnesium for Sleep: What the Studies Really Show

    Intermittent Fasting Insulin Resistance: Evidence

    Intermittent Fasting Insulin Resistance: Evidence

    Walking After Eating: How It Lowers Blood Sugar

    Walking After Eating: How It Lowers Blood Sugar

    How to Reverse Insulin Resistance: The Hidden Belly Fat Connection

    How to Reverse Insulin Resistance: The Hidden Belly Fat Connection

    The Art of Ambition: Harnessing Power with Wisdom

    The Art of Ambition: Harnessing Power with Wisdom

    Trending Tags

    • Emotional Struggles
    • Mental Health
    • mental fitness
    • Best Beaches in the World
    • smartphones
    • Smartwatch for Fitness Tracking
    • artificial intelligence
  • Review
    How DeepSeek R1 Outperformed OpenAI Using 5% of the Resources

    How DeepSeek R1 Outperformed OpenAI Using 5% of the Resources

    Blood Sugar Control: Effective Ways to Manage Diabetes

    Blood Sugar Control: Effective Ways to Manage Diabetes

    The Ultimate Guide to Boosting Your Oral Health

    The Ultimate Guide to Boosting Your Oral Health

    When Does The PS6 Come Out? Beyond The Powerful PS5

    When Does The PS6 Come Out? Beyond The Powerful PS5

    Top 5 Michelin Star Restaurants in Europe, a Taste of Elegance

    Top 5 Michelin Star Restaurants in Europe, a Taste of Elegance

    The Top 5 Smartwatches of 2023: A Comprehensive Review

    The Top 5 Smartwatches of 2023: A Comprehensive Review

No Result
View All Result
  • Home
  • News
    • All
    • Business
    • Politics
    • Science
    • World
    Electoral College Explained: How 270 Votes Work

    Electoral College Explained: How 270 Votes Work

    OpenAI London Salary: The £2.3m Average Explained

    OpenAI London Salary: The £2.3m Average Explained

    Patch Tuesday October 2026: Microsoft Updates

    Patch Tuesday October 2026: Microsoft Updates

    Unlocking the Impact of Secrets of Garlic on Heart Health

    Unlocking the Impact of Secrets of Garlic on Heart Health

    Hearing Loss and Cognitive Decline In Older Adults

    Hearing Loss and Cognitive Decline In Older Adults

    Intermittent Fasting: Benefits, Methods, and Safety

    Intermittent Fasting: Benefits, Methods, and Safety

    Trending Tags

    • Sports News
    • Best Beaches in the World
    • Millennials
    • PlayStation 6 release date
    • Creative Challenges
  • Tech
    • All
    • Apps
    • Gadget
    • Mobile
    • Startup
    WireGuard Ubuntu Setup: Build Your Own VPN Server

    WireGuard Ubuntu Setup: Build Your Own VPN Server

    Pi-hole Docker Setup: Block Ads on Every Device at Home

    Pi-hole Docker Setup: Block Ads on Every Device at Home

    Time Machine Server on Ubuntu: Back Up Your Mac

    Time Machine Server on Ubuntu: Back Up Your Mac

    Ubuntu WiFi Adapter Not Found? How to Fix It

    Ubuntu WiFi Adapter Not Found? How to Fix It

    Ubuntu Home Server Setup: A Beginner’s Guide

    Ubuntu Home Server Setup: A Beginner’s Guide

    Nextcloud Docker Install: Your Own Cloud at Home

    Nextcloud Docker Install: Your Own Cloud at Home

    Dual Boot Ubuntu and Windows 11: A Safe Guide

    Dual Boot Ubuntu and Windows 11: A Safe Guide

    SSH Key Setup: Log In Without a Password

    SSH Key Setup: Log In Without a Password

    Trending Tags

    • Technology Impact
    • Future of VR
    • Virtual Reality
    • digital transactions
    • Technology Advancements
    • digital advertising
  • Entertainment
    • All
    • Gaming
    • Movie
    • Music
    • Sports
    Avengers Doomsday vs Dune 3: The December 18 Clash

    Avengers Doomsday vs Dune 3: The December 18 Clash

    Rugby League World Cup 2026: Tonga Stun England

    Rugby League World Cup 2026: Tonga Stun England

    Revolutionizing Rhythms Through AI and Web 3.0

    Revolutionizing Rhythms Through AI and Web 3.0

    When Does The PS6 Come Out? Beyond The Powerful PS5

    When Does The PS6 Come Out? Beyond The Powerful PS5

    Top 5 Michelin Star Restaurants in Europe, a Taste of Elegance

    Top 5 Michelin Star Restaurants in Europe, a Taste of Elegance

    5 Best Beaches in the World for 2023: A Journey to Stunning Cliffs

    5 Best Beaches in the World for 2023: A Journey to Stunning Cliffs

  • Lifestyle
    • All
    • Fashion
    • Food
    • Health
    • Travel
    Creatine for Women: How Much to Take and What It Helps

    Creatine for Women: How Much to Take and What It Helps

    Magnesium for Sleep: What the Studies Really Show

    Magnesium for Sleep: What the Studies Really Show

    Intermittent Fasting Insulin Resistance: Evidence

    Intermittent Fasting Insulin Resistance: Evidence

    Walking After Eating: How It Lowers Blood Sugar

    Walking After Eating: How It Lowers Blood Sugar

    How to Reverse Insulin Resistance: The Hidden Belly Fat Connection

    How to Reverse Insulin Resistance: The Hidden Belly Fat Connection

    The Art of Ambition: Harnessing Power with Wisdom

    The Art of Ambition: Harnessing Power with Wisdom

    Trending Tags

    • Emotional Struggles
    • Mental Health
    • mental fitness
    • Best Beaches in the World
    • smartphones
    • Smartwatch for Fitness Tracking
    • artificial intelligence
  • Review
    How DeepSeek R1 Outperformed OpenAI Using 5% of the Resources

    How DeepSeek R1 Outperformed OpenAI Using 5% of the Resources

    Blood Sugar Control: Effective Ways to Manage Diabetes

    Blood Sugar Control: Effective Ways to Manage Diabetes

    The Ultimate Guide to Boosting Your Oral Health

    The Ultimate Guide to Boosting Your Oral Health

    When Does The PS6 Come Out? Beyond The Powerful PS5

    When Does The PS6 Come Out? Beyond The Powerful PS5

    Top 5 Michelin Star Restaurants in Europe, a Taste of Elegance

    Top 5 Michelin Star Restaurants in Europe, a Taste of Elegance

    The Top 5 Smartwatches of 2023: A Comprehensive Review

    The Top 5 Smartwatches of 2023: A Comprehensive Review

No Result
View All Result
ITZNews
No Result
View All Result
Home Tech

WireGuard Ubuntu Setup: Build Your Own VPN Server

Admin by Admin
December 4, 2026
in Tech
0
WireGuard Ubuntu Setup: Build Your Own VPN Server

A locked laptop. Photo: Santeri Viinamäki, CC BY-SA 4.0

0
SHARES
0
VIEWS
Share on FacebookShare on Twitter

A WireGuard Ubuntu setup turns a small server into your own private VPN. A VPN is a locked tunnel between two devices, so nobody in the middle can read your data. Imagine Maya, who sits in a busy cafe. She needs a document from her home computer. The cafe Wi-Fi is open to everyone, so she does not trust it. She wants a private path back home, and she wants it today.

WireGuard is a good fit. It stays quiet and only sends packets when a peer has data, as the WireGuard quickstart explains. A peer is one device in the tunnel, such as your phone or your server. The tool is small, so the steps are short. But one wrong move on a remote machine can lock you out.

So this guide puts a “Did it work?” check after each step. You also keep a second terminal and a root console open. We checked each command against the official server documentation.

Contents

Toggle
  • WireGuard Ubuntu basics and what you need first
  • Install WireGuard on Ubuntu and make the keys
  • Create the WireGuard config and open the firewall
  • Start the server and add your devices
  • Check that your WireGuard Ubuntu tunnel works
  • Your WireGuard Ubuntu tunnel is ready

WireGuard Ubuntu basics and what you need first

Cafe visitor with a phone and laptop, the setting where a WireGuard Ubuntu VPN protects you on public Wi-Fi
Public Wi-Fi is where a VPN helps most. Photo: Shixart1985, CC BY 2.0

Think of the setup as a private tunnel under a busy street. Each device in the tunnel is a peer, and each peer owns a keypair. A keypair is one private secret and one public partner. You share the public part freely, but you never share the private part. It works like a house key and a lock. Anyone may look at the lock, but only you carry the key.

Before you start, gather four things:

  • A server you control, such as a cheap VPS or a spare machine at home.
  • A user account that can run sudo.
  • One UDP port you can open. This guide uses 51820 and the 10.8.0.0/24 range as examples.
  • A second terminal window, so you can test without closing your first session.

If the server sits at home, your router must forward that UDP port to it. No home machine yet? Then set up a home server first and come back.

Install WireGuard on Ubuntu and make the keys

Tangled network cables in a server rack, the kind of machine room that can host a VPN server
Servers sit at the heart of every VPN. Photo: Kim Scarborough, CC BY-SA 2.0

Sign in to your server. If you have not done that safely yet, learn to log in with SSH keys first, because a password login is the weak spot. Installing takes two short commands:

sudo apt update
sudo apt install wireguard

Did it work? Ask the shell where the tool lives:

command -v wg

If you see a path, the tool is ready. If you see nothing, read the last lines of the apt output for an error. For other systems, the official install page lists the right command.

Keychain that reads Encryption is key, a nod to the WireGuard Ubuntu key pair
Every WireGuard peer needs its own key pair. Photo: Rohini, CC BY-SA 4.0

Next, make the server’s keypair. Open a root shell, move to the WireGuard folder and set umask 077. That makes each new file readable by you alone, like a drawer that locks itself.

sudo -i
cd /etc/wireguard
umask 077
wg genkey | tee server.priv | wg pubkey > server.pub

The last line makes the private half, saves it, and then builds the public half from it. Did it work? Run cat server.pub and you should see one short line of text. Copy it into a note, because your devices will need it. Never share server.priv, and never post it anywhere.

Create the WireGuard config and open the firewall

Your WireGuard Ubuntu server reads one small file, /etc/wireguard/wg0.conf. Open it with nano, paste these lines and swap in your private key:

[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = PASTE-SERVER-PRIVATE-HERE
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

Address gives the server its place inside the tunnel. ListenPort is the door your devices knock on. The PostUp and PostDown lines switch on NAT when the tunnel goes up and off when it goes down. Match eth0 to your real network card, shown by ip route. Then lock the file:

chmod 600 /etc/wireguard/*.conf
exit

A VPN server must also pass traffic on to the internet, like a post office that sorts mail for other towns. So turn on forwarding and make it stay on after a reboot:

sudo sysctl -w net.ipv4.ip_forward=1
echo "net.ipv4.ip_forward=1" | sudo tee /etc/sysctl.d/99-wireguard.conf

Did it work? Run cat /proc/sys/net/ipv4/ip_forward, and the answer should be 1. Now open the door. Beginners often lock themselves out here, so allow your SSH port first:

sudo ufw allow 22/tcp
sudo ufw allow 51820/udp
sudo ufw status

Test from your second terminal before you close the first one. Your host’s own panel firewall needs the same UDP rule.

Start the server and add your devices

One command starts your WireGuard Ubuntu server now and at each reboot:

sudo systemctl enable --now wg-quick@wg0

Did it work? Run sudo wg show. You should see your port and public key, with no peers yet. If it fails, look for a typo in the config.

Each client needs its own keypair, made the same way. Then give Maya’s laptop a config like this:

[Interface]
Address = 10.8.0.2/24
PrivateKey = PASTE-LAPTOP-PRIVATE-HERE

[Peer]
PublicKey = PASTE-SERVER-PUBLIC-HERE
Endpoint = YOUR-SERVER-IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25

AllowedIPs decides which traffic uses the tunnel. The value 0.0.0.0/0 sends everything, which hides your traffic on public Wi-Fi. Use 10.8.0.0/24 to send only home traffic.

Now add the laptop to the server’s file, then restart the service:

[Peer]
PublicKey = PASTE-LAPTOP-PUBLIC-HERE
AllowedIPs = 10.8.0.2/32

For an Android phone, install the WireGuard app. Then show the client config as a QR code on the server and scan it. Clear your screen afterwards.

sudo apt install qrencode
qrencode -t ansiutf8 < client.conf

On Windows, import the same text into the official app. Want no open port at all? Then try Tailscale, which needs no port forwarding.

Check that your WireGuard Ubuntu tunnel works

Bring the tunnel up on the laptop. Then run sudo wg show on the server. A working peer shows a latest handshake line. That is the moment the two devices say hello. The troubleshooting guide adds a trick: run watch wg for live status. Next, ping the server through the tunnel:

ping -c 3 10.8.0.1

Replies mean the tunnel carries data. Last, search for “what is my IP” in a browser. With the full tunnel, you should see your server’s address, not the cafe’s.

If the handshake never appears, go down this list and test after each fix:

  • Each side keeps its own private key and holds the other side’s public key.
  • AllowedIPs match on all peers, because a wrong range drops traffic silently.
  • Forwarding is on, and it stays on after a reboot.
  • The UDP port is open in your host’s cloud panel or your home router.
  • The card name in PostUp matches the real one, such as enp3s0.

A missing handshake points at keys, ports or the firewall. A handshake with no ping points at addresses or forwarding.

Your WireGuard Ubuntu tunnel is ready

Back in the cafe, Maya taps one switch on her phone, and the tunnel wakes up. Seconds later she opens the home document she needed. The cafe Wi-Fi did not change, but the road between her and home is now a private tunnel.

That is the quiet power of your own server. You installed one package, made a keypair, wrote a short config and opened one port. Keep that habit: change one thing, check it, and then move on.

One honest note. A VPN does not make you anonymous. It moves your trust from the cafe to the company that hosts your server, so pick that host with care.

Next, set up each device you own and give each one its own address in the 10.8.0.0/24 range. Save a copy of your config somewhere safe, away from the server. Then your WireGuard Ubuntu tunnel is ready for any public place.

Frequently Asked Questions

Is WireGuard free?

The steps in this guide use only apt and the wg tools, and none of them asks you to pay for software. A VPS or a home server may still cost money.

How do I restart WireGuard?

Run sudo systemctl restart wg-quick@wg0.

How do I uninstall WireGuard?

Stop and disable the service the same way you started it, using disable instead of enable. Then run sudo apt remove wireguard.

Which port does WireGuard use?

The ListenPort line in the config sets it. This guide uses 51820 over UDP as an example, and any port works if the firewall matches.

Tags: linux networkingself-hostingubuntu servervpnwireguard
Previous Post

Pi-hole Docker Setup: Block Ads on Every Device at Home

Stay Connected test

  • 24k Followers
  • 99 Subscribers
  • Trending
  • Comments
  • Latest
Meet the Immortal Jellyfish: a Lifetime Creature

Meet the Immortal Jellyfish: a Lifetime Creature

August 30, 2023
Quality Writing Process: Student Ultimate Guide

Quality Writing Process: Student Ultimate Guide

September 3, 2023
The War in Ukraine:  What You Need to Know in  2022

The War in Ukraine: What You Need to Know in 2022

August 17, 2023
5 Ways Your Dog Can Tell You are Getting Sick

5 Ways Your Dog Can Tell You are Getting Sick

August 30, 2023
Arsenal news: Mikel Arteta slammed for Man Utd decision as Nuno Tavares vents frustration

Arsenal news: Mikel Arteta slammed for Man Utd decision as Nuno Tavares vents frustration

29
African Buffaloes: How They protect Themselves from Lions

African Buffaloes: How They protect Themselves from Lions

18
Top 10 signings of the 2022 summer transfer window: Players; stats, transfer fee

Top 10 signings of the 2022 summer transfer window: Players; stats, transfer fee

5
Meet the Immortal Jellyfish: a Lifetime Creature

Meet the Immortal Jellyfish: a Lifetime Creature

2
WireGuard Ubuntu Setup: Build Your Own VPN Server

WireGuard Ubuntu Setup: Build Your Own VPN Server

December 4, 2026
Pi-hole Docker Setup: Block Ads on Every Device at Home

Pi-hole Docker Setup: Block Ads on Every Device at Home

December 2, 2026
Creatine for Women: How Much to Take and What It Helps

Creatine for Women: How Much to Take and What It Helps

November 27, 2026
Electoral College Explained: How 270 Votes Work

Electoral College Explained: How 270 Votes Work

November 25, 2026

Recent News

WireGuard Ubuntu Setup: Build Your Own VPN Server

WireGuard Ubuntu Setup: Build Your Own VPN Server

December 4, 2026
Pi-hole Docker Setup: Block Ads on Every Device at Home

Pi-hole Docker Setup: Block Ads on Every Device at Home

December 2, 2026
Creatine for Women: How Much to Take and What It Helps

Creatine for Women: How Much to Take and What It Helps

November 27, 2026
Electoral College Explained: How 270 Votes Work

Electoral College Explained: How 270 Votes Work

November 25, 2026
logo_darkmode-

Discover Itznews: your trusted source for timely news, insightful blogs, and compelling magazines. Experience news insights tailored for the curious mind, all at your fingertips.

Follow Us

Browse by Category

  • Apps
  • Business
  • Entertainment
  • Fashion
  • Food
  • Gadget
  • Gaming
  • Health
  • Lifestyle
  • Mobile
  • Movie
  • Music
  • News
  • Politics
  • Relationship
  • Review
  • Science
  • Sports
  • Startup
  • Tech
  • Travel
  • World

Recent News

WireGuard Ubuntu Setup: Build Your Own VPN Server

WireGuard Ubuntu Setup: Build Your Own VPN Server

December 4, 2026
Pi-hole Docker Setup: Block Ads on Every Device at Home

Pi-hole Docker Setup: Block Ads on Every Device at Home

December 2, 2026
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2023 Itznews - Premium Worldwide News & Magazine by Itznews.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • Home
  • Entertainment
  • Lifestyle
  • Relationship
  • Review
  • Tech
  • About Us
  • Contact Us

© 2023 Itznews - Premium Worldwide News & Magazine by Itznews.