/etc/network/interfaces
[code]auto lo eth0 eth1
freebox sur eth1, LAN sur eth0
The loopback interface
iface lo inet loopback
The first network card - this entry was created during the Debian installation
(network, broadcast and gateway are optional)
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
FREEBOX
iface eth1 inet dhcp
[/code]
apt-get install dhcp
/etc/default/dhcp
INTERFACES="eth0"
/etc/dhcpd.conf
[code]# dhcpd.conf
Sample configuration file for ISC dhcpd
option definitions common to all supported networks…
option domain-name “maisonamoi.quejesuisbien”;
option domain-name-servers 212.27.53.252,213.228.0.94;
là je t’ai mis les DNS de Free, tu vois…
option subnet-mask 255.255.255.0;
default-lease-time 86400;
max-lease-time 86400;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.199;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option smtp-server 192.168.1.1;
}
[/code]
/usr/local/bin/routage
[code]#!/bin/sh
date
récupération de 'l’IP free
IP=`ifconfig eth1 | grep inet | awk '{print $2 }' | sed -e 's/adr://' | sed -e 's
/addr://’`
PPP=eth1
echo "IP = " $IP " sur " $PPP
NAT sur la sortie, attention, il faut faire un parefeu idéalement mais bon, c’est un autre pbm.
iptables -t nat -A POSTROUTING -o $PPP -j MASQUERADE
se définit aussi dans /etc/sysctl.conf en décommentant la ligne
#net.ipv4.conf.default.forwarding=1
mais on ne se refait pas
echo "1" > /proc/sys/net/ipv4/ip_forward
augmente un choïa la table nat
echo "16384" > /proc/sys/net/ipv4/ip_conntrack_max
[/code]
Voilà c’est en gros la base…