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