2012-10-26

How to NAT eth0 to eth1 on Debian squeeze?





echo "1" > /proc/sys/net/ipv4/ip_forward

You will need to edit /etc/sysctl.conf and change the line that says net.ipv4.ip_forward = 0 to net.ipv4.ip_forward = 1.


#!/bin/sh
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT


/etc/init.d/isc-dhcp-server restart


cat /etc/resolv.conf
namservers


static ip on eth1 192.168.0.254 (option routers 192.168.0.254)
/etc/resolv.conf (option domain-name-servers 172.29.129.214;)



/etc/dhcp/dhcpd.conf

subnet 192.168.0.0 netmask 255.255.255.0 {
    interface eth1;
    range 192.168.0.15 192.168.0.50;
    default-lease-time 6000;
    max-lease-time 7200;
    option subnet-mask 255.255.255.0;
    option time-offset -3600;
    option routers 192.168.0.254;
    option domain-name-servers 172.29.129.214;
}


/etc/init.d/isc-dhcp-server restart

No comments:

Post a Comment