LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 11-13-2022, 09:28 PM   #1
tearock
LQ Newbie
 
Registered: Nov 2022
Posts: 3

Rep: Reputation: 0
libvirt network filter limiting VM access to 2 ip addresses


I'm trying to limit a VM's access to my network only to necessary devices using network filters: https://libvirt.org/formatnwfilter.html

I have successfully done this with a single ip address using the following format

Code:
    <filter name='local-fileserver-only' chain='ipv4' priority='-700'>
    <uuid>fce8ae33-e69e-83bf-262e-30786c1f8072</uuid>
    <rule action='drop' direction='out' priority='500'>
    <ip match='no' dstipaddr='192.168.1.45'/>
    </rule>
    </filter>
But this concept doesn't work with two ip addresses since it based on rejecting everything other than the match. There doesn't seem to be a way to do that with two addresses? So I've tried to use filters that accept and ip and then drop everything else, but I end up unable to access any traffic. The following example uses one ip but doesn't accept traffic to it. I'm not sure what I'm missing and the docs don't seem to have any close examples.

Code:
    <filter name='test-filter' chain='ipv4'>
    <uuid>fce8ae33-e69e-83bf-262e-30786c1f8079</uuid>
    <rule action='accept' direction='inout'>
    <ip match='yes' dstipaddr='192.168.1.202'/>
    </rule>
    <!-- drop all other traffic -->
    <rule action='drop' direction='inout'>
    <all/>
    </rule>
    </filter>
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to Check the Available Network Interfaces, Associated IP Addresses, MAC Addresses, and Interface Speed on Linux LXer Syndicated Linux News 0 06-08-2020 08:13 AM
Public IP addresses with KVM/libvirt routed via the DSL line kinv22 Linux - Networking 6 09-07-2017 08:18 PM
Limiting connections from ip addresses alexjohnson Linux - Server 1 12-28-2011 01:26 AM
Dansguardian - Won't filter new addresses added to filter list TechnoBod Linux - Software 1 01-08-2008 01:40 AM
Can access network, cannot access external addresses -Olly- Linux - Wireless Networking 2 10-08-2006 06:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 05:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration