Tuesday, May 31, 2016

2 WANS ''WAN-1 FOR PPPoE USERS''---''WAN-2 FOR HOTPSOT USERS''




/interface ethernet
set [ find default-name=ether1 ] name=ether1-Wan1
set [ find default-name=ether2 ] name=ether2-Wan2
set [ find default-name=ether3 ] name=ether3-PPPoE
set [ find default-name=ether4 ] name=ether4-Hotspot
set [ find default-name=ether5 ] name=ether5
/ip address
add address=192.168.10.2/24 interface=ether1-Wan1 network=192.168.10.0
add address=192.168.11.2/24 interface=ether2-Wan2 network=192.168.11.0
add address=10.10.0.1/24 interface=ether3-PPPoE network=10.10.0.0
add address=192.168.50.1/24 interface=ether4-Hotspot network=192.168.50.0
/ip route
add distance=1 gateway=192.168.10.1
add distance=1 gateway=192.168.11.1
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip firewall nat
add action=masquerade chain=srcnat comment="WAN1 MASQUERADE" out-interface=ether1-Wan1
add action=masquerade chain=srcnat comment="WAN2 MASQUERADE" out-interface=ether2-Wan2
add action=masquerade chain=srcnat disabled=no src-address=\
    172.16.1.2-172.16.1.254
add action=masquerade chain=srcnat comment="masquerade hotspot network" \
    src-address=192.168.50.0/24
/ip firewall mangle
add action=mark-routing chain=prerouting comment="PPPoE GO THAROUGH WAN1" new-routing-mark=pppoe-wan1 src-address=172.16.1.2-172.16.1.254
add action=mark-routing chain=prerouting comment="HOTSPOT GO THAROUGH WAN2" new-routing-mark=hotspot-wan2 src-address=192.168.50.0/24
/ip route
add distance=1 gateway=192.168.10.1 routing-mark=pppoe-wan1
add distance=1 gateway=192.168.11.1 routing-mark=hotspot-wan2
/system note set note="Server Configuration By <HAMZA KHALIL> (www.itlearnweb.com)" show-at-login=yes
/ip pool
add name=ppp ranges=172.16.1.2-172.16.1.254
add name=hs-pool-4 ranges=192.168.50.2-192.168.50.254
: log warning "PPPoE setup is started by Hamza Khalil"
/interface pppoe-server server
add authentication=pap,chap default-profile=default disabled=no interface=\
    ether3-PPPoE keepalive-timeout=10 max-mru=1480 max-mtu=1480 max-sessions=0 mrru=\
    disabled one-session-per-host=yes service-name=service1
/ppp profile
set 0 change-tcp-mss=yes dns-server=10.10.0.1,192.168.10.1 local-address=\
    10.10.0.1 name=default only-one=default remote-address=ppp use-compression=\
    default
add change-tcp-mss=default dns-server=10.10.0.1,192.168.10.1 local-address=\
    10.10.0.1 name=2MB only-one=yes rate-limit=500K/2M remote-address=ppp \
    use-compression=default
add change-tcp-mss=default dns-server=10.10.0.1,192.168.10.1 local-address=\
    10.10.0.1 name="my profile" only-one=default remote-address=ppp \
    use-compression=default
: log warning "PPPoE setup is completed by Hamza Khalil"
: log warning "Hotspot setup is starting by Hamza Khalil"
/ip hotspot profile
add dns-name=login.net hotspot-address=192.168.50.1 login-by=\
    http-chap,https,http-pap name=hsprof1
/ip hotspot user profile
set [ find default=yes ] idle-timeout=none keepalive-timeout=2m \

    mac-cookie-timeout=3d
/ip dhcp-server
add address-pool=hs-pool-4 disabled=no interface=ether4 lease-time=1h name=\
    dhcp1
/ip hotspot
add address-pool=hs-pool-4 disabled=no interface=ether4 name=hotspot1 profile=\
    hsprof1
/ip dhcp-server network
add address=192.168.50.0/24 comment="hotspot network" gateway=192.168.50.1
: log warning "full setup is completed by Hamza Khalil"

DOWNLOAD BACKUP FILE AND SCRIPT

4 comments: