Routing Mikrotik - networking

The setup: rb2011; routeros 7.3
2 ISPs (1 is turned on while another is turned off)
the router itself as a l2tp client
some static routes before l2tp
I want to be able to redirect all traffice from particular ip from lan to 1ISP before lwtp connection.
I have spent about 4 days of googling, tried it:
This is my answer:
Create Address list:
ip firewall>address-list> add comment="samme comment" address=192.168.0.50-192.168.0.51 list=list50-51
create mangle:
ip firewall mangle> add comment="same comment" chain=prerouting action=mark-routing new-routing-mark=INTERNET-50-51 src-address-list=list50-51
create route:
ip route> add comment="same comment" dst-address=0.0.0.0/0 routing-mark=INTERNET-50-51 gateway=IP of ISP1
create nat
ip firewall>nat> add comment="same comment" chain=srcnat action=masquerade src-address-list=list50-51 dst-address=0.0.0.0/0 out-interface=Interface of ISP1(PPPOE)
But when i put static route, i can't even ping my lan/gateway.
Want to solve this dumb situation.

Related

My Router Internet IP is different from my public IP

I am running a ddns client on Ubuntu for Nextcloud server, however my ISP has done something to the router so internet IP showing in the router is different from my public IP which causes an issue when ddclient updates the IP of my domain.
I have tried to contact my ISP but they want me to pay a huge amount for a fixed IP.
Is there any solution for this?
My router model is HG8245Q2.
*PS: The IP shown in the image is just an example.
Note: I tried this on a another router model HG8245Q, and it gives me the same IP on both router and google. so no issue on the old router model.
The IP address you see in your router is just another internal IP address from private range 10.x.x.x
This means your router is not connected directly to the internet but to another subnet of your ISP. And only this subnet is connected to the internet over another router (with NAT) and this router has a public IP address.
This is standard behavior with most of ISP because they have limited count of public IP addresses. If you need public IP, you have to pay for it, change ISP who gives you one for free or try some edge case solution like rent VPS server and make VPN tunnel to your home router (this requires advanced networking skills)
Maybe DDNS comes in handy for you. You can opt for free DDNS services like DynDDNS or NoIP.
Steps [I personally prefer noip.com ]:
Create a Free Account
Choose a hostname(We can say a domain name pointing towards ur system IP)
Download their desktop client(To sync your Dynamic IP with the hostname you selected)
Boom it's done! Use that hostname instead of IP wherever needed, traffic will be redirected to your system. Just take care of port forwarding and firewall settings.

Mikrotik - Add second WAN IP and route specific traffic

After 20 pages of SO results about Mikrotik and some more google results, I'm come here, down on my knees to request some enlightment.
I have a network with static IP and some public IP (248 mask).
So far I've configured the network to use one of those public IP and use it for 2 subnets (192.168.85.X and 192.168.5.X) wich are isolated from each other and both can access internet.
What I'm trying to achieve is to add a second WAN ip to the router, and route traffic to a specific server to use that IP.
What i mean is:
Any PC from 192.168.85.X should use WAN IP1 and use internet with it.
Any PC from 192.168.85.X trying to access www.facebook.com should use WAN IP2 to browse and navigate to that website (while all the rest of the traffic goes through WAN IP1).
The device that gives me the WAN link only has 1 "out" port, so there is no way to put 2 cables from the "modem" to the Mikrotik, right now there is 1 cable going from the modem to the Mikrotik device. I've seen some forum post where the first part can be solved by just connecting 2 cables and then assign different IP for each interface.
As you may notice, I'm really raw in networking and routing, so any GUI/Winbox instruction is appreciated, but CLI commands would be just fine.
This info is for reference for anyone who may want to do this in the future:
1.- If you assing the IP to the WAN interface using the same notation X.X.X.X/29, the router will know that you want to use all the IP but set the default route to use the given IP as the prefered. This can be looked up in IP > Routes.
2.- If you want to use different IP for different traffic, you have to a) Mark that traffic and b) Force that traffic to go out by an specific IP. You do this in IP > Firewall > Mangle to mark the traffic and IP > Routes to add the new route for that traffic. There are contradictory info about if you need or not to add NAT (IP > Firewall > NAT) rules for the traffic and i'm really lost about it (it doesn't work with or without, but sometimes does work).
This is all i can contribute to this, i'll keep trying to find and answer in serverfault as #SergGr suggested.

NGINX - Server configuration with multiple interfaces

