電訊茶室's Archiver

角色 發表於 2013-1-2 23:07

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

[i=s] 本帖最後由 角色 於 2013-3-9 21:14 編輯 [/i]

Define the name of a network bridge[code]
/interface bridge
add l2mtu=1598 name=MyBridge
[/code]Add aliases to Ethernet interfaces[code]
/interface ethernet
set 2 name=Public
set 10 name=Local
[/code]The following is given by the system[code]
/ip hotspot user profile
set [ find default=yes ] idle-timeout=none keepalive-timeout=2m
[/code]Define the addresses for the IP pool[code]
/ip pool
add name=dhcp-pool ranges=192.168.0.10-192.168.0.254
[/code]Define the DHCP server[code]
/ip dhcp-server
add address-pool=dhcp-pool disabled=no interface=MyBridge name=dhcp
[/code]Add the interface to the named bridge "MyBridge"[code]
/interface bridge port
add bridge=MyBridge interface=Local
add bridge=MyBridge interface=ether9
[/code]Define the network for MyBridge[code]
/ip address
add address=192.168.0.1/24 interface=MyBridge
[/code]Define DHCP client for the Public interface[code]
/ip dhcp-client
add disabled=no interface=Public
[/code]Define the DHCP server for the local network[code]
/ip dhcp-server network
add address=192.168.0.0/24 dns-server=192.168.0.1 gateway=192.168.0.1
[/code]Tell the system where the DNS goes[code]
/ip dns
set allow-remote-requests=yes
[/code]Define the rules of the firewall[code]
/ip firewall nat
add action=masquerade chain=srcnat out-interface=Public to-addresses=0.0.0.0
[admin@MikroTik]
[/code]To show the complete configuration using the command "/export compact"[code][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>
[/code]

頁: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.