Iptables : partage de connexion internet

Comprendre

Partager une connexion sous linux est assez simple ...

mode console

# Forwarding ! Important... Permet de rediriger tout paquet sur le LANecho 1 > /proc/sys/net/ipv4/ip_forwardecho 1 > /proc/sys/net/ipv6/ip_forward

script

En ip extérieur statique

iptables -t nat -A POSTROUTING -o eth1-j SNAT --to 1.2.3.4

En ip extérieur dynamique

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

Exemple :

echo "NAT"iptables -A FORWARD -i eth0 -o ppp0 -s 192.168.0.0/24 -m state --state ! INVALID -j ACCEPTiptables -A FORWARD -i ppp0 -o eth0 -d 192.168.0.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPTiptables -t nat -A POSTROUTING -o ppp0 -s 192.168.0.0/24 -j MASQUERADE

Fichier /etc/sysctl.conf

# Uncomment the next line to enable packet forwarding for IPv4net.ipv4.ip_forward=1# Uncomment the next line to enable packet forwarding for IPv6net.ipv6.ip_forward=1

 


<<| Page : IpTables : FAQ : partage_connexion : |>>


 

 

^ Haut de page ^

Plan du site :: Atom :: RSS :: Sitemap :: e-mail ::

Date de mise-à-jour de cette page : 13 Août 2009 à 20:21:09 ~ Éxecutée en : 0.067 secondes.

Partenaires :aGeNUx :Evinux :Knoppix-fr :Linucie :Diaporama "Ad~Myre" :Odt2Xhtml :Xhtml2Pdf :

Copyright 2004-2010 © EBNH Conception - CNIL : 841395 -

XHTML 1.0, CSS 2.1, WAI

HowTo 'Mémoire Grise Libérée' :
Hormis la documentation propre à nVidia ...
tout ce site est placé sous Licence Libre GNU/FDL...

 

Ce site utilise jQuery, Superfish, GeSHi - et, certainement bien d'autres codes ! -.