Monday, August 31, 2020

Mikrotik SMS Settings Configuration step by step

One of the many features of Mikrotik router is, to send SMS using GSM modem. Using this feature, we can send notifications of any event in the form of SMS to the user's mobile phone.

And to send this SMS, mikrotik router has to be connected to the mobile network. We can easily do this connection using a USB modem.

However, not all USB modems are supported by  mikrotik router. Mikrotik company has published a list of all the modems that will support, on their own website. The link is given below:-


In addition to the models mentioned in the list, it also supports almost all the modems available in the market. As we have used a simple modem in this tutorial, which is not in the compatible list of mikrotik.  However, this modem supports by router. If a modem is compatible with the mikrotik router, then the router will show the information of that modem in its USB list, when the modem is connecting to the router,. It will also create a "PPP Client Apapter" for him. We used a modem from Qualcomm and it shows up in the middle of the list.


To view this USB list, we first go to System -> Resource. We can see this list by clicking on the USB button there.


In addition to showing in this list, the router will create a “PPP Client” adapter for our modem and show it in the PPP interface list. However, this interface will remain disabled.


If a modem does not automatically detect by router, then we must assume that, this modem is not mikrotik compatible.

Now we will open the adapter to connect the modem and provide the APN information of the modem.


This APN information can be obtained from the SIM operator. Another thing we need to note is, whether the modem port is automatically detected. If not, then we have to manually select it.


Then we go to "Advanced Mode". For that, you just have to click on the “Advanced Mode” button.


After accessing the “Advanced Mode” we will go to the “PPP” tab. There we have to enter a dial number in the “Phone” field. Usually the number is "* 99 #". The number may also change from country to country. You can get this number from SIM operators. However, in most countries the number is "* 99 #".


After enabling and applying, the status of our adapter will change to "waiting for packets".


If everything is OK, after a while the status will be changed by "Link established" and then "connected".


Mikrotik communicates with the modem using a specific channel and sends SMS through that channel. The user has to specify this channel number while sending SMS. If for some reason the mikrotik router cannot communicate with that channel, then the following error notification will be showed.

Couldn’t perform action – no such channel (6)



Many users make a mistake in entering this channel number. Here, they assign the channel number of the USB port. One thing to note here is that , even though we select the modem's USB as the port when sending SMS, but the router basically uses the serial port channel number as SMS sending channel. Does not use channel number of USB port. So when we assign the channel number of the USB port, the router fails to send an SMS using that channel and shows the error message.

So the solution to this problem is, we have to use the channel number of the serial port. We will select USB as the port and assign the number for the channel of the serial port.


We can find out the channel number of a port from the "port list".


And we will get access to “Port List” from “System - Port” location.


After the modem is successfully connected to the router, we can send a message with the help of some script. These scripts will run when it will meet some criteria.

For example, we will monitor our gateway link using mikrotik's netwatch tool. The IP of our gateway is 8.8.8.8. Whenever our gateway link will go down, we will get a notification in the form of SMS. In the same way, when the link will go up, the notification will come in the form of SMS.

To do this we will create two different scripts. One script will work if the link goes down and the other will work if the link goes up. And this link status will be checked by the "netwatch" tool.

The script for link down is: -

tool sms send message="link down" phone-number=your_mobile_number channel=your_channel_number port=Your_port

For example:-

tool sms send message="link down" phone-number=123456 channel=3 port=usb3

The script for link up is: -

tool sms send message="link up" phone-number=your_mobile_number channel=your_channel_number port=Your_port

For example:-

tool sms send message="link up" phone-number=123456 channel=3 port=usb3


Below, the whole process is shown graphically: -

Connect your mikrotik via winbox. Then go to "Netwatch" from "Tools".


Now click on add (+) sign to create a new entry.


Now, our host address will be 8.8.8.8 (as per our example). Router will check this link by "1" minute interval. If the router doesn't get any response under 1000 millisecond, then the link will be considered as down.


Now, we are going to add "Up" script and "Down" script. If the link goes down, then down script will be executed and the same time, when the link will get back then the up script will be executed.

