RSS
 

Posts Tagged ‘Computer Stuff’

Debian Box as Router Gateway – NAT mode ON

24 Jul

Network layout seems like this

Set net interface :

debian:~# nano /etc/network/interfaces
auto eth1
iface eth1 inet static
address 10.2.1.254
netmask 255.255.255.0
network 10.2.1.0
broadcast 10.2.1.255
gateway 10.2.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 222.124.199.71
iface eth0 inet static
address 172.15.0.254
netmask 255.255.0.0
broadcast 172.15.255.255

change file /etc/sysctl.conf parameters.
net.ipv4.conf.default.forwarding=1
net.ipv6.conf.default.forwarding=1

Allowing ip forwarding from local network 172.15.0.0/16 to public network  10.2.1.0/24
debian:~# iptables -t nat -A POSTROUTING -o eth1 -s 172.15.0.0/16 -d 0/0 -j MASQUERADE

Allowing public network client  to access local server 172.15.101.79 through 82 port

Port 82
debian:~# iptables -t nat -A PREROUTING -i eth1 -p tcp –dport 82 -j DNAT –to 172.15.101.79:82

//change –dport  and –to parameters to expand your network policy about which server that will be accessible from public client

regards

 
 
 

Switch to our mobile site