Operating System : Debian 7
Perisian Terlibat :
iptables
dnsmasq
Konfigurasi
eth0 - Disambungkan kepada DSL Modem Router
eth1 - Disambungkan kepada LAN
nano -w /etc/network/interfaces
# The external WAN interface (eth0)
allow-hotplug eth0
iface eth0 inet dhcp
# The internal LAN interface (eth1)
allow-hotplug eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
Install dnsmasq
apt-get install dnsmasq
dnsmasq config
nano -w /etc/dnsmasq.conf
interface=eth1
listen-address=127.0.0.1
domain=home.andreimatei.com
dhcp-range=192.168.0.100,192.168.0.110,12h
Configure iptables
nano -w /etc/iptables.rules
*nat
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
*filter
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i eth0 -j DROP
COMMIT
Modify /etc/network/interface
nano -w /etc/network/interfaces
# The external WAN interface (eth0)
allow-hotplug eth0
iface eth0 inet dhcp
pre-up iptables-restore < /etc/iptables.rules
# The internal LAN interface (eth1)
allow-hotplug eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
Last Step
edit /ect/sysctl.conf
uncomment net.ipv4.ip_forward=1
Reboot Server.. dah siap..
source ; noviantech
No comments:
Post a Comment