Skip to content
    • English
  • Đăng nhập
Hosting, Máy chủ, Cloud VPS, Tên miền, Thiết kế WebsiteHosting, Máy chủ, Cloud VPS, Tên miền, Thiết kế Website
    • English
  • Đăng nhập
  • Khuyến mại
    • Tên miền
          • Đăng ký tên miền
            Xây dựng thương hiệu trên internet
          • Các biểu mẫu văn bản
          • Quy trình đăng ký
          • Gia hạn tên miền
            Duy trì tên miền với mức giá hợp lý
          • Thủ tục chuyển nhượng tên miền VN
          • Quy trình xử lý khiếu nại
    • Hosting
          • NVME Hosting
            Hosting tốc độ nhanh nhất hiện nay
          • Hosting Linux cPanel
            Giảm giá lên đến 40%
          • Hosting Linux DirectAdmin
            Off 15%: Hosting + Domain
          • Hosting WordPress
            Off 20%: Chuyển dịch vụ về BKNS
    • Email
          • Cloud Email Hosting
            Off 20%: Hosting + Domain + Email
          • Cloud Email Server
            Miễn phí SSL, Giảm giá 20%
          • Email Relay
            White list IP
          • Các hỏi đáp về dịch vụ Email
    • Cloud
          • Cloud VPS SSD
            Giảm giá lên dến 35%
          • VPS MMO
          • Cloud VPS SEO
            Dành riêng cho SEO với 5 IP
          • Cloud VPS BK Misa
          • E-meeting
          • Cloud VPN
    • Máy chủ
          • Cho thuê máy chủ
            Thuê máy chủ tặng máy chủ
          • Dịch vụ quản trị máy chủ trọn gói
            Yên tâm, an toàn dữ liệu
          • Thuê chỗ đặt máy chủ
            Miễn phí 500W điện
          • Máy chủ cho MMO
            Tương tác tốt nhất với Youtube, FB, Google và MMO
          • Các dịch vụ liên quan tới máy chủ
    • Phần mềm
          • DirectAdmin
          • Softaculous
          • CloudLinux
          • Imunify360
          • Plesk
          • vBulletin
          • LiteSpeed
    • Website
    • Chứng chỉ SLL
    • Đại lý
      • Chính sách đại lý
      • Bảng giá đại lý
      • Các hỏi đáp về đại lý
    • Hướng dẫn
      • Hướng dẫn dịch vụ
      • Hướng dẫn sử dụng trang id.bkns.vn
      • Hướng dẫn thanh toán
      • Cam kết chất lượng mức dịch vụ (SLA)
  • Khuyến mại
Trang chủ » Hướng dẫn cài đặt và cấu hình Squid HTTP Proxy Server IPV6 trên CentOS 7

Hướng dẫn cài đặt và cấu hình Squid HTTP Proxy Server IPV6 trên CentOS 7

29/11/2021 12:01 | Luợt xem : 61

Giới thiệu:

  • Proxy server là máy chủ trung gian giữa client và server thực hiện nhiệm vụ chuyển dữ liệu giữa client với server.
  • Ngay sau khi được yêu cầu thì proxy server sẽ kiểm tra bộ đệm của nó xem có dữ liệu trong đó, nó sẽ trả lại dữ liệu cho client, nếu không có trên bộ nhớ đệm, nó sẽ thực hiện yêu cầu thay cho client và gửi lại dữ liệu cho client.
  • Ở đây người mọi người hay sử dụng proxy với mục đích fake IP hoặc ẩn giấu thông tin truy cập

Bước 1: Cài đặt Squid
yum install -y squid

# Stop firewallD

systemctl stop firewallD

Khởi động Squid
systemctl start squid
Cho phép squid khởi động cùng hệ thống
systemctl enable squid

Bước 2: Thiết lập cấu hình squid

vi /etc/squid/squid.conf

– Thêm nội dung sau vào file squid.conf

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl localnet src x.x.x.x/24 # RFC1918 possible internal network

# Add rule
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling htt
acl CONNECT method CONNECT

