D
D
dartNNN2017-01-21 09:50:24
linux
dartNNN, 2017-01-21 09:50:24

Linux + PPP + Wi-Fi + NAT + Forwarding. How to set up and check?

I'm trying to set up internet via wi-fi on an android phone. What is available:
Linux with Internet via PPPoE and Wi-Fi mesh in AP mode. Android phone connected to Wi-Fi. Configured hostapd, dnsmasq to issue an IP address and iptables rules. The result almost turned out: the Internet is on the phone, but some of the applications do not work. I suspect that the problem is somewhere in iptables

# clear all previous rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# set default ACCEPT
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# enable MASQUERADE
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

# send all packets to android device
iptables -t nat -A PREROUTING  -p tcp -i ppp0 -d 10.34.146.10 -j DNAT --to-destination 192.168.0.60
iptables -t nat -A PREROUTING  -p udp -i ppp0 -d 10.34.146.10 -j DNAT --to-destination 192.168.0.60

The last two lines are an attempt to forward all ports.
As a result, of all the applications, only Skype and the browser work normally. Through 3G everything works fine. On another android device with this Wi-Fi mesh, the same problem.
Question: what am I doing wrong? How can you check what exactly is not working?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Руслан Федосеев, 2017-01-21
@martin74ua Куратор тега Linux

А зачем при НАТ пробрасывать все порты? Уберите последние две строчки и проверьте еще раз.

Петр, 2017-01-21
@Morpheus_God

А зачем вообще проброс порта? Вам же просто получить интернет и пользоваться им. Попробуйте как ваше советуют убрать две строки. По идее должно сработать.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question