Table Of Contents
Network configuration
Interface setup (static IP)
Adjust the following according to your network details:
auto ens160
iface ens160 inet static
address 192.168.170.100
netmask 255.255.255.0
network 192.168.170.0
broadcast 192.168.170.255
gateway 192.168.170.200
dns-nameservers <ip of your domain dns>
dns-search your.domain.com
Setup an interface as a gateway
In the following setup interface eth0
is connected to the internet while eth1
is the gateway of the internal lan that forwards traffic to eth0
auto eth0
iface eth0 inet static
address 192.168.4.20
netmask 255.255.255.0
broadcast 192.168.4.255
network 192.168.4.0
gateway 192.168.4.1
dns-nameservers 147.102.222.210 147.102.222.220 147.102.222.230
auto eth1
iface eth1 inet static
address 192.168.253.1
netmask 255.255.255.0
broadcast 192.168.253.255
network 192.168.253.0
up iptables-restore < /etc/ltsp/nat
up route add -net 192.168.248.0 netmask 255.255.252.0 gw 192.168.253.254
The /etc/ltspnat
file should be something similar to:
# Generated by iptables-save v1.4.4 on Fri Nov 4 15:53:53 2011
*nat
:PREROUTING ACCEPT [4:1808]
:POSTROUTING ACCEPT [1:116]
:OUTPUT ACCEPT [1:116]
-A POSTROUTING -s 192.168.253.0/24 -j MASQUERADE
-A POSTROUTING -s 192.168.248.0/22 -j MASQUERADE
COMMIT
# Completed on Fri Nov 4 15:53:53 2011
IP forwarding should be enabled in /etc/sysctl.conf
:
...
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
...