Changes Hostname On Linux Ubuntu
Hello everyone! how are you doing guys? I always pray that you will be protected by the one-time God :)
At this meeting I will share my knowledge about "Changes Hostname On Linux Ubuntu"
1. Mengganti Hostname
- Untuk melakukan cek hostname pada linux
input command "hostnamectl"
- lalu untuk mengganti hostname pada linux
input command "set hostnamectl set-hostname (isi hostname)"
- Lalu pastikan kembali dengan input command "hostnamectl"
untuk melihat hostname nya saja
Input command "cat /etc/hostname"
- Di linux juga dapat menginstall paket nmtui, dimana nmtui ini adalah paket untuk memngkonfigurasi hostname dan ip address via GUI
Input command "sudo yum -y install nmtui"
Atau bisa juga input command "sudo yum -y install NetworkManager.tui"
Noted : Dikedua command tersebut bermaksud sama.
2. Mengganti IP Address dan subnetmask
- Untuk melihat informasi mengenai ip address di linux,
Input command "ifconfig"
- Untuk mengganti ip address
input command "sudo ifconfig (nama interface) netmask (subnetmask)
atau bisa juga input command "ip addr add (ip)(disertai prefix) dev (nama interface)
- Untuk menambahkan beberapa ip di dalam satu interface,
Input command ip addr add (ip)(disertkan prefix) dev (nama interface)
Pastikan kembali dengan menggunakan command "ip addr" or "ifconfig"
- Untuk menambahkan virtual interface di dalam satu interface,
Input command "sudo ip addr add (ip disertakan prefix) dev (interface yang ingin di dalam nya ada virtual interface dan ip) label (nama virtual interface nya"
Sebagai contoh disini saya akan coba buat virtual interface dan virtual ip di dalam interface saya yakni "ens192"
Input command "ip addr add 10.10.10.1/30 dev ens192 label ens192:1"
lalu cek vrtual interface dan ip nya dengan command "ip addr show"
- Untuk menghapus virtual interface dan ip address nya,
input command "ip addr del (ip disertakan prefix) dev (interface gateway)
Sebagai contoh saya akan coba hapus virtual interface dan ip nya yang baru saja saya buat tadi
Input command "ip addr del 10.10.10.1/30 dev ens192
Pastikan kembali dengan input command "ip addr show"
- Untuk melakukan enable/disable pada interface
1. Disable Interface
Input command "nmcli con down (nama interface)
2. Enable interface
Input command "nmcli con up (nama interface)
- Untuk melakukan penambahan default gateway pada interface
Input command "sudo route add default gw (ip gateway)"
Pastikan kembali dengan input command "ip route show"
- Untuk menghapus default gateway, input command "sudo route del default gw (ip gateway)"
Pastikan kembali dengan input commmand "ip route show"
3. Mengganti DNS Server
Secara global storage DNS terdapat di /etc/resolv.conf.
Dan interface dns secara global terdapat di /etc/sysconfig/network-scripts
noted : untuk melakukan konfigurasi DNS bisa di file /etc/resolv.conf
Contoh :'Disini saya akan coba menambahkan DNS di linux saya menggunakan DNS google"
Input command "vi /etc/resolv.conf
Ketikkan "i" yang berarti insert agar bisa mengedit filenya
lalu input "nameserver 8.8.8.8"
lalu save and quit
Klik "ESC"
lalu "shift + :"
input command "wq!" yang berarti "Write And Quit"
QUIZ!
1. It's possible to change the live DNS config without editing a file?
Answer : False, Karena untuk melakukan konfigurasi dns harus di lakukan di dalam file /etc/resolv.conf
2. The replacement for the route command is ip route?
Answer : True, command "ip route" dapat menampilkan hasil route table
3. To change the system hostname an admin just needs to edit /etc/hostname for it to take effect?
Answer : False, Untuk melakukan konfigurasi hohstname input command "set hostnamectl set-hostname (nama hostname)"
4. To change the saved system hostname, an admin should use the _____ command
Answer : hostnamectl
5. To assign an ip address to a network interface with the ip command, an admin would use the?
Answer : add option
Komentar
Posting Komentar