netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Horsley <horsley1953@gmail.com>
To: netfilter@vger.kernel.org
Subject: how do I block NAT for a ranges of IPs?
Date: Wed, 28 Dec 2011 10:55:06 -0500	[thread overview]
Message-ID: <20111228105506.0d5fa61e@zooty> (raw)

I have a KVM virtual machine I would like to totally isolate from
my local LAN. I've told libvirt to use a separate bridge for this
KVM and I've setup NAT routing for the separate bridge so the
KVM can get to the outside world. That all works.

Now I want to figure out how to block any attempt from the
KVM to get to my LAN, and my LAN (other than what is required
for the NAT forwarding to continue working :-) from getting to
the KVM.

In my setup "br0" is the bridge that the physical interface
and all my "normal" KVMs are attached to. It uses the
192.168.100.0/24 address range.

The "bifrost" bridge is not connected to a physical interface.
I have assigned it address 10.10.10.1 and the KVM I want to
isolate uses it as a gateway and has static IP 10.10.10.2.

Here are the commands that do indeed seem to setup a working
NAT for the KVM.

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
iptables -A FORWARD -i br0 -o bifrost -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i bifrost -o br0 -j ACCEPT

Bearing in mind that I mostly cut & paste iptable rules and
can only partially understand the stuff I read in the iptables
man pages and wot-not, is anyone willing to tell me exactly
what to change/add to prevent the KVM connected to bifrost
from talking to my local LAN and vice versa? (I have a
feeling I could understand the rules if someone told
me what they should be, but absorbing everything
in the man page then deducing what I need to do is beyond
my poor brain :-).

Tanks in advance for any help.

                 reply	other threads:[~2011-12-28 15:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111228105506.0d5fa61e@zooty \
    --to=horsley1953@gmail.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).