как «перенаправить» все пакеты, поступающие от определенного сетевого адаптера, на какой-то IP: порт [закрыт]

Я хочу сделать своего рода WiFi прокси. И поэтому я хочу знать, как перенаправить пакеты, проходящие через определенный адаптер, на IP-порт назначения.

-2
задан 20 November 2012 в 22:08
1 ответ

I assume you want to do that on a GNU/Linux system.

In order to re-route all the TCP traffic (since you're talking about packets) from a specific adapter to a specific IP address and port, you should:

  1. Enable the IP forwarding capability of the Linux kernel. To do that, you must add the following configuration to /etc/sysctl.conf and reboot your system:

    net.ipv4.ip_forward = 1

  2. Next, create the iptables rule for the forwarding:

    iptables -t nat -A PREROUTING -i $DEVICE -p TCP -d $IP --dport $PORT -j REDIRECT

1
ответ дан 5 December 2019 в 21:29

Теги

Похожие вопросы