Prerequisites
Before changing MAC address, make sure you have:
- SSH access to your VPS
- Root or sudo privileges
⚠️ Changing MAC address may cause network issues and is not supported by all VPS providers. Use only if necessary.
Step 1: Check Current MAC Address
Connect to your VPS:
ssh hxroot@YOUR_SERVER_IP -p 22
ip link show eth0
Step 2: Temporarily Change MAC Address
Bring interface down:
sudo ip link set dev eth0 down
Set new MAC (replace with desired MAC):
sudo ip link set dev eth0 address 02:01:02:03:04:05
Bring interface up:
sudo ip link set dev eth0 up
Step 3: Verify Change
ip link show eth0 | grep ether
Step 4: Make Permanent (Systemd Network)
sudo nano /etc/systemd/network/10-eth0.link
Add:
[Match]
MACAddress=old_mac_address
[Link]
MACAddressPolicy=none
MACAddress=02:01:02:03:04:05
Reboot to apply.
Alternative: Using netplan (Ubuntu)
sudo nano /etc/netplan/01-netcfg.yaml
Add:
ethernets:
eth0:
macaddress: 02:01:02:03:04:05
✅ MAC address has been changed.