查看單個文章
舊 2004-10-30, 12:55 AM   #1
psac
榮譽會員
 
psac 的頭像
榮譽勳章
UID - 3662
在線等級: 級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時
註冊日期: 2002-12-07
住址: 木柵市立動物園
文章: 17381
現金: 5253 金幣
資產: 33853 金幣
預設 如何用RouteOS實現ip pnp

源起如何實現「網路即插即用」
完成routeos的基本安裝,
以我的機器為例,
更改網路卡名

/interface
set ether1 name=local
set ether2 name=public
enable local
enable public

類BIOSIP的話,設定網路卡IP,因為我做的hotspot,在這裡有台機器在上一級做NAT的,所以外部IP我是用10.4.8.199/24,大家可以在這裡設定成ISP給的IP位址

/ip address
add address="192.168.2.1/24" interface=local
add address="10.4.8.199/16" interface=public

如果是用pppoe撥號則需要

/interface pppoe-client
add name="adsl" user="isp username" password="isp password" mtu=1492 mru=1492 \
interface=public add-default-route=yes use-peer-dns=yes disabled=no
/ip address
add address="192.168.2.1/24" interface=local

增加ip pool

/ip pool
add ranges=192.168.2.1-192.168.2.100 name=local_User_Pool
add ranges=192.168.2.101-192.168.2.200 name=Universal_User_Pool

增加DHCP server

/ip dhcp-server
add name=local interface=local address-pool=local_User_Pool \
dhs-server=192.168.2.1 gateway=192.168.2.1 lease-time=24h netmask=24 wins-server=10.4.1.10

設定正確的DNS

/ip dns
set primary-dns=202.96.134.133 secondary-dns=202.96.128.68

設定正確的DNS cache

/ip dns-cache
set enabled=yes primary-dns=202.96.134.133 secondary-server=202.96.128.68

設定NAT

/ip firewall src-nat
add action=masquerade

在這裡只說明一下大家所說的ip pnp的設定,其它的如hotspot,firewall等的設定就不多說了

/ip hotspot universal
add address-pool=Universal_User_Pool disabled=no interface=local


/ip firewall dst-nat
add dst-address=0.0.0.0/0:53 protocol=udp src-address=192.168.2.0/24:0-65535 \
to-dst-address=192.168.2.1 to-dst-port=53 action=nat

就這麼簡單的設定。下面的客戶端已經可以任意IP上internet了。
如果結合hotspot可以實現類似酒店裡web頁面登入上網的功能。
RouteOS的功能很強大,像輕鬆實現VPN,透明代理等,他原有的的一些小工具也比較好用,像通過ping檢測伺服器狀態並觸發事件,這個是很實用的功能。
歡迎大家交流使用心得。
有個小問題,有個朋友使用RouteOS的pppoe撥號,接入後不能通過FTP下載一些大文件,反覆修改mtu和mru未果,請朋友指教。
可以加一條DNAT,攔截訪問udp53(dns)的請求到你的dns server

dst.port=53
protocol=udp
action=nat
to dst. address=你的routeros ip(如果開了dnscache功能,並且允許remote request)
to dst. ports=53
psac 目前離線  
送花文章: 3, 收花文章: 1631 篇, 收花: 3205 次