LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-19-2022, 10:01 AM   #1
the_zone
Member
 
Registered: Nov 2008
Distribution: Slackware
Posts: 83

Rep: Reputation: 7
Virtual networking


Hello,

I am a bit lost in the virtual networking stuff.

I have a linux machine (NixOs) which is a host and runs pfsense within Qemu-kvm.
The machine has 2 network interfaces. The first NIC is isolated, by putting it in passthrough mode, and solely accessible by pfsense and meant to be the WAN port.
The second NIC is meant to serve the home network.

In the end pfsense should be the dhcp server.

Click image for larger version

Name:	QemuPfsenseNetworking.jpg
Views:	31
Size:	27.5 KB
ID:	40057

I started of by creating a bridge, nm-bridge, with nmtui and bind eth1 to that.
nm-bridge was getting an IP address from the home-router.
Pfsense was able to connect to nm-bridge and I saw a vnet0 appearing when executing brctl show.
Both from the host and pfsense-vm I was able to ping the network.

Here is where I miserably fail in knowledge.
Next step was to enable the dhcp server on pfsense and connect the virtual switch, openvswitch, to pfsense and eth1.

Somehow, due to the fact that vnet0 is a tun/tap device I was not allowed to connect the 2.

How should I approach this ?

best regards

Simon
 
Old 12-20-2022, 06:44 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,860

Rep: Reputation: 162Reputation: 162
Is the bridge over eth0&eth1 or eth1? Based on your picture, it is over eth0&eth1.
 
Old 01-13-2023, 02:52 PM   #3
the_zone
Member
 
Registered: Nov 2008
Distribution: Slackware
Posts: 83

Original Poster
Rep: Reputation: 7
Apologies for the delayed reply.

The bridge is over eth0/eth1 indeed.

I want packets from the wan port (eth0), via pfsense, virtual bridge towards the lan port (eth1) and vice versa.
 
Old 01-13-2023, 03:01 PM   #4
the_zone
Member
 
Registered: Nov 2008
Distribution: Slackware
Posts: 83

Original Poster
Rep: Reputation: 7
Click image for larger version

Name:	NameSpace.jpg
Views:	15
Size:	17.1 KB
ID:	40227

I went ahead and tried something with namespaces instead of virtual machines.
See figure.

My host can access the internet perfectly.

My namespace "namespace" can get an ip address via DHCP however can not ping.

Click image for larger version

Name:	NameSpace2.jpg
Views:	11
Size:	41.4 KB
ID:	40228

routing looks to be OK and as well as iptables.
Both on the root namespace (host) and namespace.
Also ipv4.ip_forward is set to 1.

I tried to find a solution online. However for a novice on virtual networking it is sometimes hard to see the forest through the trees.

Last edited by the_zone; 01-13-2023 at 03:04 PM.
 
Old 01-13-2023, 04:11 PM   #5
yvesjv
Member
 
Registered: Sep 2015
Location: Australia
Distribution: Slackware, Devuan, Freebsd
Posts: 586

Rep: Reputation: Disabled
Can you ping the gateway?
 
Old 01-14-2023, 06:48 AM   #6
the_zone
Member
 
Registered: Nov 2008
Distribution: Slackware
Posts: 83

Original Poster
Rep: Reputation: 7
No, I can not.

However I can ping the virtual switch (vswitch).
 
Old 01-14-2023, 12:16 PM   #7
the_zone
Member
 
Registered: Nov 2008
Distribution: Slackware
Posts: 83

Original Poster
Rep: Reputation: 7
I get the idea my virtual switch, created with openvswitch, is not forwarding packets.


I did a :

Quote:
tcpdump -i vswitch0
What I saw was:

Click image for larger version

Name:	NameSpace3.jpg
Views:	8
Size:	200.1 KB
ID:	40235

I created the switch with no additional options.

Quote:
ovs-vsctl add-br vswitch0
Adding eth1:

Quote:
ovs-vsctl add-port eth1

Since eth1 had no ip beforehand I executed

Quote:
dhclient vswitch0 --no-pid
Quote:
ip netns add virtualMachine
Quote:
ip link add veth0 type veth peer name veth1
Quote:
ip link set veth0 netns virtualMachine
Quote:
ifconfig veth1 up
Quote:
ip netns exec virtualMachine ifconfig veth0 up
Quote:
ip netns exec virtualMachine dhclient veth0
At this stage I could ping the veth1 port of the vswitch0.

Last edited by the_zone; 01-14-2023 at 12:22 PM.
 
Old 01-17-2023, 06:15 PM   #8
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,860

Rep: Reputation: 162Reputation: 162
Like you mentioned, two NIC cards for home LAN and Internet WAN are isolated. So the virtual switch can NOT be over eth0/eth1. The virtual switch is on layer 2 and bypass layer 3 functionality. You can try virtual switch over eth1 or home LAN.
 
Old 01-18-2023, 01:15 PM   #9
yvesjv
Member
 
Registered: Sep 2015
Location: Australia
Distribution: Slackware, Devuan, Freebsd
Posts: 586

Rep: Reputation: Disabled
Is your vswitch bridged with eth0?
 
Old 09-05-2023, 02:00 PM   #10
the_zone
Member
 
Registered: Nov 2008
Distribution: Slackware
Posts: 83

Original Poster
Rep: Reputation: 7
Digging up this old thread again.

I did an experiment in a virtualbox before putting it on real hardware.

1. put the VM network in bridged mode. Which resembles the real world example.
Result, namespace can get an ip addres and generates resolv.conf.
No pinging to the gateway or outside world from within the namespace.

2. put the VM network in NAT mode
Result, namespace gets an ip address and generates resolv.conf and
pinging to the gateway or outside world is possible from within the namespace.

hmmm. What is going on here ???.

In 1) I can only ping the virtual switch.
 
Old 09-06-2023, 12:47 AM   #11
the_zone
Member
 
Registered: Nov 2008
Distribution: Slackware
Posts: 83

Original Poster
Rep: Reputation: 7
Another experiment.

Using brctl insted of oopenVswitch.
Similar results.
 
  


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
Running virtual pc files in a virtual machine in linux ... preferably virtual box biharibong Linux - Software 4 01-21-2009 01:04 PM
Virtual Box. Removing a shared folder inside virtual xp. glore2002 Linux - Software 2 05-20-2007 11:12 AM
vsftpd, web uploads, vsftpd virtual users, apache virtual hosts, home directories jerryasher Linux - Software 7 02-18-2007 06:29 AM
virtual users and virtual host need to stay at /home nephish Linux - Networking 3 01-14-2006 01:36 PM
virtual hosts, virtual ip's? kuplo Linux - Newbie 3 11-29-2005 08:44 PM

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

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