Multiple NICs with netgraph

I needed to simulate multiple PPPoE clients using one NIC. After googling, I was quite convinced that I could do it through netgraph. After more googling, I found this and this and this, which made me come up with the set of commands - found below - to create multiple virtual NICs, each having unique MAC addresses.

host1# kldload ng_ether
host1# kldload ng_eiface
host1# kldload ng_brdige
host1# ifconfig xl0 delete
host1# ifconfig xl0 down
host1# ngctl
Available commands:
config get or set configuration of node at
connect Connects hook of the node at to
debug Get/set debugging verbosity level
dot Produce a GraphViz (.dot) of the entire netgraph.
help Show command summary or get more help on a specific command
list Show information about all nodes
mkpeer Create and connect a new node to the node at "path"
msg Send a netgraph control message to the node at "path"
name Assign name to the node at
read Read and execute commands from a file
rmhook Disconnect hook "hook" of the node at "path"
show Show information about the node at
shutdown Shutdown the node at
status Get human readable status information from the node at
types Show information about all installed node types
write Send a data packet down the hook named by "hook".
quit Exit program
+ mkpeer xl0: bridge lower link0
+ name xl0:lower bnet0
+ mkpeer bnet0: eiface link1
+ name bnet0:link1 vif0
+ ngctl msg xl0: setautosrc 0
+ ngctl msg xl0: setpromisc 1
+ quit
host1# ifconfig ngeth0 link 00:00:00:00:00:0F
host1# ifconfig ngeth0 up
host1# ifconfig xl0 up

I used my xl0 interface as the parent interface the virtual interface (ngeth0). Doing an ifconfig would show the following:
host1# ifconfig
sis0: flags=8843 mtu 1500
options=8
inet6 fe80::211:d8ff:fe79:f0%sis0 prefixlen 64 scopeid 0x1
inet 10.3.1.143 netmask 0xfff00000 broadcast 10.15.255.255
inet6 fec0:ec8:4008:102:211:d8ff:fe79:f0 prefixlen 64 autoconf
inet6 2001:ec8:4008:102:211:d8ff:fe79:f0 prefixlen 64 autoconf
ether 00:11:d8:79:00:f0
media: Ethernet autoselect (100baseTX )
status: active
xl0: flags=8943 mtu 1500
options=9
inet6 fe80::210:5aff:fe9d:5ea9%xl0 prefixlen 64 scopeid 0x2
ether 00:10:5a:9d:5e:a9
media: Ethernet autoselect (100baseTX )
status: active
lo0: flags=8049 mtu 16384
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet 127.0.0.1 netmask 0xff000000
pfsync0: flags=0<> mtu 2020
syncpeer: 224.0.0.240 maxupd: 128
pflog0: flags=0<> mtu 33208
ngeth0: flags=8843 mtu 1500
inet6 fe80::200:ff:fe00:f%ngeth0 prefixlen 64 scopeid 0x6
ether 00:00:00:00:00:0f
host1#
Caveats:
  1. The default limit to the number of virtual interfaces - ngeth(N) - interfaces that can be attched to the netgraph bridge(bnet0) is 31.
  2. If you do this, you cannot assign an IP Address to the physical interface, xl0 in my example.
  3. AFAIK, netgraph is only found in FreeBSD.

Installing OpenBSD3.7 as a guest OS on a VMware Server

If you have tried installing any OS on VMware before and if you have tried installing OpenBSD on a real box, AND, you need to install OpenBSD on VMware, then read on...

There are a couple of important things to note/consider during installation. Let's just say that I ran into a some of "gotchas" while doing the install. I hope that this would prevent you or me (in case I need to do this again in the future) from the hassle of running into these simple but pesky problems.


[ONE: Prepare a new virtual machine]

When you're prompted to choose the "Guest OS", click on "Other". And then, on the drop down menu, choose "FreeBSD" for an i386 target platform or "FreeBSD 64-bit" for... well, I don't have to state the obvious. This allows you to maximize theoptimizations made by VMware for your taget OS (I'm just saying this because it sounds good but I honestly don't have any basis for that particular claim).

That's it for the first part. All the remaining options are yours to decide.


[TWO: OpenBSD3.7 Installation]

Installing Packages:

OpenBSD doesn't distribute official ISOs. However, there are available ISOs made by certain individuals which you can download and safely install. The problem with these ISOs is that they don't really follow a standard directory structure.

During installation, you will be prompted to specify the directory where the packages are located. Therefore, before you start installing OpenBSD, you need to know where the packages are located.

To do this you need to mount the ISO. On linux I issued the command:

`mount -o loop /path/to/ISO/file /path/to/mount/directory`


Making Partitions:

By default, the "a" partition is already created. This does not happen when you install OpenBSD on a real box. On a real box install, you only get the "c" partition (assuming you don't have any other OS installed) at first.

As a work around, you need to remove the "a" partition then add it again using your intended settings (it's retarded, I know). If you don't, then your installation will surely break.

After that, you can add the other remaining partitions.