Friday, January 21, 2011

Installation Mikrotik as Gateway

Installation Mikrotik as Gateway

The following steps are the basics of setup mikrotik configured for a simple network as a gateway server.

1. The first step is to install RouterOS on your PC



2. Log In Mikrotik Routers via console:
MikroTik v2.9.7
Login: admin
Password: (empty)

Until this step we can go on Mikrotik machine. The default user is admin
and without a password, just type admin and press the enter key.

3. To change the default password security
[Admin @ Mikrotik]> password
old password: *****
New password: *****
Retype new password: *****
[Admin @ Mikrotik]]>

4. Changing the name of the Mikrotik Router, in this step the server name will be changed to "killnine" (the name is free's up if you want to be replaced)
[Admin @ Mikrotik]> system identity set name = killnine
[Admin @ killnine]>

5. Viewing interface on Router Mikrotik
[Admin @ killnine]> interface print
Flags: X - disabled, D - dynamic, R - running
# NAME TYPE RX-RATE TX-RATE MTU
0 R ether1 ether 0 0 1500
1 R ether2 ether 0 0 1500
[Admin @ killnine]>

6. Provides the IP address on the interface Mikrotik. Suppose ether1 we will use to connect to the Internet with IP 192.168.0.1 and ether2 we will use for our local network with IP 192.168.0.254

[Admin @ killnine]> ip address add address = 192.168.0.1
netmask = 255.255.255.0 interface = ether1
[Admin @ killnine]> ip address add address = 192.168.0.254
netmask = 255.255.255.0 interface = ether2


7. Viewing the IP address configuration that we have given
[Admin @ killnine]> ip address print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK BROADCAST INTERFACE
0 192.168.0.1/24 192.168.0.0 192.168.0.63 ether1
1 192.168.0.254/24 192.168.0.0 192.168.0.255 ether2
[Admin @ killnine]>

8. Provide default gateway, it is assumed gateway for internet connection is 192.168.1.1
[Admin @ killnine]> / ip route add gateway = 192.168.1.1


9. Viewing the routing table on Mikrotik Routers
[Admin @ killnine]> ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - OSPF
# DST-ADDRESS G GATEWAY DISTANCE INTERFACE PREFSRC
0 ADC 192.168.0.0/24 192.168.0.254 ether2
1 ADC 192.168.0.0/24 192.168.0.1 ether1
2 A S 0.0.0.0 / 0 r 192.168.1.1 ether1
[Admin @ killnine]>

10. Ping test to the Gateway to ensure correct configuration
[Admin @ killnine]> ping 192.168.1.1
192.168.1.1 64 byte ping: ttl = 64 time <1>
192.168.1.1 64 byte ping: ttl = 64 time <1>
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min / avg / max = 0/0.0/0 ms
[Admin @ killnine]>

11. Setup DNS on Mikrotik Routers
[Admin @ killnine]> ip dns set primary-dns = 202.134.0.155 allow-remoterequests = no
[Admin @ killnine]> ip dns set secondary-dns = 202.134.1.10 allow-remoterequests = no

12. Looking at the DNS configuration
[Admin @ killnine]> ip dns print
primary-dns: 202.134.0.155
secondary-dns: 202.134.1.10
allow-remote-requests: no
cache-size: 2048KiB
cache-max-ttl: 1W
cache-Used: 16KiB
[Admin @ killnine]>

13. Tests for domain access, for example by pinging a domain name
[Admin @ killnine]> ping yahoo.com
64 216 109 112 135 byte ping: ttl = 48 time = 250 ms
10 packets transmitted, 10 packets received, 0% packet loss
round-trip min / avg / max = 571/571.0/571 ms
[Admin @ killnine]>

If you have successfully reply mean DNS settings are correct.

14. Setup Masquerading, if Mikrotik will we use it as a gateway server for client computers on the network can be connected to the internet we need to masquerading.
[Admin @ killnine]> ip firewall nat add action = masquerade outinterface =
ether1 chain: srcnat
[Admin @ killnine]>

15. Looking at the configuration Masquerading
[Admin @ killnine]> ip firewall nat print
Flags: X - disabled, I - invalid, D - dynamic
0 chain = srcnat out-interface = ether1 action = masquerade
[Admin @ XAVIERO]>

After this step can be carried out checks for connections from local network. And if success means we have managed to install Mikrotik Router as a Gateway server.

No comments:

Post a Comment