Community discussions

MikroTik App
 
agascha
just joined
Topic Author
Posts: 4
Joined: Sat Oct 28, 2017 5:50 pm
Location: Germany

Help with router configuration for Agascha

Sat Oct 28, 2017 6:38 pm

Hello everybody,

I'm new to this forum, come from Germany and hope to find help with a problem with the configuration of a MikroTik router.

I want to make my friends happy. I have created a simple Java server program, which runs on a laptop with a connected projector. With the program, a slideshow with photos, for example, presented at a wedding, the photos are uploaded live via mobile phones. Everything works very well so far.

Unfortunately, the mobile phone users always have to enter the IP address of the laptop after connecting to the WLAN and since I do not want my friends to set a static IP in their laptop, it unfortunately always changes.

So I thought to intercept the problems of a MikroTik router. Unfortunately I do not know myself with Routing, Routers, DHCP.

So I'll describe what result the configuration should have:
1.) Ethernet 3 should only be reserved for the router configuration.
2.) Ethernet 4 should receive a static IP address for the laptop
3.) WLAN and Ethernet 4 are located in a network
4.) WLAN should receive a DHCP administration
5.) It would be nice, if the mobile phones automatically after the (Hotspot) WLAN connection, with Browseraufruf on the side "http: // <Server IP>" of the Java server further forwarded. Or after a login page, press a button to be redirected to the link (which is easier).

I would be very happy if you write me what I have to configure and how. Best step by step :-)

Many greetings
Your Agascha
 
User avatar
pukkita
Trainer
Trainer
Posts: 3051
Joined: Wed Dec 04, 2013 11:09 am
Location: Spain

Re: Help with router configuration for Agascha

Sun Oct 29, 2017 12:56 pm

Not sure if I understood your situation right.

If you want the laptop acting as server to have a fixed IP, you can still use DHCP.

1.- Go to IP > DHCP Server > Leases and locate the laptop one.
2.- Double click on it, and click on "Make static".

From now on, the laptop will be always offered that same IP via DHCP.

Another enhancement will be using DNS so that users access the service via a FQDN instead of an IP:

1.- Go to IP > DNS and enable "Allow Remote Requests" if it isn't.
2.- Check on IP > DHCP > Networks, that your router LAN IP for the hostpot is on the DNS Server field.

3.- Now go to IP > DNS and click on [Static] button. Add a new entry, setting name to .eg. agascha.local, with the same IP whe checked on step #2.

Now users can type agascha.local to access this service.

If as it seems you're using hotspot service, you can automatically redirect hotspot users after they athenticate by modifying alogin.html hotspot page, setting agascha.local instead of www.example.com in that post.
 
agascha
just joined
Topic Author
Posts: 4
Joined: Sat Oct 28, 2017 5:50 pm
Location: Germany

Re: Help with router configuration for Agascha

Sun Oct 29, 2017 1:28 pm

Hello pukkita,

thanks for your help. Is there no way that the router is set up, which depends on Lan4 always the same IP address? So even with changing laptops on this Ethernet always the same IP receive.

Thank you for your help.

Greetings Agascha
 
idlemind
Forum Guru
Forum Guru
Posts: 1146
Joined: Fri Mar 24, 2017 11:15 pm
Location: USA

Re: Help with router configuration for Agascha

Sun Oct 29, 2017 2:51 pm

Hello pukkita,

thanks for your help. Is there no way that the router is set up, which depends on Lan4 always the same IP address? So even with changing laptops on this Ethernet always the same IP receive.

Thank you for your help.

Greetings Agascha
You could do it with scripting, set a short lease time on the DHCP server. Have a script that updates the static lease based on the IP ARP table entry for the Eth4 interface. The first IP the laptop gets likely won't be right but after the script runs on the router it would be updated.

A less difficult solution may be to let the laptop get whatever IP it wants and set a local static DNS entry in the router. Use a script to have the DNS record set to a very short TTL and have the router update the record based on the MAC from IP ARP for Eth4 and the IP address that is assigned to it from DHCP.
 
agascha
just joined
Topic Author
Posts: 4
Joined: Sat Oct 28, 2017 5:50 pm
Location: Germany

Re: Help with router configuration for Agascha

Sun Oct 29, 2017 4:22 pm

Hello idlemind,

Thank you for your effort to help me.

It is very nice that there is a possibility.

Can you please explain to me more exactly what I have to do for this. I'm not so familiar with the router.

I do not understand how I write such a script, or can I download such a script somewhere? I still understand how I get it then in the router.

The laptop should receive the 192.168.100.5 as an IP address.

I would be very happy about further help.

Best regards
Your Agascha
 
agascha
just joined
Topic Author
Posts: 4
Joined: Sat Oct 28, 2017 5:50 pm
Location: Germany

Re: Help with router configuration for Agascha

Mon Oct 30, 2017 8:54 pm

Hello pukkita,

thanks for your help. Is there no way that the router is set up, which depends on Lan4 always the same IP address? So even with changing laptops on this Ethernet always the same IP receive.

Thank you for your help.

Greetings Agascha
You could do it with scripting, set a short lease time on the DHCP server. Have a script that updates the static lease based on the IP ARP table entry for the Eth4 interface. The first IP the laptop gets likely won't be right but after the script runs on the router it would be updated.

A less difficult solution may be to let the laptop get whatever IP it wants and set a local static DNS entry in the router. Use a script to have the DNS record set to a very short TTL and have the router update the record based on the MAC from IP ARP for Eth4 and the IP address that is assigned to it from DHCP.

Hello idlemind,

Thank you for your effort to help me.

It is very nice that there is a possibility.

Can you please explain to me more exactly what I have to do for this. I'm not so familiar with the router.

I do not understand how I write such a script, or can I download such a script somewhere? I still understand how I get it then in the router.

The laptop should receive the 192.168.100.5 as an IP address.

I would be very happy about further help.

Best regards
Your Agascha
 
idlemind
Forum Guru
Forum Guru
Posts: 1146
Joined: Fri Mar 24, 2017 11:15 pm
Location: USA

Re: Help with router configuration for Agascha

Mon Oct 30, 2017 9:15 pm

Right, you probably need a bit more background in networking. If you choose to do it with the method involving DNS you and your users never need to enter the IP address in the browser. Instead it could just be "http://pictures" for example.

If you choose to manage just the IP address and access it via "http://192.168.100.5" you then need the script to create or modify the static lease for 192.168.100.5.

I don't have a canned thing you can download and it will magically solve the issue. You can however do a bit of learning and knock it out yourself.

https://wiki.mikrotik.com/wiki/Manual:Scripting

Looking at just trying to make a script to update DNS based on whatever is plugged into Ether2:

1. Look at /ip arp for ether2 and determine the devices MAC address
/ip arp print where interface=ether2
2. Look at /ip dhcp-server lease for the MAC address in step 1 and determine it's IP address
/ip dhcp-server lease print where mac-address=$Step1MacAddress
3. Check the DNS record in the local /ip dns static to see if the name "pictures" matches the IP address found in step 2. If not, update the record.
/ip dns static print where name=pictures
/ip dns static set [ find where name=pictures ] address=$Step2IpAddress

Who is online

Users browsing this forum: adwlodaro, Exabot [Bot], Minions70, SpirosR and 108 guests