ปัญหา # 1 - ประเภทเครือข่าย VM
เครือข่ายมี 3 โหมด: 
- NAT
 
- โฮสต์เท่านั้น
 
- สะพาน
 
รายละเอียดเกี่ยวกับการตั้งค่า
ใช้เมื่อใด?
- # 1 : สำหรับการพัฒนาแอพ Facebook / เว็บที่อยู่บนเซิร์ฟเวอร์อื่น ๆ
 
- # 2 : หากคุณต้องการสร้างแอปของคุณเองและทดสอบจากโฮสต์ VirtualBox (ไม่ใช่แค่เกสต์ VM)
 
- # 3 : หากคุณต้องการสร้างแอพและทดสอบจากระบบอื่น ๆ บน LAN
 
ปัญหา # 2 - การบล็อกไฟร์วอลล์
ไฟร์วอลล์อาจบล็อกเว็บเบราว์เซอร์ของคุณไม่ให้เข้าถึงอินสแตนซ์ Apache ของคุณทั้งนี้ขึ้นอยู่กับว่าคุณใช้ distro แบบใด นี่จะสมเหตุสมผลถ้าคุณสามารถ ping ระบบได้ แต่ไม่สามารถเข้าถึงผ่านพอร์ต 80 ซึ่งเป็นพอร์ตที่ Apache กำลังฟังอยู่
ปิดการใช้งานชั่วคราว
บน CentOS คุณใช้คำสั่งนี้เพื่อปิดการใช้งาน
$ /etc/init.d/iptables stop
ตรวจสอบว่าฟังจาก Apache
คุณสามารถยืนยันได้ว่ากำลังฟังพอร์ตนี้อยู่
$ netstat -antp | grep :80 | head -1 | column -t
tcp  0  0  :::80  :::*  LISTEN  3790/httpd
ยืนยันการปิดไฟร์วอลล์
ไฟร์วอลล์สามารถยืนยันได้ว่าเปิดกว้าง
$ iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination      
หากสามารถแก้ไขปัญหาของคุณได้คุณสามารถเพิ่มกฎที่อนุญาตการรับส่งข้อมูลผ่าน TCP พอร์ต 80 อย่างถาวร
การเพิ่มกฎสำหรับพอร์ต TCP 80
$ /etc/init.d/iptables restart
$ iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
$ /etc/init.d/iptables save
หมายเหตุ:สิ่งนี้จะทำให้กฎคงอยู่ระหว่างการรีบูต
ไฟร์วอลล์ยอมรับพอร์ต TCP 80
ระบบที่เปิดพอร์ต 80 จะมีลักษณะดังนี้:
$ iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:8834 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ปัญหา # 3 - ฟัง Apache หรือไม่
ในปัญหาข้างต้นเราเห็นว่า Apache กำลังฟังอยู่ แต่บางครั้งมันถูกตั้งค่าผิดพลาดเพื่อให้ฟังได้เพียง 1 ที่อยู่ IP หรือว่ากำลังฟังบนอินเทอร์เฟซเครือข่ายอื่น netstatสามารถใช้คำสั่งเพื่อตรวจสอบสิ่งนี้รวมถึงตรวจสอบไฟล์การกำหนดค่า Apache
$ netstat -anpt | grep :80 | column -t
tcp  0  0  0.0.0.0:80  0.0.0.0:*  LISTEN  1750/httpd
สิ่งนี้แสดงให้เห็นว่า Apache กำลังฟังบนอินเตอร์เฟสทั้งหมด (IP 0.0.0.0)
ฉันจะไม่ทำซ้ำสิ่งที่คำตอบของ@ Lekensteynซึ่งครอบคลุมประเด็นนี้โดยเฉพาะในรายละเอียดเพิ่มเติมที่นี่
อ้างอิง
               
              
:::80Apache จะรับฟังการเชื่อมต่อ IPv6 เท่านั้น คุณลองตรวจสอบListenคำสั่งแล้วหรือยัง?