Let's say there are two users on the LAN, A and B. How do I restrict user A from internet access using iptables rules and saving the rules so that after reboot, they are still effective. And suppose I want to grant that user access at some point, How to enable it again. I am using Ubuntu Linux 10.04. It would be nice if anybody show me how to do it from the command line, as I often login to the machine using a local ssh login. thanks in advance.
I assume that users A and B are using the same Linux machine(s) where you are the administrator. (It's not completely clear from your question. If A and B are have their own computers which they are administrators on, it's a completely different problem.)
The following command will prevent the user with uid 1234 from sending packets on the interface
I recommend reading the Ubuntu iptables guide to get basic familiarity with the tool (and refer to the man page for advanced things like the mangle table).
The user will still be able to run ping (because it's setuid root), but not anything else. The user will still be able to connect to a local proxy if that proxy was started by another user.
To remove this rule, add
To make the rule permanent, add it to
I would not use iptables for this.
I assume that A and B are associated with the fixed IPs ClientA and ClientB. I assume that your Internet-Proxy is ServerI (your Ubuntu-Server?).
So I would add a deny/drop routing entry from ClientA to ServerI.
I don't use Ubuntu - so I can't tell you which config file to use to make that setting permanent (surviving a reboot).
Perhaps someone can add that detail?