Hallo
Ubuntu 10.04 3 Update
Mein Modem pp0 gibt das Internet weiter an eth0.
#!/bin/bash
if [ $UID -ne 0 ]
then
sudo $0 $* && exit 0 || exit 1
fi
echo Hallo Linux - ich habe $(whoami) Rechte
ifconfig eth0 10.0.0.10 netmask 255.255.255.0 broadcast 10.0.0.255 &&
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -i ppp0 -o eth0 -s 10.0.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
exit 0
Der Code hat auf einmal nicht mehr funktioniert. Der zweite PC könnte zwar pingen Rechner im Internet, also DNS Auflösung funktionierte, aber Firefox wollte nicht mehr Seiten ansteuern.
Lösung:
sudo gedit /etc/sysctl.conf
Und Zeile net.ipv6.conf.all.forwarding=1 aktiv setzen von net.ipv6.conf.all.forwarding=0 auf 1 oder die # weg nehmen.
Zitat:
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
net.ipv4.conf.default.forwarding=1
net.ipv4.conf.all.forwarding=1
# Uncomment the next line to enable packet forwarding for IPv6
net.ipv6.conf.all.forwarding=1