【RouterOS】——LAN port Ports with Static IP,DHCP Server,PPTP Server
[i=s] 本帖最後由 角色 於 2013-3-10 22:31 編輯 [/i]为了建立不同的上网方法(Static IP,DHCP Client,PPPoE Client),我用一台routerboard(RB2011UAS-2HnD-IN)来做例子说明。
请下图一,它的ethernet ports分配如下:
ether2 :DHCP connected to Internet (Public)
ether6 : for static IP client to access Internet
ether7 : for PPPoE client to access Internet
ether9,10: for DHCP client to access Internet
图一:不同的链接方法
[attach]2271[/attach] [i=s] 本帖最後由 角色 於 2013-3-10 22:56 編輯 [/i]
WAN: ether2
LAN: network segment 192.168.99.0/24
Static IP (ether6):
PPPoE Server (ether7): pppoe-pool=192.168.99.20-192.168.99.29
DHCP Server (ether9,10): dhcp-pool=192.168.99.10-192.168.99.19 [i=s] 本帖最後由 角色 於 2013-3-10 23:07 編輯 [/i]
1. 为了让大家深刻认识RouterOS的settings,大家先根据[url=http://www.telecom-cafe.com/forum/viewthread.php?tid=5137]Link[/url],先clear routerboard所有default settings。[code]/system reset-configuration no-defaults=yes
Dangerous! Reset anyway? [y/N]:
y
system configuration will be reset
[/code]#
然后我们看看nat和filter是否还有东西剩下来。[code][admin@MikroTik] >
[admin@MikroTik] > /ip firewall nat print
Flags: X - disabled, I - invalid, D - dynamic
[admin@MikroTik] > /ip firewall filter print
Flags: X - disabled, I - invalid, D - dynamic
[admin@MikroTik] >
[/code] [i=s] 本帖最後由 角色 於 2013-3-10 23:39 編輯 [/i]
因为ether2 port接了一个DHCP Server的port,192.168.88.0/24, 而ether10接了一台notebook。[code][admin@MikroTik] /interface ethernet> print
Flags: X - disabled, R - running, S - slave
# NAME MTU MAC-ADDRESS ARP MASTER-PORT SWITCH
0 sfp1 1500 D4:CA:6D:4F:A0:AD enabled none switch1
1 ether1 1500 D4:CA:6D:4F:A0:AE enabled none switch1
2 R ether2 1500 D4:CA:6D:4F:A0:AF enabled none switch1
3 ether3 1500 D4:CA:6D:4F:A0:B0 enabled none switch1
4 ether4 1500 D4:CA:6D:4F:A0:B1 enabled none switch1
5 ether5 1500 D4:CA:6D:4F:A0:B2 enabled none switch1
6 ether6 1500 D4:CA:6D:4F:A0:B3 enabled none switch2
7 ether7 1500 D4:CA:6D:4F:A0:B4 enabled none switch2
8 ether8 1500 D4:CA:6D:4F:A0:B5 enabled none switch2
9 ether9 1500 D4:CA:6D:4F:A0:B6 enabled none switch2
10 R ether10 1500 D4:CA:6D:4F:A0:B7 enabled none switch2
[/code]#[code]
[admin@MikroTik] /interface ethernet> /ip address print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK INTERFACE
[admin@MikroTik] /interface ethernet> /ip dhcp-client add interface=ether2 disable
d=no
[admin@MikroTik] /interface ethernet> /ip address print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK INTERFACE
0 D 192.168.88.250/24 192.168.88.0 ether2
[admin@MikroTik] /interface ethernet>
[/code]#
上面用了这句后,ether2 port就能取得IP address了
/ip dhcp-client add interface=ether2 disabled=no
还有其他信息:[code][admin@MikroTik] /ip dhcp-client> print detail
Flags: X - disabled, I - invalid
0 interface=ether2 add-default-route=yes default-route-distance=1
use-peer-dns=yes use-peer-ntp=yes status=bound address=192.168.88.250/24
gateway=192.168.88.1 dhcp-server=192.168.88.1 primary-dns=192.168.88.1
expires-after=2d23h44m16s
[admin@MikroTik] /ip dhcp-client>
[/code]#
到现在,WAN port(ether2)已经搞定。 [i=s] 本帖最後由 角色 於 2013-3-11 00:06 編輯 [/i]
Static IP Address Settings:[code][admin@MikroTik] /ip dhcp-client> /ip address
[admin@MikroTik] /ip address> add address=192.168.99.1/24 interface=ether6
[admin@MikroTik] /ip address> print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK INTERFACE
0 D 192.168.88.250/24 192.168.88.0 ether2
1 192.168.99.1/24 192.168.99.0 ether6
[admin@MikroTik] /ip address> /ip firewall nat
[admin@MikroTik] /ip firewall nat> add action=masquerade chain=srcnat out-interfac
e=ether2
[admin@MikroTik] /ip firewall nat> print
Flags: X - disabled, I - invalid, D - dynamic
0 chain=srcnat action=masquerade out-interface=ether2
[admin@MikroTik] /ip firewall nat>
[/code]PC Settings:
PC IP=192.168.99.2
Netmask = 255.255.255.0
Gateway=192.168.99.1
DNS1=8.8.8.8
ping [url]www.abc.com[/url], we have[code]C:\Documents and Settings\Administrator>ping www.abc.com
Pinging abc.com [199.181.132.250] with 32 bytes of data:
Reply from 199.181.132.250: bytes=32 time=171ms TTL=242
Reply from 199.181.132.250: bytes=32 time=171ms TTL=242
Reply from 199.181.132.250: bytes=32 time=170ms TTL=242
Reply from 199.181.132.250: bytes=32 time=171ms TTL=242[/code] 备用帖子。 备用帖子。 备用帖子。 备用帖子。 备用帖子。
頁:
[1]