Narzędzia użytkownika

Narzędzia witryny


tutoriale:ospf_vlan_mt

To jest stara wersja strony!


Konfiguracja OSPF i VLAN na MikroTiku

Połączyłem urządzenia zgodnie ze schematem (żadne z urządzeń nie było wirtualizowane)

Skonfigurowałem router R1 zgodnie z skryptem poniżej

# may/24/2021 17:22:12 by RouterOS 6.48.2
# software id = ********
#
# model = RB941-2nD
# serial number = **********
/interface wireless
set [ find default-name=wlan1 ] ssid=MikroTik
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp_pool0 ranges=10.42.1.2-10.42.1.254 #skonfigurowałem server dhcp za pomocą narzędzia DHCP setup
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=ether3 name=dhcp1 #server został uruchomiony na porcie ether3
/ip address
add address=10.0.0.1/30 interface=ether2 network=10.0.0.0  
add address=10.42.1.1/24 interface=ether3 network=10.42.1.0 #adresacja interfejsów potrzebna do działania sieci
/ip dhcp-client
add disabled=no interface=ether1 #ustawiłem klienta dhcp na interfejsie od strony publicznej
/ip dhcp-server lease
add address=10.42.1.100 client-id=1:54:4:a6:35:95:55 mac-address=\
54:04:A6:35:95:55 server=dhcp1 #rezerwacja adresu
/ip dhcp-server network
add address=10.42.1.0/24 dns-server=10.0.0.2 gateway=10.42.1.1 #R2 jest serwerem DNS w naszej sieci wiec na niego będziemy przesyłać żądania DNS
/ip dns
set allow-remote-requests=yes servers=8.8.8.8 #R2 będzie wracał do R1 żądania których nie zna te natomiast chcemy podać na serwer googla
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether1 #ustawiłem translację NAT 
/routing ospf network
add area=backbone network=10.42.1.0/24
add area=backbone network=10.0.0.0/30 #dodałem sieci do routing dynamicznego
/system clock
set time-zone-name=Europe/Warsaw
/system identity
set name=R1

Skonfigurowałem R2 zgodnie ze skryptem poniżej

# jan/02/1970 01:43:57 by RouterOS 6.45.9
# software id = **********
#
# model = RB941-2nD
# serial number = ***********
/interface wireless
set [ find default-name=wlan1 ] ssid=MikroTik
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp_pool0 ranges=10.42.2.2-10.42.2.254
add name=dhcp_pool1 ranges=10.42.3.2-10.42.3.254 #tutaj mamy pule dla servera DHCP dla VLAN 20 i LAN3 (sieć z laptopem ASUS)
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=ether2 name=dhcp1
add address-pool=dhcp_pool1 disabled=no interface=ether3 name=dhcp2 # tutaj definiujemy odpowiednie interfejsy dla tych sieci
/ip address
add address=10.42.3.1/24 interface=ether3 network=10.42.3.0
add address=10.0.0.2/30 interface=ether1 network=10.0.0.0
add address=10.42.2.1/24 interface=ether2 network=10.42.2.0 #adresy zgodne ze schematem
/ip dhcp-server lease
add address=10.42.2.100 client-id=1:ec:f4:bb:57:52:33 mac-address=\
    EC:F4:BB:57:52:33 server=dhcp1
add address=10.42.3.100 client-id=1:0:e0:4d:3c:8d:92 mac-address=\
    00:E0:4D:3C:8D:92 server=dhcp2 #rezerwacja adresów
/ip dhcp-server network
add address=10.42.2.0/24 dns-server=10.42.2.1 gateway=10.42.2.1
add address=10.42.3.0/24 dns-server=10.42.3.1 gateway=10.42.3.1 #odpowiednie adresy serwerów dns R2 w naszej sieci pełni rolę lokalnego serwera dns
/ip dns
set allow-remote-requests=yes servers=10.0.0.2,10.42.2.1,10.42.3.1,10.0.0.1 #pierwszy adres odpowiada adresowi w sieci routerowej na którym router może otrzymać rządania DNS, drugi adres odpowiada za serwer DNS VLAN20, trzeci adres odpowiada za LAN3, natomiast ostatni odsyła wszystkie nie znane rządania z powrotem na router R1 który przekazuje je na dns.google 8.8.8.8
/ip dns static
add address=10.42.1.100 name=win10box.local #tutaj mamy ustawione statyczne 
add address=10.42.2.100 name=alien.local #zasady dns
add address=10.42.3.100 name=asus.local
/routing ospf network
add area=backbone network=10.0.0.0/30
add area=backbone network=10.42.2.0/24
add area=backbone network=10.42.3.0/24 #skonfigurwany routing OSPF
/system identity
set name=R2

Skonfigurowałem MikroTika jako switcha zgodnie ze skryptem poniżej

# jan/02/1970 00:03:02 by RouterOS 6.45.9
# software id = *******
#
# model = RB941-2nD
# serial number = *******
/interface bridge
add name=bridge1 vlan-filtering=yes #stworzyłem bridge z filtrowaniem vlanowym
/interface wireless
set [ find default-name=wlan1 ] ssid=MikroTik
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/interface bridge port
add bridge=bridge1 interface=ether1 pvid=10 #dodałem porty do przynależących im vlanom
add bridge=bridge1 interface=ether2 pvid=10
add bridge=bridge1 interface=ether3 pvid=20
add bridge=bridge1 interface=ether4 pvid=20
/interface bridge vlan
add bridge=bridge1 untagged=ether1,ether2 vlan-ids=10 #dodałem porty nietagowane (takie które należą do jednego vlanu) do danych vlanów
add bridge=bridge1 untagged=ether3,ether4 vlan-ids=20
/system identity
set name=SW1

Testy

Urządzenie Polecenie Wynik polecenia
WIN10BOX nslookup alien.local
WIN10BOX ping 8.8.8.8
WIN10BOX ping alien.local
Alienware17WIN ping win10box.local
Alienware17WIN ping google.com
Alienware17WIN ping 10.42.3.100
ASUS ping 8.8.8.8
ASUS nslookup alien.local
tutoriale/ospf_vlan_mt.1746716376.txt.gz · ostatnio zmienione: 2025/05/08 16:59 przez administrator