TMA 5.2: Konfigurasi IP Statik di AlmaLinux dan Alpine Linux

Konfigurasi IP Static AlmaLinux - Alpine

Konfigurasi IP Static: AlmaLinux (Server) - Alpine Linux (Client)

1. Edit Mesin Virtual (VM) AlmaLinux

a. Tambahkan Network Adapter 1 (Bridged)

  • Settings → Network → Adapter 1 → Bridged Adapter
  • Pilih interface host (misalnya wlan0 atau eth0)

b. Tambahkan Network Adapter 2 (Internal Network)

  • Settings → Network → Adapter 2 → Internal Network
  • Name: intnet2 (sama seperti Alpine)
Menggunakan Internal Network lebih aman karena terbatas antar VM, cocok untuk simulasi LAN.

2. Konfigurasi IP Statik di AlmaLinux

a. Cek IP dari Bridged Adapter

$ ip a

b. Atur IP Static untuk Bridged

$ nmtui
  • Pilih interface enp0s3
  • IPv4 → Manual
  • Alamat: 192.168.100.3/24
  • Gateway: 192.168.100.1
  • DNS: 8.8.8.8, 8.8.4.4

c. Atur IP Static untuk Internal Adapter

$ nmtui
  • Pilih interface enp0s8
  • IPv4 → Manual → 11.11.21.1/24

d. Restart Jaringan

$ sudo systemctl restart NetworkManager

e. Aktifkan IP Forwarding

$ sudo vim /etc/sysctl.conf
Tambahkan atau aktifkan:
net.ipv4.ip_forward = 1
Terapkan:
$ sudo sysctl -p

f. Tambah NAT Rule (iptables)

$ sudo iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE

g. Simpan Rule iptables Permanen

$ sudo yum install iptables-services -y
$ sudo service iptables save
$ sudo systemctl enable iptables

3. Jalankan Alpine Linux

a. Network Adapter Alpine

  • Adapter 1: Internal Network
  • Name: intnet2 (sama seperti AlmaLinux)

b. Konfigurasi IP Static di Alpine

Edit file:
# vi /etc/network/interfaces
Isi:
auto eth0
iface eth0 inet static
  address 11.11.21.2
  netmask 255.255.255.0
  gateway 11.11.21.1
  dns-nameservers 8.8.8.8 8.8.4.4
Restart networking:
# /etc/init.d/networking restart

c. Tes Koneksi dari Alpine

$ ping 11.11.21.1        # Ping ke AlmaLinux
$ ping 8.8.8.8           # Ping ke Internet
$ ping google.com
Traceroute (opsional):
$ apk add traceroute
$ traceroute google.com
Jika traceroute menampilkan jalur keluar melalui interface bridged AlmaLinux, berarti NAT berhasil.

Tidak ada komentar:

Posting Komentar