Ip public (eth0):117.103.101.101 /24 Gateway public :117.103.101.1 IP local (eth1):192.168.55.1/24 Netmask:255.255.255.1 DNS:8.8.8.8, 8.8.4.4Langkah utama ada 4 yaitu :
- Seting IP di eth0 dan eth1
- seting IP Forwarding
- Setting NAT
- Testing di client
Seting /etc/network/interface
# Begin of /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo,eth0,eth1
iface lo inet static
#seting IP public
iface eth0 inet static
address 117.103.101.101
network 117.103.101.0
netmask 255.255.255.0
broadcast 117.103.101.255
gateway 117.103.101.1
#setting IP LAN
iface eth1 inet static
address 192.168.55.1
network 192.168.55.0
netmask 255.255.255.0
broadcast 192.168.44.255
gateway 192.168.55.1
Setting IP forwading
edit file /etc/sysctl.conf
net.ipv4.ip_forward = 1
Setting NAT
#iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADESelanjutnya, restart jaringan
sudo service networking restart
Testing
Setting IP di salah satu client dengan konfigurasi berikut :ip:192.168.55.100 netmask:255.255.0 gateway:192.168.55.1 DNS:8.8.8.8Selanjutnya, Ping ke DNS Google 8.8.8.8.
Jika OK, yang terakhir cek DNS dengan cara
$ nslookup detik.com Server: google-public-dns-a.google.com Address: 8.8.8.8 Non-authoritative answer: Name: detik.com Addresses: 2402:a000:0:1::100 203.190.241.43 203.190.242.69Jika ada jawaban dari DNS maka seting gateway sudah ok. Jika belum? tanya forum atau teman yang lebih tahu :).
Komentar