LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 11-20-2020, 09:28 AM   #1
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Rep: Reputation: 22
Question Create Virt. NIC in FreeBSD


I'm new to BSD and have a problem creating a virtual NIC. Trying out OPNSense and that uses FreeBSD so...
The M/B only has one NIC on this miniATX but I need two and no there's no room or PCI outlet so...
There is a PCIe but I ain't got one of those.

Have tried the thing I used in CentOS,
Quote:
ifconfig eth0:0 123.123.22.22
(think it was like that) but that won't work.

Searched a lot but nothing I find seems to work.
Have seen something they call alias but as far as I've seen that is only on the same network but has to be different NetMask or an error shows up as they say.

Anyone knows this?
Another thing, if I can use this Virt-NIC on a different network, is that less secure then to use 2 separate NICs as for a firewall thingy?
If so I need to get a NIC for PCIe or change M/B but I'm trying to get the quickest thing available for now.



//B52
 
Old 11-21-2020, 12:51 PM   #2
jggimi
Member
 
Registered: Jan 2016
Distribution: None. Just OpenBSD.
Posts: 289

Rep: Reputation: 169Reputation: 169
Are you thinking of VLANs? Using VLANs -- the standard is IEEE 802.1Q -- is one way of logically segmenting a physical network, and generally requires a managed switch that supports the standard. FreeBSD supports these. For provisioning, start here: https://www.freebsd.org/doc/handbook/network-vlan.html. For background on VLANs, start here: https://en.wikipedia.org/wiki/Virtual_LAN.
 
Old 11-24-2020, 12:28 PM   #3
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Original Poster
Rep: Reputation: 22
Have no clue if VLAN is the same as a Virtual NIC.
With the thing I showed I can add lots of virtual NICs that has unique IP-addresses that don't need to have the same submask, eg. eth0:0, eth0:1, eth0:2, eth0:3, eth0:4

If I can get this to work with VLAN and that works for me as two separate NICs with IPs at different networks, in this case one for LAN and one for WAN it should work.
Also the thing about how secure it is as a firewall with only one NIC if that makes any difference
 
Old 11-24-2020, 01:35 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,334

Rep: Reputation: Disabled
Quote:
Originally Posted by Basher52 View Post
I'm new to BSD and have a problem creating a virtual NIC. Trying out OPNSense and that uses FreeBSD so...
The M/B only has one NIC on this miniATX but I need two and no there's no room or PCI outlet so...
There is a PCIe but I ain't got one of those.

Have tried the thing I used in CentOS,
Code:
ifconfig eth0:0 123.123.22.22
(think it was like that) but that won't work.

Searched a lot but nothing I find seems to work.
Have seen something they call alias but as far as I've seen that is only on the same network but has to be different NetMask or an error shows up as they say.
It's a bit unclear what you're looking to accomplish, but is seems that you want to bind more than one IP address to the same interface.

In Linux, this used to be done using aliases, which were (as you say) a bit like virtual NICs, in that you could assign multiple addresses that would then end up being bound to the same physical interface. This practice has been deprecated for quite some time, and instead multiple addresses are simply added to the same interface.

Under BSD, it seems the alias method is still in use, but the syntax of the ifconfig command differs slightly from Linux. Here's a really old page showing how it's done, and here's a much more recent forum post detailing the exact same procedure.
 
Old 11-27-2020, 01:48 PM   #5
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Original Poster
Rep: Reputation: 22
OK, thanks, I'll check 'em and hope for the best

I know I'm a bit 'old fashioned' as it's bit a long, long.... loooong time I did this.
Later I just used 2 separate NICs but in this case I can't unless I get a PCIe NIC and do some invasive changes to the chassis for this as there ain't no outlet for it.

Was thinking of using this as a tiny new FW as my ISP delivered router sucks.
To get a port forwarding for P80 and not showing the internal webserver of the router to EVERONE ON THIS PLANET thus making it hackable to anyone... and NO!! the internal "uncheck"-function of that doesn't work.
 
Old 11-27-2020, 03:43 PM   #6
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Original Poster
Rep: Reputation: 22
Quote:
Originally Posted by Ser Olmy View Post
... and instead multiple addresses are simply added to the same interface. ...
btw... that seems interesting and also kinda news to me...
gimme a link so I can read up on that.



PS. and again... how SECURE is it with a single NIC with multiple IPs instead of 2 NICs?
 
Old 11-30-2020, 06:31 AM   #7
jggimi
Member
 
Registered: Jan 2016
Distribution: None. Just OpenBSD.
Posts: 289

Rep: Reputation: 169Reputation: 169
Quote:
Originally Posted by Basher52 View Post
how SECURE is it with a single NIC with multiple IPs instead of 2 NICs?
An alias address is merely a secondary address to which the NIC will respond - as an example, the NIC will respond to ARP requests "who has address a.b.c.d?" when any ARP request contains a provisioned address. There is no physical or logical separation of packets on the attached network or in the OS network stack, until a process binds an IP address to a socket; see the bind(2) system call man page for more information.

The VLAN technology I discussed above can be either a logical separation (tagged Ethernet frame) or a physical separation (untagged Ethernet frame). A managed switch which supports the technology is used to separate logical networks into different physical networks, where tagged frames share connections to servers in a "backbone" communication and untagged frames are sent to separate physical networks. Additionally, many OSes that support VLANs treat each VLAN pseudo-NIC uniquely in their protocol stacks for further isolation.
 
Old 12-10-2020, 06:30 AM   #8
Duglasfvd
LQ Newbie
 
Registered: Nov 2020
Location: Luxembourg
Distribution: DuglasdezOA
Posts: 2

Rep: Reputation: 0
Where is Administration linuxquestions.org ??

Where is moderator??
It is important.
Regards.
 
  


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
[SOLVED] How to create ext4 file system in a partition that was formatted with freeBSD file system(freebsd-ufs) vectrum Slackware 10 08-02-2020 02:24 AM
[SOLVED] installing virt-manager and virt-viewer on desktop for managing remote server yvesjv Slackware 4 04-24-2019 03:00 PM
Virsh/Virt-Manager/Virt-Install broken after upgrade to Xubuntu 17.10 Zabzoo Linux - Desktop 2 02-01-2018 08:05 AM
LXer: Hacking libvirt/virsh/virt-manager/virt-install at Xen 4.0 Dom0 on top of Ubunt LXer Syndicated Linux News 0 05-06-2010 02:50 PM
LXer: Virt-install&Virt-manager at Xen 4.0-rc8 (2.6.32.10 pvops) Dom0 on top Ubuntu K LXer Syndicated Linux News 0 03-26-2010 09:41 PM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

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