To add "Down" script, we have to navigate "Down" tab. And there we will write the script to send sms to mobile phone.


Now, to add "Up" script go to "Up" tab.


Finally then, click on "Apply" and then "Ok". The entry will be look like this:-


From now on, if the link status goes down, then it will execute "Down" script and when the link get back, then it will execute "Up" script.

We can send message graphically without script. Go to "SMS" from "Tool" menu. And click on "Send SMS" from that interface. 



Done.

Mikrotik Send SMS

Mikrotik router send notifications of various information in the form of SMS to the admin related to the events of the network. And to send this SMS, mikrotik router has to be connected to the mobile network. We can easily do this connection using a USB modem. However, not all USB modems are supported by  mikrotik router. Mikrotik company has published a list of all the modems that will support, on their own website. The link is given below:-

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

However, many modems are available that are supported by the mikrotik router, not mentioned in this list. How to connect a modem to a router is discussed in detail in the link below.

https://mo-nirul.blogspot.com/2020/07/mikrotik-connect-usb-modem.html

After the modem is successfully connected to the router, we can send a message with the help of some script. These scripts will run when it will meet some criteria.

For example, we will monitor our gateway link using mikrotik's netwatch tool. The IP of our gateway is 8.8.8.8. Whenever our gateway link will go down, we will get a notification in the form of SMS. In the same way, when the link will go up, the notification will come in the form of SMS.

To do this we will create two different scripts. One script will work if the link goes down and the other will work if the link goes up. And this link status will be checked by the "netwatch" tool.

The script for link down is: -

tool sms send message="link down" phone-number=your_mobile_number channel=your_channel_number port=Your_port

For example:-

tool sms send message="link down" phone-number=123456 channel=3 port=usb3

The script for link up is: -

tool sms send message="link up" phone-number=your_mobile_number channel=your_channel_number port=Your_port

For example:-

tool sms send message="link up" phone-number=123456 channel=3 port=usb3

Below, the whole process is shown graphically: -

Connect your mikrotik via winbox. Then go to "Netwatch" from "Tools".



Now click on add (+) sign to create a new entry.



Now, our host address will be 8.8.8.8 (as per our example). Router will check this link by "1" minute interval. If the router doesn't get any response under 1000 millisecond, then the link will be considered as down.


Now, we are going to add "Up" script and "Down" script. If the link goes down, then down script will be executed and the same time, when the link will get back then the up script will be executed.

To add "Down" script, we have to navigate "Down" tab. And there we will write the script to send sms to mobile phone.



Now, to add "Up" script go to "Up" tab.



Finally then, click on "Apply" and then "Ok". The entry will be look like this:-



From now on, if the link status goes down, then it will execute "Down" script and when the link get back, then it will execute "Up" script.

Done.

IIS HTTP Error 500.19 Internal Server Error

Internet Information Services (IIS), which is the default web service or web server for windows server operating system. The server on which this service will be installed, will play a role as a web server. This IIS service can be installed using Windows's "Server Manager" tools. The web page that is placed in the "wwwroot" directory of this web server, is displayed in the web browser.



This IIS service depends on some other service to work on its own. So when installing this service, you have to install some extra features, which work in conjunction with IIS. If for some reason those features are not installed, then IIS displays different types of error message. Today, we will discuss an error message in this tutorial.



After installing and configuring the new IIS, when we go to browse the web page, the above configuration error shows. The complete error is given below: -


When installing the IIS service, if we do not install the "Application Development Feature" then the above error message shows. So the solution to this error message is, we need to install the "Application Development Feature". We will install all the features but without the CGI feature. The whole process is shown below step by step: -

First we will open the "Server Manager" tools. In this tutorial, we will use windows server 2016 operating system.


Now we will click on “Add Roles and Features”.


Now we will click on “Next”.


Now select “Role based or Feature based installation” and then click on “Next”.


Now we will select the server from “Server Pool” then we will click on “Next”.