forwarded_for off
# Hide client ip #
forwarded_for delete
# Turn off via header #
via off
####
acl portA localport 24000
# Map ports and IP addresses
tcp_outgoing_address 2403:6a40:0:88:bc26:ebff:fe1b:d5 portA
# Disable show ipv4
tcp_outgoing_address 127.0.0.1 portA
# Recommended minimum Access Permission configuration:
# Deny requests to certain unsafe ports
http_access deny !Safe_ports
# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports
# Only allow cachemgr access from localhost
http_access allow localhost manager
http_access deny manager
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
http_access deny to_localhost
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid Basic Authentication
auth_param basic credentialsttl 2 hours
acl auth_users proxy_auth REQUIRED
http_access allow auth_users

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
#http_access allow localnet
#http_access allow localhost
#http_access allow all

# And finally deny all other access to this proxy
#http_access deny all

# Squid normally listens to port 3128
http_port 3128
http_port 24000

# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/spool/squid 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid

#
# Add any of your own refresh_pattern entries above these.
#
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320

################################

Thực hiện chỉnh sửa các thông số sau: 

  • acl localnet src x.x.x.x/24 # RFC1918 possible internal network (thay địa chỉ x.x.x.x sang ip wan mạng internet của bạn)
  • Trường hợp muốn allow tất cả IP chỉnh sửa IP x.x.x.x/24 sang 0.0.0.0/24
  • tcp_outgoing_address 2403:6a40:0:88:bc26:ebff:fe1b:d5 portA (chỉnh sửa 2403:6a40:0:88:bc26:ebff:fe1b:d5 sang ipv6 của vps bạn đã cấu hình vào card mạng)

Bước 3 :Xác thực squid client authentication

yum -y install httpd-tools
touch /etc/squid/passwd
chown squid: /etc/squid/passwd

Tạo một user có tên bknsproxy và đặt password cho nó:

htpasswd /etc/squid/passwd bknsproxy

Khởi động lại squid server:
systemctl restart squid

Bước 5: Cấu hình trình duyệt của bạn để sử dụng proxy

Ví dụ với trình duyệt Firefox
Các bước bên dưới giống nhau đối với Windows, macOS và Linux.

  1. Ở góc trên bên phải, nhấp vào biểu tượng bánh hamburger ☰ để mở menu của Firefox:
  2. Bấm vào ⚙ Preferences.
  3. Cuộn xuống phần Network Settings và nhấp vào nút Settings….
  4. Một cửa sổ mới sẽ mở ra.
    – Chọn Manual proxy configuration.
    – Nhập địa chỉ IP máy chủ Squid của bạn vào trường HTTP Host và 24000 trong trường Port.
    – Chọn hộp kiểm Use this proxy server for all protocols.
    – Bấm vào nút OK để lưu cài đặt.

 

Truy cập thử 1 website sẽ bắt đăng nhập. Hãy nhập user và password đã tạo ở bước 3

 

Truy cập trang https://whatismyipaddress.com/ xem ip đã thay đổi chưa.

Chúc các bạn thành công!

Linh BKNS

Bài viết liên quan

Password Protected Directories

Hướng dẫn thiết lập Password Protected Directories trên DirectAdmin

18/05/2022

121

Tính năng này cho phép bạn thiết lập mật khẩu để bảo vệ các thư mục quan trọng của bạn trên web hosting như thư mục admin,...

Hướng dẫn toạ phân vùng swap cho linux

10/05/2022

59

1.Swap là gì? Swap là bộ nhớ ram ảo được sử dụng khi bộ nhớ ram vật lý của server hoặc vps đã đầy hoặc...

Tìm hiểu về Server, khái niệm và dịch vụ

05/05/2022

61

Mục lục Server là gì? Vai trò, phân loại và các dịch vụ liên quan đến server Server là gì?   Server – máy chủ,...
VPS BKNS

VPS Hosting, đặc điểm và cách sử dụng

04/05/2022

69

Mục lục VPS là gì? Đặc điểm và cách sử dụng VPS Hosting? Khi ngành công nghệ thông tin phát triển. Chắc hẳn cái tên...

