====== Использование протокола 802.1q ====== ===== Настройка cisco коммутатора ===== ==== Настройка vlan ==== === Вариант 1 === conf terminal vtp mode transparent vlan 2 name LAN2 end show vlan === Вариант 2 === !!! В эмуляторе GNS не сохраняет vlan.dat при выключении !!! vlan database vtp transparent vlan 2 name LAN2 exit show vlan-switch ==== Настройка интерфейсов ==== !!!switch1_2# conf terminal interface FastEthernet0/1 ! desc linux server ! switchport trunk encapsulation dot1q ! для старых серий, в GNS3 не нужно switchport mode trunk interface FastEthernet0/2 ! desc windows client1 switchport mode access switchport access vlan 2 ! spanning-tree portfast ! ИЛИ interface FastEthernet0/2 desc uplink to switch3 switchport mode trunk !!!switch3# interface Port-channel1 desc uplink to CORE (switch1 and switch2) switchport mode trunk interface FastEthernet0/2 !interface range f0/2 - 4 ! desc windows client1 switchport mode access switchport access vlan 2 ===== Настройка Linux системы ===== !!! При использовании в системе docker потребовалась перезагрузка linuxgate# cat /etc/sysctl.conf ... net.ipv4.ip_forward=1 ... # sysctl -f ==== Debian ifupdown ==== root@server:~# apt install vlan root@server:~# cat /etc/network/interfaces ... auto vlan2 iface vlan2 inet static address 192.168.100+X.1 netmask 255.255.255.0 mtu 1500 vlan_raw_device eth1 # vlan_raw_device bond0 root@server:~# ifup vlan2 Удалить интерфейс можно: root@server:~# vconfig rem vlan2 Removed VLAN -:vlan2:- ==== Ubuntu netplan ==== * [[https://itproffi.ru/nastrojka-seti-cherez-netplan-v-ubuntu-17-10-i-vyshe/|Настройка сети через Netplan в Ubuntu 17.10 и выше]] server# cat /etc/netplan/01-netcfg.yaml ... vlans: vlan2: id: 2 link: bond0 addresses: [192.168.100+X.1/24] server# netplan apply ==== CentOS/SL ==== [root@server ~]# sysctl net.ipv4.ip_forward=1 [root@server ~]# grep ip_forw /etc/sysctl.conf net.ipv4.ip_forward=1 [root@server ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0.2 DEVICE=eth0.2 BOOTPROTO=STATIC IPADDR=192.168.106.1 NETMASK=255.255.255.0 VLAN=yes ONBOOT=yes [root@server ~]# ifup eth0.2 ==== FreeBSD ==== [server:~] # ifconfig vlan2 create [server:~] # ifconfig vlan2 inet 192.168.100+X.1/24 vlan 2 vlandev em1 [server:~] # sysctl net.inet.ip.forwarding=1 Для сохранения параметров после перезагрузки необходимо: [server:~] # cat /etc/rc.conf ... cloned_interfaces="vlan2" ifconfig_vlan2="inet 192.168.100+X.1/24 vlan 2 vlandev em1" gateway_enable=yes