OpenBSD

From Palfrepedia
Revision as of 22:56, 22 July 2023 by William (talk | contribs) (Adding information about setting up vlans)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

OpenBSD is another 4.4BSD-lite derived OS like so many others and anyone familiar with Linux and any other Unix will find themselves at home. It's most common use case is a a router, due to its very sophisticated networking features.

Using PPPeE

If you are using OpenBSD as a router, it is likely you will need to use PPPoE (the Point-to-Point Protocol over Ethernet as that is what many ISPs supply.

In the following example the ethernet cable from the fiber media converter is plugged into em0 network interface

# cat /etc/hostname.em0                                                        
mtu 1508 up

# cat /etc/hostname.pppoe0                                                     
inet 0.0.0.0 255.255.255.255 NONE \
pppoedev em0 \
authproto chap authname 'my-user-name' authkey 'my-secret' \
mtu 1500 \
up
dest 0.0.0.1
!/sbin/route add default -ifp pppoe0 0.0.0.1

# sh /etc/netstart

[Todo: add a section of pf firewall usage in a router, for the above]

Using VLANs

Sometimes you want to run network ports in trunk mode and have the networking on them in vlans. This is common on a router as it gives you more more network interfaces than are physically fitted to the router.

The current setup is this:

# cat /etc/hostname.em1
inet 10.0.1.1 255.255.255.0

That should be replaced with the singe word "up"

# echo "up" > /etc/hostname.em1
# cat /etc/hostname.em1
up

The reason for this is we will no longer use the interface directly, only vlans within it. Now setup the vlan interface. Our vlan is going to be vlan 40.

# echo "inet 10.0.1.1 255.255.255.0 NONE vlan 40 vlandev em1" > /etc/hostname.vlan40
# sh /etc/netstart

Then apply changes to /etc/pf.conf to update your firewall to reflect that what was em1 is now vlan40 in firewall terms. You can add as many more vlans as you need using the same technique.