เดิมเครื่องใน Trust zone (TZ) สามารถเชื่อมต่อไปยัง service ภายนอกได้ผ่าน private link แต่อนาคต private link จะถูกยกเลิก เลยทำให้เครื่องใน TZ จะต้องเชื่อมต่อไปยัง service ภายนอกผ่าน internet แทน ทีนี้ติดปัญหาว่า firewall ไม่สามารถสร้าง policy เชื่อมต่อไปยัง service ภายนอกผ่าน domain ได้ ต้องสร้างแบบ IP เท่านั้น และ service ดังกล่าวไม่มี IP ที่ตายตัว เลยอยากขอคำแนะนำว่าจะทำอะไรได้บ้างครับ

เบื้องต้นที่คิดไว้คือใช้เครื่องใน DMZ ที่เชื่อมต่อ internet ได้ ออกไปเชื่อมต่อกับ service ดังกล่าวแทนเครื่องใน TZ แต่ยังคิดไม่ออกในเชิงรายละเอียดว่าจะทำยังไงดีครับ

UPDATE: เนื่องจากว่าทาง service แจ้งว่ามี static IP อยู่ เลยทำให้ไม่ต้องทำอะไรยุ่งยากมาก โดยผมทำแบบนี้ครับ

  1. แก้ /etc/default/ufw ให้อนุญาตการส่งต่อ
    default_forward_policy = "accept"
  2. แก้ /etc/ufw/sysctl.conf ให้อนุญาตการส่งต่อ
    net.ipv4.ip_forward=1
  3. สร้างกฎให้การเชื่อมต่อมาที่เครื่องใน DMZ จะถูกส่งไป IP ของ service
    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -m conntrack --ctstate NEW -j DNAT --to foo_serverip:80
    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -m conntrack --ctstate NEW -j DNAT --to foo_serverip:443
    iptables -t nat -A PREROUTING -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
    iptables -A POSTROUTING -t nat -j MASQUERADE
  4. reload ufw
    ufw reload

ref

Hiring! บริษัทที่น่าสนใจ

Carmen Software company cover
Carmen Software
Hotel Financial Solutions
Next Innovation (Thailand) Co., Ltd. company cover
Next Innovation (Thailand) Co., Ltd.
We are web design with consulting & engineering services driven the future stronger and flexibility.
KKP Dime company cover
KKP Dime
KKP Dime บริษัทในเครือเกียรตินาคินภัทร
Kiatnakin Phatra Financial Group company cover
Kiatnakin Phatra Financial Group
Financial Service
Fastwork Technologies company cover
Fastwork Technologies
Fastwork.co เว็บไซต์ที่รวบรวม ฟรีแลนซ์ มืออาชีพจากหลากหลายสายงานไว้ในที่เดียวกัน
Thoughtworks Thailand company cover
Thoughtworks Thailand
Thoughtworks เป็นบริษัทที่ปรึกษาด้านเทคโนโยลีระดับโลกที่คว้า Great Place to Work 3 ปีซ้อน
Iron Software company cover
Iron Software
Iron Software is an American company providing a suite of .NET libraries by engineer for engineers.
CLEVERSE company cover
CLEVERSE
Cleverse is a Venture Builder. Our team builds several tech companies.
Nipa Cloud company cover
Nipa Cloud
#1 OpenStack cloud provider in Thailand with our own data center and software platform.
Bangmod Enterprise company cover
Bangmod Enterprise
The leader in Cloud Server and Hosting in Thailand.
CIMB THAI Bank company cover
CIMB THAI Bank
MOVING FORWARD WITH YOU - CIMB is the leading ASEAN Bank
Bangkok Bank company cover
Bangkok Bank
Bangkok Bank is one of Southeast Asia's largest regional banks, a market leader in business banking
MuvMi (Urban Mobility Tech Co.,Ltd.) company cover
MuvMi (Urban Mobility Tech Co.,Ltd.)
Shape the future of urban mobility towards affordable, clean, and safe solutions
T.N. Digital Solution Co., Ltd. company cover
T.N. Digital Solution Co., Ltd.
TNDS has been involving in every first move of banking’s major digital transformation.
KBTG - KASIKORN Business-Technology Group company cover
KBTG - KASIKORN Business-Technology Group
KBTG - "The Technology Company for Digital Business Innovation"
Siam Commercial Bank Public Company Limited company cover
Siam Commercial Bank Public Company Limited
"Let's start a brighter career future together"
Icon Framework co.,Ltd. company cover
Icon Framework co.,Ltd.
Global Standard Platform for Real Estate แพลตฟอร์มสำหรับธุรกิจอสังหาริมทรัพย์ครบวงจร มาตรฐานระดับโลก
REFINITIV company cover
REFINITIV
The Financial and Risk business of Thomson Reuters is now Refinitiv
H LAB company cover
H LAB
Re-engineering healthcare systems through intelligent platforms and system design.
The Gang Technology Co., Ltd. company cover
The Gang Technology Co., Ltd.
We're a Digital Agency that helps our customers transform their business into digital with ease.
LTMH company cover
LTMH
LTMH มุ่งเน้นการพัฒนาผลิตภัณฑ์ที่สามารถช่วยพันธมิตรของเราให้บรรลุเป้าหมาย
Seven Peaks company cover
Seven Peaks
We Drive Digital Transformation
Wisesight (Thailand) Co., Ltd. company cover
Wisesight (Thailand) Co., Ltd.
The Best Choice For Handling Social Media · High Expertise in Social Data · Most Advanced and Secure
MOLOG Tech company cover
MOLOG Tech
We are Modern Logistic Platform, Specialize in WMS, OMS and TMS.
Data Wow Co.,Ltd company cover
Data Wow Co.,Ltd
We enable our clients to realize increased productivity by solving their most complex issues by Data
LINE Company Thailand company cover
LINE Company Thailand
LINE, the world's hottest mobile messaging platform, offers free text and voice messaging + Call
LINE MAN Wongnai company cover
LINE MAN Wongnai
Join our journey to becoming No.1 food platform in Thailand

