Ignore:
Timestamp:
Apr 6, 2015, 1:03:33 PM (10 years ago)
Author:
chronos
Message:
  • Added: Support for Internet free access. Unregistered users are redirected to activation page where they can found useful information and activate free access for 24 hours.
Location:
trunk/Modules/NetworkConfigRouterOS/Generators
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigRouterOS/Generators/FirewallMangle.php

    r617 r735  
    133133// Slow free internet
    134134$PacketMark = GetMarkByComment('free-out');
    135 $ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface, 'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'free-out', 'passthrough' => 'no');
     135$ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface,
     136  'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'free-out', 'passthrough' => 'yes');
    136137$PacketMark = GetMarkByComment('free-in');
    137 $ItemsFirewall[] = array('chain' => 'inet-1-in', 'in-interface' => $InetInterface, 'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'free-in', 'passthrough' => 'no');
    138 
     138$ItemsFirewall[] = array('chain' => 'inet-1-in', 'in-interface' => $InetInterface,
     139        'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'free-in', 'passthrough' => 'no');
     140// Unregistred clients add to address list
     141$ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface, 'src-address' => '10.145.0.0/16',
     142        'action' => 'add-src-to-address-list', 'address-list' => 'unregistred', 'timeout' => '1d',
     143        'comment' => 'unregistred-clients');
    139144
    140145//print_r($ItemsFirewall);
  • trunk/Modules/NetworkConfigRouterOS/Generators/FirewallNAT.php

    r617 r735  
    109109$Items[] = array('chain' => 'dstnat', 'dst-address' => '212.111.4.174', 'protocol' => 'udp', 'dst-port' => 53, 'in-interface' => $InetInterface, 'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 53, 'comment' => 'DNS_redirection_UDP');
    110110
    111 
    112111// Chain for local interface
    113112$Items[] = array('chain' => 'srcnat', 'out-interface' => $LocalInterface, 'action' => 'jump', 'jump-target' => 'local-out', 'comment' => 'local-out');
    114113$Items[] = array('chain' => 'dstnat', 'in-interface' => $LocalInterface, 'action' => 'jump', 'jump-target' => 'local-in', 'comment' => 'local-in');
     114
     115// Accept free-access clients
     116$Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16',
     117        'src-address-list' => 'free-access', 'in-interface' => $LocalInterface,
     118        'action' => 'accept', 'comment' => 'Free_access');
     119// Redirect unregistred clients to free access activation page
     120$Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16',
     121        'src-address-list' => 'unregistred', 'in-interface' => $LocalInterface,
     122        'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 82, 'comment' => 'Redirect_unregistred');
    115123
    116124/*
Note: See TracChangeset for help on using the changeset viewer.