1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
| # mar/09/1970 09:10:50 by RouterOS 6.23
#配置网桥
/interface bridge
add name=bridge01
#以太网口重命名
/interface ethernet
set [ find default-name=ether1 ] name=ether01
set [ find default-name=ether2 ] name=ether02
set [ find default-name=ether3 ] name=ether03
set [ find default-name=ether4 ] name=ether04
set [ find default-name=ether5 ] name=ether05
set [ find default-name=ether6 ] name=ether06
set [ find default-name=ether7 ] name=ether07
set [ find default-name=ether8 ] name=ether08
set [ find default-name=ether9 ] name=ether09
#邻居发现协议(默认值)
/ip neighbor discovery
set ether01 discover=no
#DHCP范围
/ip pool
add name=default-dhcp ranges=192.168.1.50-192.168.1.199
#DHCP服务
/ip dhcp-server
add address-pool=default-dhcp disabled=no name=default
#管理端口
/port
set 0 name=serial0
#PPPOE拨号配置
/interface pppoe-client
add ac-name="" add-default-route=yes allow=pap,chap,mschap1,mschap2 \
default-route-distance=1 dial-on-demand=yes disabled=no interface=ether01 \
keepalive-timeout=60 max-mru=1480 max-mtu=1480 mrru=disabled name=\
ChinaNet password=******* profile=default service-name="" use-peer-dns=\
no user=0769*******@163.gd
#网桥成员(多个以太网端口)
/interface bridge port
add bridge=bridge01 interface=ether06
add bridge=bridge01 interface=ether07
add bridge=bridge01 interface=ether08
add bridge=bridge01 interface=ether09
add bridge=bridge01 interface=ether10
#IP接口配置(虚拟接口,绑定于bridge01)
/ip address
add address=192.168.1.1/24 interface=bridge01 network=192.168.1.0
#本机作为DHCP客户端的配置
/ip dhcp-client
add comment="default configuration" dhcp-options=hostname,clientid interface=ether01
#DHCP服务网段配置
/ip dhcp-server network
add address=192.168.1.0/24 comment="default configuration" dns-server=192.168.1.1 gateway=192.168.1.1
#DNS服务器配置
/ip dns
set allow-remote-requests=yes servers=202.96.128.86,202.96.128.166
#防火墙filter配置
/ip firewall filter
#--允许icmp协议(ping)的数据包进入所有接口
add chain=input action=accept protocol=icmp
#--允许已经建立连接状态的数据包进入所有接口
add chain=input action=accept connection-state=established
add chain=input action=accept connection-state=related
#--允许目标端口是8080/tcp的数据包进入all-ppp接口
add chain=input dst-port=8080 in-interface=all-ppp protocol=tcp
#--拒接所有(TCP/UDP等)数据包进入all-ppp接口(如果固定IP接口使用ether01)
add chain=input action=drop in-interface=all-ppp
#--允许已经建立连接状态的数据包内核转发
add chain=forward action=accept connection-state=established
add chain=forward action=accept connection-state=related
#--拒绝无效状态的数据包内核转发
add chain=forward action=drop connection-state=invalid
#防火墙nat配置
/ip firewall nat
#--源地址NAT(把内网的源主机伪装成具有当前公网IP的主机与外网通讯)
add action=masquerade chain=srcnat out-interface=all-ppp
#--目标地址NAT(把内网的目标主机伪装成具有当前公网IP的主机与外网通讯)
add action=dst-nat chain=dstnat dst-port=8080 in-interface=all-ppp protocol=tcp to-addresses=192.168.1.108 to-ports=8080
#服务配置
/ip service
set telnet disabled=yes
/lcd
set time-interval=daily
/tool mac-server
set [ find default=yes ] disabled=yes
add interface=ether02
add interface=ether03
add interface=ether04
add interface=ether05
add interface=ether06
add interface=ether07
add interface=ether08
add interface=ether09
add interface=ether10
add interface=sfp1
add
/tool mac-server mac-winbox
set [ find default=yes ] disabled=yes
add interface=ether02
add interface=ether03
add interface=ether04
add interface=ether05
add interface=ether06
add interface=ether07
add interface=ether08
add interface=ether09
add interface=ether10
add interface=sfp1
add
|