Last updated on August 11, 2024
Pre-Check
OS Version
## check OS/kernel version
root@baseline:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
root@baseline:~# uname -r
6.8.0-39-generic
Bind Static IP
## modify netplan configure file
root@baseline:~# vim /etc/netplan/50-cloud-init.yaml
root@baseline:~# cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
ens160:
addresses:
- 192.168.70.5/24
routes:
- to: default
via: 192.168.70.2
nameservers:
addresses: [1.1.1.1, 8.8.8.8, 8.8.4.4]
search: [hacking-linux.com]
version: 2
## apply change
root@baseline:~# netplan apply
Evaluate
## evaluate if the IP already bind to server
root@baseline:~# netplan status
Online state: online
DNS Addresses: 127.0.0.53 (stub)
DNS Search: hacking-linux.com
● 1: lo ethernet UNKNOWN/UP (unmanaged)
MAC Address: 00:00:00:00:00:00
Addresses: 127.0.0.1/8
::1/128
● 2: ens160 ethernet UP (networkd: ens160)
MAC Address: 00:0c:29:e6:65:a7 (Intel Corporation)
Addresses: 192.168.70.5/24
fe80::20c:29ff:fee6:65a7/64 (link)
DNS Addresses: 1.1.1.1
8.8.8.8
8.8.4.4
DNS Search: hacking-linux.com
Routes: default via 192.168.70.2 (static)
192.168.70.0/24 from 192.168.70.5 (link)
fe80::/64 metric 256
root@baseline:~# ip addr list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:e6:65:a7 brd ff:ff:ff:ff:ff:ff
altname enp2s0
inet 192.168.70.5/24 brd 192.168.70.255 scope global ens160
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fee6:65a7/64 scope link
valid_lft forever preferred_lft forever
Be First to Comment