【RouterOS】——Single WAN (DHCP Client) and Bridged interfaces (DHCP Server)
| 本帖最後由 角色 於 2013-3-9 21:14 編輯 
 Define the name of a network bridge
 Add aliases to Ethernet interfaces複製代碼/interface bridge
add l2mtu=1598 name=MyBridge
The following is given by the system複製代碼/interface ethernet
set 2 name=Public
set 10 name=Local
Define the addresses for the IP pool複製代碼/ip hotspot user profile
set [ find default=yes ] idle-timeout=none keepalive-timeout=2m
Define the DHCP server複製代碼/ip pool
add name=dhcp-pool ranges=192.168.0.10-192.168.0.254
Add the interface to the named bridge "MyBridge"複製代碼/ip dhcp-server
add address-pool=dhcp-pool disabled=no interface=MyBridge name=dhcp
Define the network for MyBridge複製代碼/interface bridge port
add bridge=MyBridge interface=Local
add bridge=MyBridge interface=ether9
Define DHCP client for the Public interface複製代碼/ip address
add address=192.168.0.1/24 interface=MyBridge
Define the DHCP server for the local network複製代碼/ip dhcp-client
add disabled=no interface=Public
Tell the system where the DNS goes複製代碼/ip dhcp-server network
add address=192.168.0.0/24 dns-server=192.168.0.1 gateway=192.168.0.1
Define the rules of the firewall複製代碼/ip dns
set allow-remote-requests=yes
To show the complete configuration using the command "/export compact"複製代碼/ip firewall nat
add action=masquerade chain=srcnat out-interface=Public to-addresses=0.0.0.0
[admin@MikroTik] 
複製代碼[admin@MikroTik] /interface> /export compact
# jan/02/1970 01:28:49 by RouterOS 5.22
# software id = KA8I-E9SX
#
/interface bridge
add l2mtu=1598 name=MyBridge
/interface ethernet
set 2 name=Public
set 10 name=Local
/ip hotspot user profile
set [ find default=yes ] idle-timeout=none keepalive-timeout=2m
/ip pool
add name=dhcp-pool ranges=192.168.0.10-192.168.0.254
/ip dhcp-server
add address-pool=dhcp-pool disabled=no interface=MyBridge name=dhcp
/interface bridge port
add bridge=MyBridge interface=Local
add bridge=MyBridge interface=ether9
/ip address
add address=192.168.0.1/24 interface=MyBridge
/ip dhcp-client
add disabled=no interface=Public
/ip dhcp-server network
add address=192.168.0.0/24 dns-server=192.168.0.1 gateway=192.168.0.1
/ip dns
set allow-remote-requests=yes
/ip firewall nat
add action=masquerade chain=srcnat out-interface=Public to-addresses=0.0.0.0
[admin@MikroTik] /interface>
 |