Common networking tasks
Changing your VPS hostname
Setting a descriptive hostname helps identify your server on the network. To change it:
- Edit
/etc/hostnamewith your desired name:sudo nano /etc/hostname - Update
/etc/hoststo map the new hostname to127.0.1.1:
127.0.0.1 localhost 127.0.1.1 my-vps.example.com my-vps
- Apply the change with
sudo hostnamectl set-hostname my-vps.example.comand log out/in.
Checking network connectivity
If you experience connectivity issues, these commands can help diagnose problems:
ping 8.8.8.8– verify the VPS can reach the internet.ping your-server– test if a remote host is reachable.traceroute example.com(install viaapt install traceroute) – see the path packets take.ip addrorip a– view assigned IP addresses and interface status.ip route– check default gateway and routing table.
Restarting network services
After making changes to network settings (for example, adding an IP address or updating DNS), you may need to restart the networking service:
- On systems using systemd-networkd:
sudo systemctl restart systemd-networkd. - On Ubuntu/Debian with netplan: apply changes with
sudo netplan apply. - On CentOS/AlmaLinux with NetworkManager:
sudo systemctl restart NetworkManageror reload a connection withnmcli connection reload.
Adding an additional IP address
If you have purchased an extra IP, you can assign it without rebooting:
- Identify your network interface (usually
eth0orens18) withip link. - Add the IP temporarily using:
sudo ip addr add 203.0.113.2/32 dev eth0. - To make the address persistent, edit your network configuration file (e.g.,
/etc/netplan/*.yamlor/etc/sysconfig/network-scripts/ifcfg-eth0) and add the new IP details, then restart networking. - Update your DNS A record to point the new IP if it will be used for websites or services.
Running a speed test
To gauge your VPS’s network performance:
- Install
iperf3on both client and server to measure throughput:sudo apt install iperf3; runiperf3 -son a remote server andiperf3 -c server_ipfrom your VPS. - For a quick test against a public service, install
speedtest-cli(pip install speedtest-cli) and runspeedtest.
Changing DNS resolvers
If your VPS cannot resolve domain names, change your DNS servers:
- Edit
/etc/resolv.confand add nameservers:
nameserver 213.186.33.99
nameserver 1.1.1.1
nameserver 8.8.8.8
- On systems using
systemd-resolved, create or edit/etc/systemd/resolved.conf, setDNS=1.1.1.1 8.8.8.8, then runsudo systemctl restart systemd-resolved.
For help with advanced networking (GRE tunnels, BGP sessions, etc.), please open a support ticket.