Volg deze stappen om een nieuw IP-adres toe te voegen aan uw Ubuntu-server:
- Identificeer uw netwerkinterface:
- Vervang indien nodig
eth1dooreth0en noteer het resultaat.
- Vervang indien nodig
- Bewerk het Netplan Configuratiebestand:
- Zoek of maak de sectie voor uw interface, meestal onder
[eth0].
- Zoek of maak de sectie voor uw interface, meestal onder
- Voeg uw IP-adres toe:
- Kopieer het opgegeven IP-adres in het formaat
AA.BB.CC.DD/XX(bijvoorbeeld192.168.1.1/24) en neem het op in de juiste configuratie:
- Kopieer het opgegeven IP-adres in het formaat
Zodra u uw interface kent (bijvoorbeeld eth0), opent u het bijbehorende netplan-bestand met behulp van een teksteditor:
sudo nano /etc/netplan/50-netplan.conf
Bepaal of uw hoofdnetwerkinterface eth0 of eth1 is door het volgende uit te voeren:
grep eth1 /etc/netplan/* -H
netwerk: eth0: stel fysiek in stel adres in op XX.XX.XX.XX/JJ
4. **Apply Changes:**
- Apply the updated configuration with:
```bash
sudo netplan toepassen
Open a new terminal and test the IP by pinging it:
ping 192.168.1.1
5. **Troubleshooting:**
- If the ping fails, wait up to 30 seconds for netplan to revert changes if necessary.
- Ensure correct syntax and permissions in the netplan file.
