Internet --> Ubuntu Server (GW) --> Mikrotik --> End Device (GW1 & 2)
- Ubuntu Server has 2 Interfaces, one interfaces from Internet one again for Mikrotik
- Ubuntu Server has 3 VLAN to Mikrotik with Single Interface
- Mikrotik just VLAN Trunking Roles
- End Devices consume VLAN Tagging from Mikrotik
- GW1 default route on vlan1
- GW2 default route on vlan10
modprobe 8021q
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: yes
match:
macaddress: 00:50:00:00:01:00
dhcp6: no
ens4:
dhcp4: no
match:
macaddress: 00:50:00:00:01:01
dhcp6: no
addresses: [192.168.1.1/24]
mtu: 1500
nameservers:
addresses: [172.20.0.1]
vlans:
vlan1:
id: 1
link: ens4
addresses: [10.1.10.1/24]
vlan10:
id: 10
link: ens4
addresses: [10.100.100.1/24]
vlan20:
id: 20
link: ens4
addresses: [20.0.0.1/24]
sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: no
match:
macaddress: 00:50:00:00:04:00
dhcp6: no
vlans:
vlan1:
id: 1
link: ens3
addresses: [10.1.10.3/24]
gateway4: 10.1.10.1
nameservers:
addresses:
- 10.1.10.1
vlan10:
id: 10
link: ens3
addresses: [10.100.100.3/24]
vlan20:
id: 20
link: ens3
addresses: [20.0.0.3/24]
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: no
match:
macaddress: 00:50:00:00:03:00
dhcp6: no
vlans:
vlan1:
id: 1
link: ens3
addresses: [10.1.10.4/24]
vlan10:
id: 10
link: ens3
addresses: [10.100.100.4/24]
gateway4: 10.100.100.1
nameservers:
addresses:
- 10.100.100.1
vlan20:
id: 20
link: ens3
addresses: [20.0.0.4/24]
- Create a bridge on Mikrotik CHR with the command
/interface bridge add name = bridge1
- Add the interface to be trunked to the bridge. For example, if the interfaces to be trunked are ether1 and ether2, then the command would be:
/interface bridge add bridge=bridge1 interface=ether1,ether2
- Create a VLAN on Mikrotik CHR with the command
/interface vlan add name = vlan10 vlan-id = 10 interface = bridge1
- Do step 3 to create another VLAN, for example VLAN 20.
- Set the IP address for each VLAN. For example, to assign an IP address to VLAN 10, use the command
/ip address add address=192.168.10.1/24 interface=vlan10