Operations 5 min read

Linux Network Configuration and Secure Remote Access: IP, Netplan, SSH, and UFW

This guide walks through checking Linux network status with the ip and ping commands, setting a static IP using Netplan, installing and using SSH for secure remote login (including key‑based authentication), transferring files with scp, and configuring the uncomplicated firewall (UFW) while avoiding common pitfalls.

Ubuntu
Ubuntu
Ubuntu
Linux Network Configuration and Secure Remote Access: IP, Netplan, SSH, and UFW

1. View Network Status

ip command

The legacy ifconfig tool has been superseded; the modern ip utility is now standard for network inspection.

ip addr    # view IP addresses
ip route   # view gateway/route table

ping

Use ping to test network connectivity. ping baidu.com If a domain name fails to ping but its IP (e.g., 1.1.1.1) responds, the issue is typically DNS.

2. Configure IP Address (Netplan)

Ubuntu manages network settings with Netplan . Configuration files reside in /etc/netplan/, commonly named 01-netcfg.yaml.

Static IP example:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: no
      addresses:
        - 192.168.1.100/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

Apply the changes with: sudo netplan apply Desktop users typically configure the network via Settings → Network, avoiding manual file edits.

3. SSH Remote Login

SSH (Secure Shell) is the standard for Linux remote management.

Install SSH Server: sudo apt install openssh-server Check service status: sudo systemctl status ssh Connect from another machine: ssh [email protected] Using key‑based authentication (as described in the SSH Key chapter) is recommended for long‑term remote management because it is more secure and eliminates password entry.

4. File Transfer (SCP)

SSH includes built‑in file transfer capabilities, removing the need for FTP.

Upload: scp local_file.txt user@remote_ip:/home/user/ Download:

scp user@remote_ip:/home/user/remote_file.txt .

5. Firewall (UFW)

Ubuntu ships with UFW (Uncomplicated Firewall), which is straightforward to use.

sudo ufw enable          # enable firewall
sudo ufw allow ssh       # allow SSH (port 22)
sudo ufw allow 80/tcp   # allow HTTP
sudo ufw status          # view status

Note: Ensure allow ssh is configured before enabling the firewall, or you may lock yourself out of the server.

If you only want LAN access to SSH, use a more restrictive rule:

sudo ufw allow from 192.168.1.0/24 to any port 22 proto tcp
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

NetworkLinuxSSHSCPUFWNetplan
Ubuntu
Written by

Ubuntu

Focused on Ubuntu/Linux tech sharing, offering the latest news, practical tools, beginner tutorials, and problem solutions. Connecting open-source enthusiasts to build a Linux learning community. Join our QQ group or channel for discussion!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.