Have a proxy server with squid installed. Want to configure iptables so as to allow a single ip in lan to access internet directly without directing the traffic through squid. the following works to masquerade traffic but how to filter so that only one ip is given access iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

the current iptables configuration is default. It does't have any rules applied.The squid server does its usual of providing proxy internet service.

currently i am studying iptables, so not a expert in it.So kindly be specific to rules that should be applied.

  • You'll need to provide more detail on your iptables setup with regard to squid and masquerading. – mgorven Feb 4 '13 at 18:13

You have packets passing through your server, so you have to add rules to filter:FORWARD if you want to block transiting traffic. Probably you want this:

iptables -t filter -I FORWARD ! -s {SPECIFIC_IP_FROM_LAN} -j DROP

but don't forget to add rules that accept the rest of the transiting traffic before this rule. filter:FORWARD is used for both WAN -> LAN and LAN -> WAN.

| improve this answer | |
  • i tried this but it did't work. Also please describe the rules that u mentioned above service iptables save;service iptables restart;service network restart. Thanx – Gr33n Feb 4 '13 at 19:52

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.