I'm having trouble with nginx during configuration of multiple website. I'm using multiples debian VM's on Virtualbox (Windows, not a choice).
The setup I try to do is :
-One "front" VM with 2 network interfaces, one connected to the internet (NAT), and the other on a subnetwork not connected to internet (NAT network). Nginx bind on the "internet" interface.
-Two "back" VM with apache, each one with only one interface connected to the same subnetwork than the front VM.
The front VM is getting the requests from the client and proxy pass it to the right back-VM.
The problem is that on the front VM, nginx wont redirect on the right interface and try to redirect on the internet interface.
So my question is: can we specify to nginx wich interface to use to redirect the requests ?
Thank in advance for the answers
Hope we are talking about proxy_pass, not redirect.
For that issue there is no configuration parameters in nginx. If your config file is correct, then, I guess you need to setup route from your "front" machine to "back" machines and vice-versa.
First try pinging "back" machines from "front". If it does'n work, then try to add route with ip route or route.
For example, on "front" you have external interface named eth0 and internal named eth1. IP of your "back" machine is 10.0.0.2, then you should add:
ip route add 10.0.0.2/32 dev eth1
I finally found the answer myself, the trick was to use only one interface connected to the nat network and to do a port redirection from the physical interface to the VM inside the nat network.
For it, go to File->Preferences->Network, select your network, click on the screw driver , and then port redirection

Wamp server is unable to access using public ip address

I have trying to connect my phone with the wampserver I created and is looking forward for an OTP based application. I aim to have a different network for both the PC and mobile and look forward to use public IP for accessing. To enable port forwarding I have changed the port in httpd.conf to
Listen 8080
and in my router settings I have added separate entries: one for TCP and one for UDP packets.
Lastly, I have also enabled
# onlineoffline tag - don't remove
Require all granted
in the httpd.conf file as well. Technically, I should be able to access my wampserver by
http://{public IP address}:{8080}/
I have also given access to the port 8080 in my firewall, but when I do check online the status of port in public IP, it shows 8080 port is closed on the {public IP address}. Unfortunately, I am not able to access the following server. I am bit confused at the moment and I guess I am stuck with something really silly. I will be deeply obliged if anyone could help me with the issue.
If your port is still closed / blocked you probably have another router / firewal / ... blocking it. Does your internt providor maybe have a router of their own in front of your router?

does routers have Default Gateway?

Default Gateway is used when the host doesn't have any route information for a particular packet. So it will ask the default gateway.
Now for a router there will be lot of static routing information, but if the router is not able to find a routing information, it should take the route mentioned in 0.0.0.0 (which is called default route). Now is this called Default Gateway of a router?
I read few documentation, but i wasn't able to find an accurate definition for Default Gateway wrt router.
It is possible to have a default gateway (typically noted as a route to 0.0.0.0) for a router. It's also known as the "default route".
A typical case for this is where a router has an upstream ISP that it's using for transit to "the rest of the Internet". In this case, the route for 0.0.0.0 would be set to the IP address of the ISP side of your link to the Internet
For example, in the most basic case on a cisco router, if your side of the ISP link is 1.1.1.1 and the "far side" of the ISP link is 1.1.1.2 you'll use something like:
ip route 0.0.0.0 0.0.0.0 1.1.1.2
...to route traffic that doesn't match any other explicit routes in the routing table, out the ISP's interface. The active connection to your ISP installs a route in your routing table, so you know how to get to 1.1.1.2. So if you're trying to get to an external address (say 10.20.30.40), your router is effectively doing two lookups: first it looks up 10.20.30.40 and sees that it should use the default route, which points to 1.1.1.2. It then sees the connected route for 1.1.1.0\30 in the routing table (which contains 1.1.1.2), and then uses that to route the packet.
The default gateway used on on most routers, for the LAN, will be the private IP of the router itself, ex:
IP Address 192.168.5.100
Subnet Mask 255.255.255.0
Gateway 192.168.5.100
Local DNS 192.168.5.100
The default gateway assigned to the WAN port will be assigned by the ISP provider, if the public interface is connected to such. If not connected, you will probably see 0.0.0.0 assigned to the Gateway and other public ip settings.
yes it has, go to command prompt, type ipconfig/all for windows and for mac https://www.expressvpn.com/support/troubleshooting/find-default-gateway/
you can see the default gateway. in accessing it on browser, type https:// and the ip of your router
It's just a simple task:
Open your network and sharing center.
Click on "change adapter setting on your top right"
Right click on the ethernet adapter
Click on properties
Choose configuration
At your right in thee dialog box, there's an option "Enable". Change it to "Disable"
All done now ... Type 192.168.1.1 in your browser
Voila... It works!

Resources