【RouterOS】——CLI 1 WAN (DHCP Client) and 1 LAN (DHCP Server)
本帖最後由 角色 於 2013-3-10 23:15 編輯
Add alias to interface Eth1 and Eth2:- /interface ethernet
- set 2 name=Public
- set 10 name=Local
複製代碼 #
Add interface Public as DHCP client:- /ip dhcp-client
- add interface=Public disable=no
複製代碼 #
Add your ISP' DNS:- /ip dns
- set servers=8.8.8.8,8.8.4.4 allow-remote-requests=yes
複製代碼 #
Or just use DHCP ISP's DNS- /ip dns
- set allow-remote-requests=yes
複製代碼 #
Add IP to Local- add address=192.168.0.1/24 interface=Local
複製代碼 #
Add DHCP-server and DHCP-Pool to interface Local- /ip pool
- addd name=dhcp-pool range=192.168.0.10-192.168.0.254
- /ip dhcp-server
- add name=dhcp inteface=Local address-pool=dhcp-pool disabled=no
- /ip dhcp-server network
- add address=192.168.0.0/24 gateway=192.168.0.1 dns-server=192.168.0.1
複製代碼 #
Add firewall NAT-rule- /ip firewall nat
- add action=masquerade chain=srcnat disabled=no out-interface=Public
複製代碼 #
Please note that if a switch is connected to the Local port, ALL LAN ports of the switch could be used. The PC's IP, gateway and DNS are given by the DHCP Server at the Local port. |