ผมคิดว่าเหมือน ตอนสร้าง policy กำหนด destination ปลายทาง ตัวระบบให้ใส่ได้แค่ IP อย่างเดียวใส่เป็น FQDN / Domain อะไรแบบนี้ไม่ได้ ซึ่งถ้าไปนั่ง lookup เช็ค DNS แล้ว กรอกมือเอา มันก็น่าจะอาจจะเปลี่ยนเรื่อยๆ

TeamKiller Mon, 27/10/2025 - 10:31

ขาออก allow any ไปเลยก็ได้เปล่าครับหรือมี policy ของหน่วยงานคุมไว้อีกนะครับ ไม่งั้นต้อง firewall อื่นทำแทน

ปัญหาคือ allow any มันก็กลายเป็นว่ามันไปได้ทุกที่ เพราะที่ต้องการคือให้ TZ ยังเชื่อมต่อไปหา service ภายนอกที่ปกติเชื่อมต่อผ่านอินเตอร์เน็ตได้เท่านั้นครับ

  • ถ้าไม่ allow any ระบบก็ทำงานไม่ได้
  • Allow เฉพาะ IP เช็คดูจาก nslookup เอา ซึ่งไอพีอาจจะเปลี่ยนไปได้เรื่อยๆ หรือมีเยอะมาก แต่ก็พอใช้งานไปได้สักระยะ
  • เปลี่ยน Firewall / Network/ Gateway อันนี้น่าลงทุนลงแรงเยอะ
  • เรื่อง Proxy ที่บอกว่ามีเครื่องออกได้ Any งี้หรือ allow เฉพาะ FQDN/Domain ได้ ถ้าระบบวิ่งแบบ HTTP ทำ reverse proxy ขวางเองก่อนยิงไปปลายทาง หรือ มี api gateway ในระบบเราคุมก่อนยิงออกไปข้างนอก หรือๆ proxy network แบบดั้งเดิมๆ ทำ แต่ทั้งนี้ก็อยู่ที่ระบบเราทำงานไงด้วย ว่าทำได้อันไหนบ้างนะครับ

ผมปกติขาออกมัก any เลย กันแต่ขาเข้า

rattananen Tue, 28/10/2025 - 10:39

ถ้า service ที่คุณจะเชี่อมต่อมัน ไม่ได้ใช้ port 80 หรือ 443 ก็จะง่ายหน่อยครับ
block ทุก port แล้ว ใส่ policy เป็น except port ของ service เอาได้ที่ firewall

ได้ไม่ได้อีกคงต้องใช้ firewall ของ third party
ผมเคยเห็นว่า firewall ของ anti virus บางเจ้ามันมี feature except ด้วย domain name ได้อยู่

McKay Wed, 29/10/2025 - 17:48

ipset+dig+cron พอแก้ขัดได้ไหมครับ

อย่าลืมเปลี่ยน INPUT เป็น FORWARD และ src เป็น dst

เบื้องต้นที่คิดไว้คือใช้เครื่องใน DMZ ที่เชื่อมต่อ internet ได้ ออกไปเชื่อมต่อกับบริการดังกล่าวแทนเครื่องใน TZ แต่ยังคิดไม่ออกในเชิงรายละเอียดว่าจะทำยังไงดีครับ

OpenVPN + Domain Filtering?

ขอบคุณทุกความเห็นครับ แต่หาเจอคำตอบที่นี่ ใช้ iptables ทำให้ออกไปได้แบบน่ากังวลหน่อยๆ ส่วน IP ใช้ shell script + crontab คอยอัพเดตครับ เนื่องจากมี static IP เลยไม่จำเป็นต้องคอยอัพเดต อีกอย่าง script ไม่ทำงานตามที่คิดไว้ครับ