Re: Udostepnianie łacza
Roland Czaczyk napisał(a):
Ktos poradzil mi zeby skompilowac jadro na nowsze, ok - ale przeciez na
starych jadrach tez sie udostepnialo lacze.
To, że masz LANa, który działa - to połowa sukcesu.
Teraz musisz skonfigurować udostępnianie łącza - jeśli zostałeś przy
jajku 2.2.x to poszukaj na googlu tutoriali do ipchains, jeśli jednak
wolisz unowocześnić jądro (polecam serię 2.6), szukaj iptables...
Ja np. w /etc/network/if-up.d/ utworzyłem plik masquerade (i dałem mu
atrybut wykonywalności) o następującej zawartości:
#!/bin/sh
echo -n "Konfiguruje udostepnianie internetu..."
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -F -t nat
iptables -X -t nat
iptables -F -t filter
iptables -X -t filter
iptables -t filter -P FORWARD DROP
iptables -t filter -A FORWARD -s 172.16.0.0/255.255.0.0 -d 0/0 -j ACCEPT
iptables -t filter -A FORWARD -s 0/0 -d 172.16.0.0/255.255.0.0 -j ACCEPT
iptables -t nat -A POSTROUTING -s 172.16.0.2 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 172.16.0.3 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 172.16.0.4 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 172.16.0.5 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 172.16.0.6 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 172.16.0.7 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 172.16.0.8 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 172.16.0.9 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 172.16.0.10 -d 0/0 -j MASQUERADE
172.16.0.0 to adres mojej sieci - możesz sobie wymienić na 192.168.0.0
czy co tam masz. Powyższy skrypcik odpala się za każdym razem, gdy
podniosą się interfejsy sieciowe i powoduje on udostępnienie internetu
komputerom 172.16.0.2-10 (brama ma 172.16.0.1).
Reply to: