• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

wg Command Examples in Linux

by Deepika

WireGuard is a modern and lightweight VPN (Virtual Private Network) protocol that aims to provide better security and performance than traditional VPN protocols such as OpenVPN and IPsec. It uses state-of-the-art cryptography and is designed to be fast, simple, and easy to use.

The “wg” command-line tool is used to manage the configuration of WireGuard interfaces. It allows you to create and configure WireGuard tunnels, add and remove peers (i.e., other devices or networks that you want to connect to), and set various parameters such as IP addresses, port numbers, and cryptographic keys.

With the “wg” tool, you can easily set up a secure and fast VPN connection between two or more devices or networks. For example, you can use WireGuard to connect your laptop or mobile device to your home network, so that you can access your files, printers, and other resources remotely, or to connect two remote networks together to share resources and collaborate more effectively.

The WireGuard protocol is supported by a wide range of platforms, including Linux, Windows, macOS, iOS, Android, and even some routers and NAS devices. Its simplicity and high performance make it an attractive option for anyone who needs to set up a VPN quickly and easily without sacrificing security or speed.

To get started with WireGuard, you can follow the Quick Start guide on the WireGuard website, which provides step-by-step instructions for setting up a basic WireGuard configuration on Linux.

wg Command Examples

1. Check status of currently active interfaces:

# wg

2. Generate a new private key:

# wg genkey

3. Generate a public key from a private key:

# wg pubkey  path/to/public_key

4. Generate a public and private key:

# wg genkey | tee path/to/private_key | wg pubkey > path/to/public_key

5. Show the current configuration of a wireguard interface:

# wg showconf wg0

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to log all LVM commands
  2. cryptcat: command not found
  3. CentOS / RHEL : Exclusion with Yum For Kernel Updates
  4. CentOS / RHEL 6 : How to password-protect single user mode
  5. apache2ctl Command Examples in Linux
  6. boltctl: command not found
  7. Failed to start LSB: Bring up/down networking – On restarting network service CentOS/RHEL (DHCP client)
  8. How to Count lines in a file in UNIX/Linux
  9. playerctl Command Examples in Linux
  10. Difference between absolute and relative paths in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright