返回列表 發帖

【RouterOS】——Single WAN (DHCP Client) and Bridged interfaces (DHCP Server)

本帖最後由 角色 於 2013-3-9 21:14 編輯

Define the name of a network bridge
  1. /interface bridge
  2. add l2mtu=1598 name=MyBridge
複製代碼
Add aliases to Ethernet interfaces
  1. /interface ethernet
  2. set 2 name=Public
  3. set 10 name=Local
複製代碼
The following is given by the system
  1. /ip hotspot user profile
  2. set [ find default=yes ] idle-timeout=none keepalive-timeout=2m
複製代碼
Define the addresses for the IP pool
  1. /ip pool
  2. add name=dhcp-pool ranges=192.168.0.10-192.168.0.254
複製代碼
Define the DHCP server
  1. /ip dhcp-server
  2. add address-pool=dhcp-pool disabled=no interface=MyBridge name=dhcp
複製代碼
Add the interface to the named bridge "MyBridge"
  1. /interface bridge port
  2. add bridge=MyBridge interface=Local
  3. add bridge=MyBridge interface=ether9
複製代碼
Define the network for MyBridge
  1. /ip address
  2. add address=192.168.0.1/24 interface=MyBridge
複製代碼
Define DHCP client for the Public interface
  1. /ip dhcp-client
  2. add disabled=no interface=Public
複製代碼
Define the DHCP server for the local network
  1. /ip dhcp-server network
  2. add address=192.168.0.0/24 dns-server=192.168.0.1 gateway=192.168.0.1
複製代碼
Tell the system where the DNS goes
  1. /ip dns
  2. set allow-remote-requests=yes
複製代碼
Define the rules of the firewall
  1. /ip firewall nat
  2. add action=masquerade chain=srcnat out-interface=Public to-addresses=0.0.0.0
  3. [admin@MikroTik]
複製代碼
To show the complete configuration using the command "/export compact"
  1. [admin@MikroTik] /interface> /export compact
  2. # jan/02/1970 01:28:49 by RouterOS 5.22
  3. # software id = KA8I-E9SX
  4. #
  5. /interface bridge
  6. add l2mtu=1598 name=MyBridge
  7. /interface ethernet
  8. set 2 name=Public
  9. set 10 name=Local
  10. /ip hotspot user profile
  11. set [ find default=yes ] idle-timeout=none keepalive-timeout=2m
  12. /ip pool
  13. add name=dhcp-pool ranges=192.168.0.10-192.168.0.254
  14. /ip dhcp-server
  15. add address-pool=dhcp-pool disabled=no interface=MyBridge name=dhcp
  16. /interface bridge port
  17. add bridge=MyBridge interface=Local
  18. add bridge=MyBridge interface=ether9
  19. /ip address
  20. add address=192.168.0.1/24 interface=MyBridge
  21. /ip dhcp-client
  22. add disabled=no interface=Public
  23. /ip dhcp-server network
  24. add address=192.168.0.0/24 dns-server=192.168.0.1 gateway=192.168.0.1
  25. /ip dns
  26. set allow-remote-requests=yes
  27. /ip firewall nat
  28. add action=masquerade chain=srcnat out-interface=Public to-addresses=0.0.0.0
  29. [admin@MikroTik] /interface>
複製代碼

返回列表