LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-05-2020, 02:51 PM   #1
sniper8752
Member
 
Registered: Oct 2012
Posts: 564

Rep: Reputation: Disabled
Blocking Tagged vlan traffic from being forwarded to Untagged


I have two networks that I would like to keep separated, and not allow them to talk to devices on each other. They both should be able to reach out to the Internet though.
Two subnets: 192.168.100.1/24, 192.168.200.1/24
The bastion/server is running iptables.
On the server, I created a vlan interface (id of 2). As for all other traffic right now, it is not defined/setup, or I guess you could say, "untagged". To stand up the vlan interface (for 200.1) on the server, I followed this tutorial: https://www.voiphow.com/how-to-confi...lan-in-ubuntu/.
Please bear with me as I am learning about this vlan stuff.
I notice that from my vlan of 2 (200.1 subnet), I am able to ping traffic on 100.1, which I would like to prevent and keep separate. How do I do this? I believe the answer is with iptables, but I am not sure.

EDIT:
Behind the server, I have a smart switch. I am using 802.1Q VLAN. All ports except 2 are part of vlan1 and are untagged. I put port 2 as a tagged port, of vlan ID 2.

Last edited by sniper8752; 12-05-2020 at 02:56 PM.
 
Old 12-05-2020, 03:44 PM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,840

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
So you need to drop traffic attempting to reach 192.168.100.0/24 from 192.168.200.0/24, but do allow access to public IP addresses....

Add
Code:
iptables -I FORWARD -s 192.168.200.0/255.255.255.0 -d 192.168.100.0/255.255.255.0 -j DROP
This will capture traffic attempting to reach the 192.168.100.0/24 network. Then add another rule immediately after this so that WAN traffic is still able to pass through...
Code:
iptables -A FORWARD -s 192.168.200.0/255.255.255.0 -d 0.0.0/0.0.0.0 -j ACCEPT
 
Old 12-10-2020, 05:31 PM   #3
sniper8752
Member
 
Registered: Oct 2012
Posts: 564

Original Poster
Rep: Reputation: Disabled
It seems to work, for the most part. I can not ping any hosts on 100, except for one: the other interface (internal) on the server. I am not sure if this matters, but it is in PROMISC mode.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VLAN - Tagged and native vlan cosmoarg Linux - Networking 1 01-24-2017 02:33 PM
Untagged vlan sub-interface pcCoder Linux - Networking 2 04-09-2014 11:06 AM
mix tagged(vlan) and untagged traffic. Steviepower Linux - Networking 5 04-27-2012 09:17 AM
managed switch - tagged or untagged gustavolinux Linux - Networking 4 02-03-2009 08:38 AM
Traffic Control with tc qdiscs and tc filter on VLAN tagged network amandler Linux - Networking 2 10-23-2008 11:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:22 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