Link: http://ubuntuforums.org/showthread.php?t=91370
1. Start by configuring the network card that interfaces to the other computers on you network:
# ifconfig ethX ip
where ethX is the network card and ip is your desired server ip address (Usually 192.168.0.1 is used)
2. Then configure the NAT as follows:
# iptables -t nat -A POSTROUTING -o ethX -j MASQUERADE
where ethX is the network card that the Internet is coming from
# echo 1 > /proc/sys/net/ipv4/ip_forward
3. Install dnsmasq and ipmasq using apt-get:
# apt-get install dnsmasq ipmasq
4. Restart dnsmasq:
# /etc/init.d/dnsmasq restart
5. Reconfigure ipmasq to start after networking has been started:
# dpkg-reconfigure ipmasq
6. Repeat steps 1 and 2.
7. Add the line "net.ipv4.ip_forward = 1" to /etc/sysctl.conf
# gedit /etc/sysctl.conf
8. Reboot. (Optional)
DHCP Server
Link: http://www.debianadmin.com/howto-setup-dhcp-server-and-dynamic-dns-with-bind-in-debian.html
Link: http://lani78.wordpress.com/2008/08/12/dhcp-server-update-dns-records/
Link: http://lani78.wordpress.com/2008/08/09/setting-up-a-dns-for-the-local-network/
Link: http://lani78.wordpress.com/2008/08/10/setting-up-a-dhcp-server-on-ubuntu-hardy-heron/
sudo apt-get install dhcp3-server
Note: Don’t be alarmed if the startup fails; that’s because you haven’t configured it yet.
First, we need to tell the DHCP server to only run on eth1:
sudo gedit /etc/default/dhcp3-server
enter the following line save and exit file.
INTERFACES="eth1"
sudo gedit /etc/dhcp3/dhcpd.confddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
#Máscara da rede
option subnet-mask 255.255.255.0;
#Broadcast que será utilizado na rede
option broadcast-address 192.168.2.255;
#Roteador da rede que neste caso será o próprio servidor DHCP
option routers 192.168.2.1;
#Servidor de domínio da rede (DNS) que também é o próprio servidor
option domain-name-servers 192.168.2.1;
#Nome do domínio da rede
option domain-name "casa.lan";
#Aqui mostra qual a rede que será utilizada no DHCP Server e o
#range de IPs que será utilizado para enviar para as máquinas da rede
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.10 192.168.2.20;
option routers router.casa.lan;
}
Configurar interface ETH1
cp /etc/network/interfaces /etc/network/interfaces.old
gedit /etc/network/interfaces
auto eth1
iface eth1 inet static
address 192.168.2.1
netmask 255.255.255.0
#network 192.168.2.0
#broadcast 192.168.2.255
#gateway 192.168.2.1
sudo /etc/init.d/networking restart /etc/init.d/dhcp3-server start
Postar um comentário