Monday, July 26, 2010

SETUP MIKROTIK AS GATEWAY

Posted by Syarif | Monday, July 26, 2010 | Category: |

Now, I will let you know how to setup MIkrotik as Gateway server.

  1. First, install Mikrotik RouterOS on your server PC.
  2. Login mikrotik with console.

MikroTik v2.9.7

Login: admin

Password:

3. After that, you can go inside on Mikrotik Server. Your username is “admin” and without password by default.

4. If you want to setup password:

[admin@Mikrotik] > password

old password: ****

new password: *******

retype new password: *******

[admin@ Mikrotik]] >

5. To identify your interface on your PC that installed on MIkrotik

[admin@Mikrotik] > 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

2 R ether2 ether 0 0 1500

[admin@Mikrotik] >

6. Give IP address on every interface that you’ve installed.

[admin@Mikrotik] > ip address add address=192.168.0.1

netmask=255.255.255.0 interface=ether1

[admin@Mikrotik] > ip address add address=172.16.0.1

netmask=255.255.255.0 interface=ether2

7. To see the configuration of IP address:

[admin@Mikrotik] >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 172.16.0.1/24 172.16.0.0 172.16.0.255 ether2

[admin@Mikrotik] >

8. Give the default gateway. For the example, gateway for internet connection is 192.168.0.254

[admin@Mikrotik] > /ip route add gateway=192.168.0.254

9. Now, see the routing table on Mikrotik System.

[admin@Mikrotik] > ip route print

Flags: X - disabled, A - active, D - dynamic,

C - connect, S - static, r - rip, b - bgp, o - ospf

# DST-ADDRESS PREFSRC G GATEWAY DISTANCE INTERFACE

0 ADC 172.16.0.0/24 172.16.0.1 ether2

1 ADC 192.168.0.0/26 192.168.0.1 ether1

2 A S 0.0.0.0/0 r 192.168.0.254 ether1

[admin@Mikrotik] >

10. Test connection to gateway to make sure the configuration is correct.

[admin@Mikrotik] > ping 192.168.0.254

192.168.0.254 64 byte ping: ttl=64 time<1>

192.168.0.254 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@Mikrotik] >

11. Setup the DNS on MIkrotik.

[admin@Mikrotik] > ip dns set primary-dns=192.168.0.10 allow-remoterequests=no

[admin@Mikrotik] > ip dns set secondary-dns=192.168.0.11 allow-remoterequests=no

12. To see the configuration of DNS:

[admin@Mikrotik] > ip dns print

primary-dns: 192.168.0.10

secondary-dns: 192.168.0.11

allow-remote-requests: no

cache-size: 2048KiB

cache-max-ttl: 1w

cache-used: 16KiB

[admin@Mikrotik] >

13. To test the connection, just use “ping” command to domain:

[admin@Mikrotik] > ping yahoo.com

216.109.112.135 64 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@Mikrotik] >

14. Setup masquerading. If Mikrotik that we used as gateway server, we should masquerading due to be connected into internet.

[admin@Mikrotik] > ip firewall nat add action=masquerade outinterface= ether1 chain: srcnat

[admin@Mikrotik] >

15. To see the configuration of Masquerading:

[admin@Mikrotik] ip firewall nat print

Flags: X - disabled, I - invalid, D - dynamic

0 chain=srcnat out-interface=ether1 action=masquerade

[admin@Mikrotik] >

Currently have 0 comments:


Leave a Reply