Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a Gateway server that with this simple iptables rules:

#!/bin/bash

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

iptables -t nat -A PREROUTING -s 192.168.1.0/255.255.255.0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A PREROUTING -s 192.168.1.0/255.255.255.0 -p tcp --dport 443 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A POSTROUTING -j MASQUERADE

Can redirect all requests (on port 80) to his webserver (showing all users a "forced" page). This works flawlessly if the user opens any http site but fails if the user tries sites like facebook or gmail that are https and gets a "this page is not available" error.

What am I doing wrong?

If my idea is not the best I can accept any kind of solutions that will allow me to obtain the result to force all users that have this server as gateway to see only a specific webpage I decide when they try to surf the web.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.