I have a PC which is connected to internet using a USB dongle and wvdial.

I would like to share the internet connection over Ethernet with other PCs using a router.

How can I connect the PC, and share its connection via Ethernet? I have connected the router to it with an Ethernet cable and I can access to it from other PCs, but I can't use it as gateway.


It can be solved with iptables

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A FORWARD -i ppp0 -o wlp2s0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlp2s0 -o ppp0 -j ACCEPT

wlp2s0 is the destination connection (can be eth0 or any other) ppp0 is the connection from the dongle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.