Web Proxy و Network Address Translation

بينما ناقشنا سابقاً الفرق بين البروكسي و NAT، سنتحدث اليوم عن كيفية عملهما معاً. في معظم الشبكات، يعمل البروكسي خلف جهاز NAT (جدار حماية أو راوتر).

Source NAT (SNAT) وسلوك البروكسي

عندما يخرج البروكسي للإنترنت، يتم ترجمة عنوانه الداخلي (Private IP) إلى عنوان عام (Public IP) بواسطة NAT. الخوادم الخارجية ترى فقط عنوان الـ Public IP الخاص بالشركة. هذا يعني أن البروكسي يوفر طبقة إضافية من الخصوصية: لا يمكن للمواقع الخارجية معرفة عنوان IP الداخلي للموظف (Client Internal IP) إلا إذا سربها البروكسي عبر ترويسة X-Forwarded-For.

إعداد Transparent Proxy مع NAT

لإجبار الحركة على المرور عبر البروكسي دون إعدادات المتصفح، نستخدم قواعد DNAT (Destination NAT) على الراوتر:


# Redirect HTTP traffic to Proxy port 3128
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
                    

هذا "الاعتراض" (Interception) هو جوهر عمل البروكسي الشفاف، ويعتمد كلياً على قدرة NAT على تغيير وجهة الحزم.

Disclosure: we may earn a commission if you purchase through some links.

Services Related To This Article

These offers are related to privacy, password security, and development workflows. Replace the current links with your real affiliate links through environment variables.

Default Links Need Replacement

Proton

Privacy, mail, and VPN

A strong fit for privacy-focused visitors who want VPN and secure email under one brand.

Explore Proton

Surfshark

Consumer VPN

Best on pages about geo-blocking, privacy, and public Wi-Fi protection.

Try Surfshark

NordVPN

High-converting VPN

A clear offer for users who need a paid, more durable alternative to a free proxy.

View NordVPN

1Password

Password management

The best match for password, secrets, team access, and personal security pages.

Discover 1Password

DigitalOcean

Developer cloud hosting

A strong fit for proxy setup, server, and infrastructure content aimed at developers and small teams.

Start with DigitalOcean