📜 ⬆️ ⬇️

VLAN on FreeBSD

It may be necessary to start up several logical networks isolated from each other by a single physical cable. For example, we have a need to bring a separate wire to the server with access to the WAN, and a separate wire for connecting to the local network. In this case, there may be more necessary wires (maybe we set up a router that connects the n-th number of subnets physically isolated from each other and sends them all to the Internet). At the same time, it is often extremely difficult to install such a number of network cards in the server, or there may be an undesirable large number of wires in the route from switches to server. In any case, it is advantageous to pack all these networks into one physical wire. To do this, they invented a technology that allows you to do this - vlan. There are several different implementations of this technology, one of the most popular being called “IEEE 802.1q”.



In this OS, this is done quite elementarily using the example of a server that will work with us under FreeBSD 6.2-RELEASE-p3.
')
We have one Ethernet in which we need to push 2 different grids

* Outside world (internet for example)
* The local network

To do this, we omit the ip settings on the Ethernet interface, in this case it will be em0. We indicate for him only the speed of the port, the duplex and the fact that it is UP.

What it looks like on the server in /etc/rc.conf:

ifconfig_em0="up media 100baseTX mediaopt full-duplex"

We denote for the system vlans, these will be the vlan names specifically for FreeBSD, but not the vlan numbers through which we will work, that is, which are spelled out on the piece of iron into which we join, for example, in a certain tsiska.

cloned_interfaces="vlan0 vlan1"

Customize our vlans

ifconfig_vlan0="vlan 1 vlandev em0 ip netmask mtu 1500"
ifconfig_vlan1="vlan 2 vlandev em0 ip netmask mtu 1500"


Accordingly, on the network equipment in which the server is turned on, vlans must be configured: 2 — the outside world, 1 — the local network.

Details:
ifconfig_vlan0 is the name of the vlan on the FreeBSD system

vlan 1 - specify the number of vlan in the network

vlandev em0 - we send it to work via ethernet em0

mtu 1500 - set the MTU (Maximum packet size) to 1500

The final touch - we prescribe the default gateway

default_router = "Default Gateway"

There is no description of network equipment settings here, since the post refers specifically to FreeBSD. How to configure a VLAN on CISCO I think zepps will tell us in its series of articles on CISCO

PS: This is my first topic, please do not kick with your legs =)

Source: https://habr.com/ru/post/43108/


All Articles