Chuyển HTTP sang HTTPS trên Windows IIS

27/04/2022

56

Hướng dẫn này sẽ chỉ cho bạn cách định cấu hình trang web của bạn trong IIS 10 để tất cả  http:// các liên kết...
Danh mục
  • VPS Linux
  • Thông báo
  • Cpanel
  • Cài đặt SSL
  • Control Panel
  • Phần mềm
  • cPanel
  • Hosting windows
  • Webserver
  • Khởi tạo CSR
  • Kiến thức chung
  • Chuẩn bị đăng ký
  • Server
  • VPS Windows
  • Chứng chỉ SSL
  • Dịch vụ CDN
  • Hướng dẫn
  • Cloud VPS
  • 1-Click install Apps
  • Dedicate Server
  • Hosting (Linux, Windows)
  • Giới thiệu chung
  • Tuyển dụng
  • IP
  • DirectAdmin
  • cPanel
  • Xác thực SSL
  • Thiết kế website
  • DirectAdmin
  • Hosting Linux
  • Hosting SEO
  • Quản lý hosting
  • Tin tức
  • Nginx
  • Tên miền
  • Email
  • WordPress

Về chúng tôi

  • Giới thiệu
  • Thông báo
  • Hướng dẫn
  • Tuyển dụng
  • Liên hệ

Các dịch vụ

  • Giới thiệu
  • Thông báo
  • Hướng dẫn
  • Tuyển dụng
  • Liên hệ

Thông tin cần biết

  • Giới thiệu
  • Thông báo
  • Hướng dẫn
  • Tuyển dụng
  • Liên hệ

Câu hỏi thường gặp

  • Giới thiệu
  • Thông báo
  • Hướng dẫn
  • Tuyển dụng
  • Liên hệ

Hướng dẫn sử dụng

  • Giới thiệu
  • Thông báo
  • Hướng dẫn
  • Tuyển dụng
  • Liên hệ

Số ĐKKD: 0104850587, cấp ngày 10/8/2010, tại sở KHĐT Hà Nội

Địa chỉ trụ sở: BT2-VT18, Khu nhà ở Xa La, Phường Phúc La, Quận Hà Đông, Thành phố Hà Nội, Việt Nam

Chịu trách nhiệm nội dung: Giám đốc Thịnh Văn Hạnh

Copyright © Since 2010 BKNS, All rights reserved

Sử dụng dịch vụ tại BKNS.VN có nghĩa là bạn đồng ý với Quy định sử dụng của chúng tôi.

Công ty cổ phần giải pháp mạng Bạch Kim

Tầng 5, Tòa nhà 169, Nguyễn Ngọc Vũ, Phường Trung Hòa, Quận Cầu Giấy, TP Hà Nội.

Lầu 2 Tòa nhà 1B1 Thành Thái, Cư Xá Đồng Tiến, Phường 14, Quận 10, TP. Hồ Chí Minh.

Tổng đài 24/7: 1900 63 68 09

Tư vấn dịch vụ: 1800 646 884 (Miễn phí cước)

Email liên hệ: info@bkns.vn

Email phản hồi dịch vụ: gopy@bkns.vn

Liên hệ với chúng tôi:

Zalo Offcial Account của hệ thống :

Chấp nhận thanh toán:

Copyright © Since 2010 BKNS, All rights reserved
  • Tên miền
    • Đăng ký tên miền
      Xây dựng thương hiệu trên internet
    • Gia hạn tên miền
      Duy trì tên miền với mức giá hợp lý
    • Quy trình đăng ký
    • Các biểu mẫu văn bản
    • Quy trình xử lý khiếu nại
    • Thủ tục chuyển nhượng tên miền VN
  • Hosting
    • NVME Hosting
      Hosting tốc độ nhanh nhất hiện nay
    • Hosting Linux DirectAdmin
      Off 15%: Hosting + Domain
    • Hosting Linux cPanel
      Giảm giá lên đến 40%
    • Hosting WordPress
      Off 20%: Chuyển dịch vụ về BKNS
  • Email
    • Cloud Email Hosting
      Off 20%: Hosting + Domain + Email
    • Email Relay
      White list IP
    • Cloud Email Server
      Miễn phí SSL, Giảm giá 20%
    • Các hỏi đáp về dịch vụ Email
  • Cloud
    • Cloud VPS SEO
      Dành riêng cho SEO với 5 IP
    • Cloud VPS SSD
      Giảm giá lên dến 35%
    • VPS MMO
    • Cloud VPS BK Misa
    • E-meeting
    • Cloud VPN
  • Máy chủ
    • Cho thuê máy chủ
      Thuê máy chủ tặng máy chủ
    • Thuê chỗ đặt máy chủ
      Miễn phí 500W điện
    • Dịch vụ quản trị máy chủ trọn gói
      Yên tâm, an toàn dữ liệu
    • Máy chủ cho MMO
      Tương tác tốt nhất với Youtube, FB, Google và MMO
    • Các dịch vụ liên quan tới máy chủ
  • Phần mềm
    • DirectAdmin
    • CloudLinux
    • Plesk
    • vBulletin
    • LiteSpeed
    • Softaculous
    • Imunify360
  • Website
  • Chứng chỉ SLL
  • Đại lý
    • Chính sách đại lý
    • Bảng giá đại lý
    • Các hỏi đáp về đại lý
  • Hướng dẫn
    • Hướng dẫn dịch vụ
    • Hướng dẫn sử dụng trang id.bkns.vn
    • Hướng dẫn thanh toán
    • Cam kết chất lượng mức dịch vụ (SLA)
  • WooCommerce not Found
  • Newsletter
  • Đăng nhập
    • English
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT
  • Tên miền
    • Đăng ký tên miền
      Xây dựng thương hiệu trên internet
    • Gia hạn tên miền
      Duy trì tên miền với mức giá hợp lý
    • Quy trình đăng ký
    • Các biểu mẫu văn bản
    • Quy trình xử lý khiếu nại
    • Thủ tục chuyển nhượng tên miền VN
  • Hosting
    • NVME Hosting
      Hosting tốc độ nhanh nhất hiện nay
    • Hosting Linux DirectAdmin
      Off 15%: Hosting + Domain
    • Hosting Linux cPanel
      Giảm giá lên đến 40%
    • Hosting WordPress
      Off 20%: Chuyển dịch vụ về BKNS
  • Email
    • Cloud Email Hosting
      Off 20%: Hosting + Domain + Email
    • Email Relay
      White list IP
    • Cloud Email Server
      Miễn phí SSL, Giảm giá 20%
    • Các hỏi đáp về dịch vụ Email
  • Cloud
    • Cloud VPS SEO
      Dành riêng cho SEO với 5 IP
    • Cloud VPS SSD
      Giảm giá lên dến 35%
    • VPS MMO
    • Cloud VPS BK Misa
    • E-meeting
    • Cloud VPN
  • Máy chủ
    • Cho thuê máy chủ
      Thuê máy chủ tặng máy chủ
    • Thuê chỗ đặt máy chủ
      Miễn phí 500W điện
    • Dịch vụ quản trị máy chủ trọn gói
      Yên tâm, an toàn dữ liệu
    • Máy chủ cho MMO
      Tương tác tốt nhất với Youtube, FB, Google và MMO
    • Các dịch vụ liên quan tới máy chủ
  • Phần mềm
    • DirectAdmin
    • CloudLinux
    • Plesk
    • vBulletin
    • LiteSpeed
    • Softaculous
    • Imunify360
  • Website
  • Chứng chỉ SLL
  • Đại lý
    • Chính sách đại lý
    • Bảng giá đại lý
    • Các hỏi đáp về đại lý
  • Hướng dẫn
    • Hướng dẫn dịch vụ
    • Hướng dẫn sử dụng trang id.bkns.vn
    • Hướng dẫn thanh toán
    • Cam kết chất lượng mức dịch vụ (SLA)
  • Chat Zalo
  • Chat Messenger