Assalamualaiku Wr Wb
Pada tutorial kali ini saya akan membagikan tips bagaimana cara share koneksi internet pada centos7
oke lanagsung saja alat yang dibutuhkan :
- Pc yang telah terinstall Centos
- Koneksi Internet
- “enp0s3” sudah jalan dengan ip address ‘192.168.137.2/24’ dan sudah terkoneksi ke internet
- “enp0s8” sudah jalan dengan ip address ‘172.168.12.1/30’ ini terkoneksi keclient/LAN, supaya client bisa internetan
[root@localhost]# echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
[root@localhost]# cat /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.ip_forward=1
[root@localhost]# sysctl -p
net.ipv4.ip_forward = 1
Dan Sekarang kita melihat service zone pada NIC yang kita miliki
[root@localhost]# firewall-cmd --get-zone-of-interface= enp0s3 “tekan enter”
public
[root@localhost]# firewall-cmd --get-zone-of-interface= enp0s8 “tekan enter”
public
Kemudian
kita rubah zone interface enp0s8 public
menjadi internal:
[root@localhost ~]# firewall-cmd --zone=internal --change-interface= enp0s8
success
[root@localhost ~]# firewall-cmd --permanent --zone=internal --change-interface= enp0s8
success
[root@localhost ~]# firewall-cmd --get-zone-of-interface= enp0s8
internal
Dan tahap terakhir kita enable masquerade di zone public :
[root@localhost ~]# firewall-cmd --zone=public --add-masquerade “tekan enter”
success
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-masquerade
Success
[root@localhost ~]# firewall-cmd --zone=public --list-all
public (default, active)
interfaces: enp0s3
sources:
services: dhcpv6-client ssh
ports:
masquerade: yes
forward-ports:
icmp-blocks:
rich rules:
Selasai settingan di server untuk tahap selanjutnya kita akan setting ip address pada client 172.168.12.2/30 gateway 172.168.12.1 dan DNS di isi 8.8.8.8
Dan cobalah buka browser.. jika berhasil maka akan bisa buat berinternetan :D
Catatan: harus diingat dan dipahami alurnya jangan dihafal .
Semoga artikel saya bermanfat apabila ada kesalahan dalam pengetikan mohon dimaafkan.
3:50:00 AM
Tags :
Jaringan
,
Server
Subscribe by Email
Follow Updates Articles from This Blog via Email
No Comments