Now we will expand the role of "web server (IIS)". Then we will expand the "web server" again.


Now we will expand “Application Development”. Then we will select all the features except the CGI feature. Then we will do next.


Then we will do it again "next".


Then we will install it. All our work is over. Now we will restart the IIS service. I hope it will not show any error message. Our page will be loaded.

 

Sunday, August 30, 2020

This Configuration Section Cannot be Used at this Path

Internet Information Services (IIS), which is the default web service or web server for windows server operating system. The server on which this service will be installed, will play a role as a web server. This IIS service can be installed using Windows's "Server Manager" tools. The web page that is placed in the "wwwroot" directory of this web server, is displayed in the web browser.


This IIS service depends on some other service to work on its own. So when installing this service, you have to install some extra features, which work in conjunction with IIS. If for some reason those features are not installed, then IIS displays different types of error message. Today, we will discuss an error message in this tutorial.

Config Error: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".


After installing and configuring the new IIS, when we go to browse the web page, the above configuration error shows. The complete error is given below: -



When installing the IIS service, if we do not install the "Application Development Feature" then the above error message shows. So the solution to this error message is, we need to install the "Application Development Feature". We will install all the features but without the CGI feature. The whole process is shown below step by step: -

First we will open the "Server Manager" tools. In this tutorial, we will use windows server 2016 operating system.



Now we will click on “Add Roles and Features”.



Now we will click on “Next”.



Now select “Role based or Feature based installation” and then click on “Next”.



Now we will select the server from “Server Pool” then we will click on “Next”.



Now we will expand the role of "web server (IIS)". Then we will expand the "web server" again.



Now we will expand “Application Development”. Then we will select all the features except the CGI feature. Then we will do next.



Then we will do it again "next".


Then we will install it. All our work is over. Now we will restart the IIS service. I hope it will not show any error message. Our page will be loaded.

Mikrotik USB Modem Setup

Currently there are usb ports available in almost all mikrotik routers. Using this USB port we can connect USB modem with mikrotik router. However, the modem must be mikrotik compatible. A list of modems that are compatible with mikrotik routers can be found at the link below. 

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

In addition to the models mentioned in the list, it also supports almost all the modems available in the market. As we have used a simple modem in this tutorial, which is not in the compatible list of mikrotik.  However, this modem supports by router. If a modem is compatible with the mikrotik router, then the router will show the information of that modem in its USB list, when the modem is connecting to the router,. It will also create a "PPP Client Apapter" for him. We used a modem from Qualcomm and it shows up in the middle of the list.



To view this USB list, we first go to System -> Resource. We can see this list by clicking on the USB button there.



In addition to showing in this list, the router will create a “PPP Client” adapter for our modem and show it in the PPP interface list. However, this interface will remain disabled.



If a modem does not automatically detect by router, then we must assume that, this modem is not mikrotik compatible.

Now we will open the adapter to connect the modem and provide the APN information of the modem.



This APN information can be obtained from the SIM operator. Another thing we need to note is, whether the modem port is automatically detected. If not, then we have to manually select it.



Then we go to "Advanced Mode". For that, you just have to click on the “Advanced Mode” button.



After accessing the “Advanced Mode” we will go to the “PPP” tab. There we have to enter a dial number in the “Phone” field. Usually the number is "* 99 #". The number may also change from country to country. You can get this number from SIM operators. However, in most countries the number is "* 99 #".



After enabling and applying, the status of our adapter will change to "waiting for packets".



If everything is OK, after a while the status will be changed by "Link established" and then "connected".




At this stage our modem is now connected to the Internet. Now, to share this internet connection with users, we need to configure Source NAT using PPP client adapter. To configure NAT, we will go to “IP -> Firewall”. From there we will select “NAT”.


Now we will add a “src nat” rule by clicking on the “add (+)” button. Here we will select “srcnat” in the “Chain” field and have to select the PPP client adapter in the “Out Interface” field.


Now we will select "masquerade" as action.


Done. From now on all users will be able to connect to the internet using GSM modem.