สวัดดีครับเพื่อนชาวเชียงราย วันนี้ขอแนะนำการใช้งานอุปกรณ์ firewall ตัวเล็กราคาถูกไว้ใช้งานในบ้านหรือหอพัก
ประโยชน์
1 ปรับปรุง Service ที่ใช้งานเองได้ตามความต้องการ
2 ไม่ต้องเสียเงินจ้างช่าง 3000 - 5000 บาท
3 การใช้งาน internet คุ้มค่าที่สุด ( โหลด bittorrent ตลอดเวลาพร้อมใช้งาน Web ปกติ )
4 ประโยชน์สำหรับเด็ก เล่น game ได้แบบไม่แล็ก
5 ดูกล้องวงจรปิดจากภายนอกได้ตามความเร็วที่กำหนดหรือแบ่งไว้ล่วงหน้า



ซึ่งตัวนี้ราคากลาง ๆ คุ้มสำหรับผู้ใช้งานแบบ 10 user ถึง 50 user ซึ่งผมจะทยอยทำชุดสอนใช้งานจนถึงการ Qos ในระดับควบคุม Section ของการใช้งานของ user เพื่อที่จะควบคุมไปพร้อมกับทรัพยากรณ์ของตัวอุปกรณ์และกำหนด Service ต่างๆในระบบให้ทำงานตามความต้องการของตนเองครับ
ตัวอย่าง การเชื่อมต่อ internet 1 line
###########################
#### Internet 1 Line ####
###########################
# add ether1 for pppoe-out1 befor copy code to therminal
#|/ip address
/ip address add address=192.168.2.1/24 network=192.168.2.0 broadcast=192.168.2.255 interface=ether2 comment="default configuration"
#|/ip firewall mangle
/ip firewall mangle add chain=input in-interface=pppoe-out1 action=mark-connection new-connection-mark=ether1_conn
/ip firewall mangle add chain=output connection-mark=ether1_conn action=mark-routing new-routing-mark=to_ether1
#|/ip route
/ip route add dst-address=0.0.0.0/0 gateway=pppoe-out1 routing-mark=to_ether1 check-gateway=ping
/ip route add dst-address=0.0.0.0/0 gateway=pppoe-out1 distance=1 check-gateway=ping
#|/ip firewall nat
/ip firewall nat add chain=srcnat out-interface=pppoe-out1 action=masquerade
#| DHCP server is on switch, with address pool 192.168.2.10-192.168.2.200
/ip pool add name=default-dhcp ranges=192.168.2.10-192.168.2.200
/ip dhcp-server add name=default address-pool=default-dhcp interface=ether2 disabled=no
/ip dhcp-server network add address=192.168.2.0/24 gateway=192.168.2.1 dns-server=192.168.2.1 comment="default configuration"
#| DNS
/ip dns set allow-remote-requests=yes
/ip dns static add name=router address=192.168.2.1
/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000K max-udp-packet-size=512 servers=8.8.8.8,8.8.4.4
###########################
#### Port Service ####
###########################
/ip service
set telnet address="" disabled=no port=23
set ftp address="" disabled=no port=21
set www address="" disabled=no port=83
set cctv address="" disabled=no port=82
set ssh address="" disabled=no port=22
set www-ssl address="" certificate=none disabled=no port=443
set api address="" disabled=no port=8728
set winbox address="" disabled=no port=8291
############################
#### Noip / Service MK ####
############################
/system scheduler
add disabled=no interval=5m2s name=No-ip2 on-event=\
"/system script run No-ip2\r\
\n" policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
start-date=jan/02/1970 start-time=
00:10:20add disabled=no interval=1d name=reboot on-event=reboot policy=reboot \
start-date=jan/01/2002 start-time=
03:45:00/system script
add name=reboot policy=reboot source="/system reboot"
add name=No-ip2 policy=\
ftp,reboot,read,write,policy,test,winbox,password,sensitive,api source="# \
No-IP automatic Dynamic DNS update\r\
\n\r\
\n#--------------- Change Values in this section to match your setup -----\
-------------\r\
\n\r\
\n# No-IP User account info\r\
\n:local noipuser \"
art20069@hotmail.com\"\r\
\n:local noippass \"
xxxxxxxx\"\r\
\n\r\
\n# Set the hostname or label of network to be updated.\r\
\n# Hostnames with spaces are unsupported. Replace the value in the quotat\
ions below with your host names.\r\
\n# To specify multiple hosts, separate them with commas.\r\
\n:local noiphost \"
xxxxxxx.no-ip.biz\"\r\
\n\r\
\n# Change to the name of interface that gets the dynamic IP address\r\
\n:local inetinterface \"pppoe-out1\"\r\
\n\r\
\n#-----------------------------------------------------------------------\
-------------\r\
\n# No more changes need\r\
\n\r\
\n:global previousIP\r\
\n\r\
\n:if ([/interface get \$inetinterface value-name=running]) do={\r\
\n# Get the current IP on the interface\r\
\n :local currentIP [/ip address get [find interface=\"\$inetinterface\"\
\_disabled=no] address]\r\
\n\r\
\n# Strip the net mask off the IP address\r\
\n :for i from=( [:len \$currentIP] - 1) to=0 do={\r\
\n :if ( [:pick \$currentIP \$i] = \"/\") do={ \r\
\n :set currentIP [:pick \$currentIP 0 \$i]\r\
\n } \r\
\n }\r\
\n\r\
\n :if (\$currentIP != \$previousIP) do={\r\
\n :log info \"No-IP: Current IP \$currentIP is not equal to previou\
s IP, update needed\"\r\
\n :set previousIP \$currentIP\r\
\n\r\
\n# The update URL. Note the \"\\3F\" is hex for question mark (\?). Requi\
red since \? is a special character in commands.\r\
\n :local url \"
http://dynupdate.no-ip.com/nic/update\\3Fmyip=\$curr\
entIP\"\r\
\n :local noiphostarray\r\
\n :set noiphostarray [:toarray \$noiphost]\r\
\n :foreach host in=\$noiphostarray do={\r\
\n :log info \"No-IP: Sending update for \$host\"\r\
\n /tool fetch url=(\$url . \"&hostname=\$host\") user=\$noipuse\
r password=\$noippass mode=http dst-path=(\"no-ip_ddns_update-\" . \$host \
. \".txt\")\r\
\n :log info \"No-IP: Host \$host updated on No-IP with IP \$cur\
rentIP\"\r\
\n }\r\
\n } else={\r\
\n :log info \"No-IP: Previous IP \$previousIP is equal to current I\
P, no update needed\"\r\
\n }\r\
\n} else={\r\
\n :log info \"No-IP: \$inetinterface is not currently running, so there\
fore will not update.\"\r\
\n}"
##########################
## NAT Forward Port CCTV Port 99 ####
##########################
add action=dst-nat chain=dstnat disabled=no dst-address-type=local dst-port=\
99 in-interface=pppoe-out1 protocol=tcp to-addresses=192.168.2.99 \
to-ports=99
add action=dst-nat chain=dstnat disabled=no dst-port=99 in-interface=ether2 \
protocol=tcp to-addresses=192.168.2.99 to-ports=99
##########################
## NTP TIME Clint SET ####
##########################
/system ntp client set enabled=yes mode=unicast primary-ntp=158.108.212.149 secondary-ntp=202.28.18.72
/system clock set time-zone-name=Asia/Bangkok
เดียวผมจะค่อยอธิบายการทำงานและการใช้งานในตัวอุปกรณ์ในการนำไปใช้งานร่วมถึงการกำหนดความเร็วในการ Download bittorrent ไปพร้อม ๆ กับการใช้งาน Service ต่าง ๆ ให้ใช้งา้นในเวลาเดียวกันได้ โดยผลกระทบของการใช้ง้้าน Bittorrent น้อยที่สุดและการแยกเน็ตกับเกมส์ใน internet 1 Line โดยการแบ่ง ท่อการใช้งานโดยกำหนดความเร็วของแต่ละท่อตาม internet line ที่ใช้รายเดือนให้เหมาะสมกับแต่ละบุคคลครับ วันนี้เริ่มประมาณนี้ก่อนนะครับ