set static ip

main
Yik Teng Hie 3 years ago
parent 339f9c0fc4
commit 2663744238

@ -25,3 +25,48 @@ $ sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
# resize filesystem
$ sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
```
## Set static IP
- [Reference](https://learnubuntu.com/set-static-ip)
```bash
# check cloud-init if disable / present
$ apt-cache pkgnames | grep cloud-init
# edit the file to disable clound-init
$ sudo nano /etc/cloud/cloud.cfg.d/99-disable-cloud-init.cfg
$ sudo reboot
```
```txt
network: {config: disabled}
```
- update the file
```bash
$ /etc/netplan/00-installer-config.yaml
```
```txt
network:
ethernets:
enp1s0:
dhcp4: no
addresses:
- 10.0.0.129/24
gateway4: 10.0.0.2
nameservers:
addresses: [8.8.8.8, 10.0.0.2]
version: 2
```
```bash
# apply the new ip config
$ sudo netplan apply
# wait a few seconds, check the updated IP
$ hostname -I
```
Loading…
Cancel
Save