Setting ip Static Ubuntu 20.04 LTS Server: Difference between revisions

From AbahDoku Wiki
Created page with "Login ke Server via ssh ssh root@10.10.10.123 =======> (contoh ip server masih dinamis) Jika muncul seperti ini : The authenticity of host '10.20.30.123 (10.20.30.123)' can't be established. ECDSA key fingerprint is SHA256:mRHmQmfcwAjDpTIKO7UfwkeULPUvpJdXLQWMcSF/HRA. Are you sure you want to continue connecting (yes/no)? Ketik yes <enter> akan muncul : Warning: Permanently added '10.10.10.123' (ECDSA) to the list of known hosts. Masukkan password"
 
m 6 revisions imported
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
Login ke Server via ssh
Cek ip server :
ssh root@10.10.10.123 =======> (contoh ip server masih dinamis)
  ip a
Jika muncul seperti ini :
  The authenticity of host '10.20.30.123 (10.20.30.123)' can't be established.
ECDSA key fingerprint is SHA256:mRHmQmfcwAjDpTIKO7UfwkeULPUvpJdXLQWMcSF/HRA.
Are you sure you want to continue connecting (yes/no)?
   
   
  Ketik yes <enter>
  akan tampil seperti ini : (CONTOH)
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
      valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:1d:97:b5:fa:08 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.123/24 brd 10.10.10.255 scope global dynamic enp1s0
      valid_lft 429sec preferred_lft 429sec
    inet6 fe80::21d:97ff:feb5:fa08/64 scope link
      valid_lft forever preferred_lft forever
 
Terlihat bahwa adapter yang digunakan adalah enp1s0 dengan ip dinamis 10.10.10.123 (untuk pc/server lain mungkin akan berbeda adapter dan ip-nya).
 
Command lain seperti
ifconfig -a
 
Masuk ke netplan
cd /etc/netplan
   
   
  akan muncul :
  ls
  Warning: Permanently added '10.10.10.123' (ECDSA) to the list of known hosts.
Masukkan password
edit file yaml, contoh 00-installer-config.yaml
sudo nano 00-installer-config.yaml
isinya seperti berikut ini :
  # This is the network config written by 'subiquity'
network:
  ethernets:
    enp1s0:
      dhcp4: true
  version: 2
rubah menjadi :
# This is the network config written by 'subiquity'
network:
  version: 2
  ethernets:
    enp1s0:
      dhcp4: no
      addresses:
        - 10.10.10.9/24
      gateway4: 10.10.10.1
      nameservers:
          addresses: [8.8.8.8, 1.1.1.1]

Latest revision as of 22:47, 19 November 2024

Cek ip server :

ip a

akan tampil seperti ini : (CONTOH)
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 
      valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
   link/ether 00:1d:97:b5:fa:08 brd ff:ff:ff:ff:ff:ff
   inet 10.10.10.123/24 brd 10.10.10.255 scope global dynamic enp1s0
      valid_lft 429sec preferred_lft 429sec
   inet6 fe80::21d:97ff:feb5:fa08/64 scope link 
      valid_lft forever preferred_lft forever

Terlihat bahwa adapter yang digunakan adalah enp1s0 dengan ip dinamis 10.10.10.123 (untuk pc/server lain mungkin akan berbeda adapter dan ip-nya).

Command lain seperti

ifconfig -a

Masuk ke netplan

cd /etc/netplan

ls

edit file yaml, contoh 00-installer-config.yaml

sudo nano 00-installer-config.yaml

isinya seperti berikut ini :

# This is the network config written by 'subiquity'
network:
  ethernets:
    enp1s0:
      dhcp4: true
  version: 2

rubah menjadi :

# This is the network config written by 'subiquity'

network:
  version: 2
  ethernets:
    enp1s0:
      dhcp4: no
      addresses:
        - 10.10.10.9/24
      gateway4: 10.10.10.1
      nameservers:
          addresses: [8.8.8.8, 1.1.1.1]