❶ linux下squid代理伺服器配置 打入ping命令後之後沒有了反應怎麼解決
squid和ping又沒必然聯系。你這問題沒頭沒腦的。況且ping用的icmp協議又不支持http代理。
❷ linux下用squid做代理伺服器的問題。
可以配置單網卡代理伺服器。
安裝squid代理伺服器之後,需要設置Linux的主機名為FQDN的格式,並且要保證能夠解析出來。
首先運行squid -z進行初始化,然後要修改squid的配置文件:/etc/squid/squid.conf
加入如下條目:
acl mynet 192.168.1.0/24
http_access allow mynet
啟動服務:service squid start
圖形化的工具可以嘗試webmin
❸ 請教關於linux代理伺服器設置的問題
squid代理和nginx代理(相關配置http://www.360doc.com/content/13/1114/12/7694408_329125489.shtml),這里主要講squid ,因為現在用的比較多
第一步:安裝SQUID軟體
從www.squid-cache.org下載SQUID軟體,以squid-2.4.STABLE1-src.tar.gz為例。
運行「tar zxf squid-2.4.STABLE1-src.tar.gz」,生成「squid-2.4.STABLE1」目錄。因為SQUID的運行需要nobody用戶和nobody組,所以先運行Linuxconf命令查看是否有這個用戶和組,沒有就需要建立。
切換到「squid-2.4.STABLE1」目錄,運行「./configure --prefix=/usr/local/squid」,然後運行「make all」,然後運行「make install」安裝軟體。squid將會被安裝到/usr/local/squid目錄下。
第二步:配置SQUID
1、「chmod 777 /usr/local/squid/logs」,設置logs許可權。這樣才能在logs目錄才產生access.log、cache.log等文件。
2、「/usr/local/squid/bin/squid -z」,手工建立squid的緩存目錄/usr/local/squid/cache。
3、修改SQUID的配置文件squid.conf。SQUID的配置文件,編輯 vi /usr/local/squid/etc/squid.conf文件,找到「http_access deny all」並改為「http_access allow all」。然後SQUID服務就可以啟動了。
4、運行 squid -z 初始化
5、netstat -ntl 查看開放端
6、/usr/local/squid/bin/RunCache」,啟動squid代理服務。
7、service squid start 啟動服務
8、netstat -n |grep "192.168.1" 查看。
第三步、測試代理服務
運行IE瀏覽器,單擊「工具-》Internet選項-》連接-》區域網設置」;在代理伺服器下面的小窗口上面打上對勾,然後在地址窗口中填上SQUID伺服器的IP地址,在埠處填上「3218」(SQUID軟體默認代理埠),確定後退出。然後可以打開瀏覽器試試或者查看logs下的access.log和cache.log,看看是否代理運行正常。
❹ 在Linux中可以實現代理伺服器功能的軟體是什麼
Linux中實現代理伺服器功能最常用的軟體為squid,下面是源代碼包安裝步驟:
1.從http://www.squid-cache.org下載squid-2.2.STABLE4-src.tar.gz
2.將該文件拷貝到/usr/local目錄
cpsquid-2.2.STABLE4-src.tar.gz/usr/local
3.解開該文件
tarxvzf
squid-2.2.STABLE4-src.tar.gz
#為了方便使用將目錄更名為squid
mvsquid-2.2.STABLE4squid
4.進入squid目錄
cdsquid
5.執行編譯
./configure
#系統默認安裝目錄為/usr/local/squid
/configure-prefix=/directory/you/want
#指定安裝目錄
6.執行
makeall
7.執行安裝
makeinstall
8.安裝結束後,Squid的可執行文件在安裝目錄的bin子目錄下,配置文件在etc子目錄下。
❺ 如何在linux上用squid搭建代理伺服器
1、首先下載:squid-3.2.9.tar.bz2
2、上傳到伺服器後解壓:
解壓: tar -vxjf squid-3.2.9.tar.bz2
解壓後生成目錄:squid-3.2.9
進入目錄翻看文檔INSTALL:
xxxx> more INSTALL
To build and install the Squid Cache, type:
% ./configure --prefix=/usr/local/squid
% make all
% make install
To run a Cache, you will need to:
1. customize the squid.conf configuration file:
% vi /usr/local/squid/etc/squid.conf
2. Initalise the cache:
% /usr/local/squid/sbin/squid -z
3. start the cache:
% /usr/local/squid/sbin/squid
If you want to use the WWW interface to the Cache Manager,
the cachemgr.cgi program into your httpd server's cgi-bin
directory.
3、安裝步驟:
./configure --prefix=/usr/local/squid
make all
sudo make install(因為要拷貝到系統目錄,需要root許可權,所以sudo了,你也可以root登錄執行,我是Ubuntu的系統,所以用sudo,有root許可權就行)
檢查配置文件:
sudo vi /usr/local/squid/etc/squid.conf
配置項1:
# Squid normally listens to port 3128
http_port 3128
配置項2:
acl localnet src 192.168.0.0/16
http_access allow localnet
配置項3:
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /usr/local/squid/var/cache/squid 100 16 128
cache_mem 32 MB (這一條必須配置)
否則就會遭遇報錯: 2013/10/12 16:16:55 kid1| WARNING cache_mem is larger than total disk cache space!
安裝好了以後,系統中新建了一個用戶squid,在組中一查,發現屬於nobody組的:
cat /etc/passwd|grep squid
cat /etc/group|grep 65534
安裝squid的所在目錄是:/usr/local/squid
直接改了所屬用戶為squid:nobody
sudo chown -Rf squid:nobody /usr/local/squid
建立cache的時候,對下面目錄需要nobody用戶許可權:
sudo chown -Rf nobody /usr/local/squid/var/cache/
sudo chown -Rf nobody /usr/local/squid/var/logs/
否則會遭遇:
WARNING: Cannot write log file: /usr/local/squid/var/logs/cache.log
FATAL: Failed to make swap directory /usr/local/squid/var/cache/squid/00: (13) Permission denied
初始化squid.conf里配置的cache目錄,就是建立了一堆的目錄:
sudo /usr/local/squid/sbin/squid -z
在前台啟動squid,並輸出啟動過程
sudo /usr/local/squid/sbin/squid -N -d1
顯示ready to server reques,則啟動成功。可以鍵入ctrl+c,停止squid,並以後台運行的方式啟動。
沒有在配置文件中配置DNS,而是在 /etc/resolv.conf 中配置:
domain site
nameserver x.x.x.x
所以列印出來的日誌中就這樣的:
2013/10/12 16:42:13| Adding nameserver x.x.x.x from /etc/resolv.conf
squid從這個配置文件中讀取了dns配置來用。
啟動squid後台運行
sudo /usr/local/squid/sbin/squid -s
檢查一下進程是否存在:ps -ef|grep squid
通過squid客戶端查看squid運行狀態
/usr/local/squid/bin/squidclient -h 127.0.0.1 -p 3128 mgr:info
那台不能上網的機器配置如下:
export http_proxy=http://192.168.199.235:3128/
可以把這句寫到啟動文件中,比如什麼.profile或者.bashrc,或者/etc/profile等等。
取消:unset http_proxy
最後測試一下能不能上網了。
❻ Linux中怎麼設置透明代理
a.客戶端的windows PC的網關必須設成Squid代理伺服器,因為既然你的browser中沒有任何代理設置,你要訪問某個站點時,包必須經經過squid代理伺服器才能被重定向,故這是最基本的條件。
b.客戶端必須正確設置DNS伺服器。因為既然現在不用設置任何代理。則DNS必須由browser來解析,也就是要由客戶端的PC中TCP/IP中設置的DNS伺服器來正確解析出某個站點的IP地址來。
c.伺服器端可以安裝squid代理伺服器,1.x or 2.x版本均可。
3.配置Squid代理,啟動透明代理功能
Squid-2
加下面的行到你的/etc/squid/squid.conf中
http_port 8080
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
Squid-1.1
加下面的行到/etc/squid.conf
http_port 8080
httpd_accel virtual 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
4. 重啟動squid. 用下面的命令:
#/usr/sbin/squid -k reconfigure
如提示內核不支持透明代理。則你需要重新編譯內核,enable 透明代理的支持。
下面是你需要啟動的內核項目:
[*] Network firewalls
[ ] Socket Filtering
[*] Unix domain sockets
[*] TCP/IP networking
[ ] IP: multicasting
[ ] IP: advanced router
[ ] IP: kernel level autoconfiguration
[*] IP: firewalling
[ ] IP: firewall packet netlink device
[*] IP: always defragment (required for masquerading)
[*] IP: transparent proxy support
5. 下面的命令針對Linux 2.2.x內核:
# Accept all on lookback
/sbin/ipchains -A input -j ACCEPT -i lo
#Accept my own IP, to prevent loops (repeat for each interface/alias)
/sbin/ipchains -A input -j ACCEPT -p tcp -d 192.168.11.1/32 80
#Send all traffic destined to port 80 to Squid on port 80
/sbin/ipchains -A input -j REDIRECT 8080 -p tcp -s 192.168.11.0/24 -d 0/0 80
下面的命令針對Linux 2.0.x內核:
# Accept all on loopback
ipfwadm -I -a accept -W lo
# Accept my own IP, to prevent loops (repeat for each interface/alias)
ipfwadm -I -a accept -P tcp -D 192.168.11.1/32 80
# Send all traffic destined to port 80 to Squid on port 3128
ipfwadm -I -a accept -P tcp -S 192.168.11.0/24 -D 0/0 80 -r 8080
6.應注意的問題:
a. 這種透明代理只能針對http協議,不能針對FTP協議
b. PC的默認網關應設成squid 代理伺服器
c. 防火牆重定向規則在其它的input規則的前面,注意順序。
如:
/etc/rc.d/rc.firewall:
#!/bin/sh
# rc.firewall Linux kernel firewalling rules
FW=/sbin/ipfwadm
# Flush rules, for testing purposes
for i in I O F # A # If we enabled accounting too
do
${FW} -$i -f
done
# Default policies:
${FW} -I -p rej # Incoming policy: reject (quick error)
${FW} -O -p acc # Output policy: accept
${FW} -F -p den # Forwarding policy: deny
# Input Rules:
# Loopback-interface (local access, eg, to local nameserver):
${FW} -I -a acc -S localhost/32 -D localhost/32
# Local Ethernet-interface:
# Redirect to Squid proxy server:
${FW} -I -a acc -P tcp -D default/0 80 -r 8080
# Accept packets from local network:
${FW} -I -a acc -P all -S localnet/8 -D default/0 -W eth0
# Only required for other types of traffic (FTP, Telnet):
# Forward localnet with masquerading (udp and tcp, no icmp!):
${FW} -F -a m -P tcp -S localnet/8 -D default/0
${FW} -F -a m -P udp -S localnet/8 -D default/0
Here all traffic from the local LAN with any destination gets redirected to the
local port 8080.
需要解決更多linux問題,詳情請看 http://www.linuxprobe.com/chapter-00.html
望採納!
❼ linux下用squid實現代理伺服器的問題。
完全可以
在伺服器上設置FQDN,squid要求使用FQDN。例如server.linux.com,使用hostname命令即可:
hostname server.linux.com
在/etc/hosts文件中寫入上述FQDN的解析條目:
192.168.2.161 server.linux.com
然後運行命令squid -z完成初始化
修改/etc/squid/squid.conf配置文件。該文件絕大部分的配置都不需要修改,只要加入你的訪問控制即可。
可以加入兩行:
acl mynet src 192.168.2.0/255.255.255.0
http_access allow mynet
最後客戶端在瀏覽器上設置代理地址就可以了
❽ 簡述Linux Squid代理伺服器的主要作用
squid is a high-performance proxy caching server for web clients, supporting FTP, gopher, and HTTP data objects. Unlike traditional caching software, squid handles all requests in a single, non-blocking, I/O-driven process.
squid keeps meta data and especially hot objects cached in RAM, caches DNS lookups, supports non-blocking DNS lookups, and implements negative caching of failed requests.
squid supports SSL, extensive access controls, and full request logging. By using the lightweight Internet Cache Protocol, squid caches can be arranged in a hierarchy or mesh for additional bandwidth savings.
squid consists of a main server program squid, a Domain Name System lookup program dnsserver, some optional programs for rewriting requests and performing authentication, and some management and client tools. When squid starts up, it spawns a configurable number of dnsserver processes, each of which can perform a single, blocking Domain Name System (DNS) lookup. This reces the amount of time the cache waits for DNS lookups.
❾ 如何在Linux上用Squid搭建代理伺服器
squid是所有服務裡面最簡單的我覺得
以RHEL7為例,它分成了正向代理和反向代理,正向代理里又分「標准正向代理」,「ACL訪問控制」以及「透明正向代理」。下面是標准正向代理
16.3 正向代理
16.3.1 標准正向代理
Squid服務程序軟體包在正確安裝並啟動後默認就已經可以為用戶提供標准正向代理模式服務了,而不需要單獨再去修改配置文件或者其他操作,咱們可以立即在Windows7系統的客戶端主機上面打開任意一款瀏覽器,然後點擊Internet選項標簽,如圖16-4所示:
[root@linuxprobe ~]# systemctl restart squid
[root@linuxprobe ~]# systemctl enable squid
ln -s '/usr/lib/systemd/system/squid.service' '/etc/systemd/system/multi-user.target.wants/squid.service'
用戶要想使用Squid服務程序提供的標准正向代理模式服務就必須在瀏覽器中填寫伺服器的IP地址以及埠號信息,因此咱們還需要依次點擊連接標簽後點擊區域網設置選項,如圖16-5與圖16-6所示填寫伺服器信息後保存退出配置向導。
用戶只需要在瀏覽器中簡單的填寫配置信息就可以開始享用Squid服務程序提供的代理服務了,此時作為一個網卡為僅主機模式(Hostonly)的虛擬機,開始也奇跡般的能夠上網瀏覽了,這一切都是托代理伺服器轉發的功勞哦~
如此公開而沒有密碼驗證的代理服務終歸覺得不放心,萬一有其他人也來「蹭網」咱們的代理服務怎麼辦呢?Squid服務程序默認的會佔用3128、3401與4827等埠號,咱們可以將默認佔用的埠號修改成其他值,這樣應該能起到一定的保護作用吧~同學們都知道在Linux系統配置服務程序就是在修改該服務的配置文件,因此直接在/etc目錄中找到和squid服務程序同名目錄中的配置文件,把其中http_port參數後面原有3128修改為10000,這樣即是將Squid服務程序的代理服務埠修改成了新值,當然最後不要忘記再重啟下服務程序哦~:
[root@linuxprobe ~]# vim /etc/squid/squid.conf
………………省略部分輸出信息………………
45 #
46 # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
47 #
48
49 # Example rule allowing access from your local networks.
50 # Adapt localnet in the ACL section to list your (internal) IP networks
51 # from where browsing should be allowed
52 http_access allow localnet
53 http_access allow localhost
54
55 # And finally deny all other access to this proxy
56 http_access deny all
57
58 # Squid normally listens to port 3128
59 http_port 10000
60
http_port 10000
………………省略部分輸出信息………………
[root@linuxprobe ~]# systemctl restart squid
[root@linuxprobe ~]# systemctl enable squid
ln -s '/usr/lib/systemd/system/squid.service' '/etc/systemd/system/multi-user.target.wants/squid.service'
同學們有沒有突然覺得這一幕似曾相識?在前面的第十章10.5.3小節咱們學習過基於埠號來部署httpd服務程序的虛擬主機功能,當時在編輯完配置文件後重啟服務程序時被直接提示報錯了,雖然現在重啟服務程序並沒有直接報錯,但其實客戶並不能使用代理服務呢,SElinux安全子系統認為Squid服務程序使用3128埠號是理所應當的,默認策略規則中也是允許的,但現在卻在嘗試使用新的10000埠號,這是原本並不屬於Squid服務程序應該使用的系統資源,因此咱們需要手動把新的埠號添加到squid服務程序在SElinux域的允許列表中即可:
[root@linuxprobe ~]# semanage port -l | grep -w -i squid_port_t
squid_port_t tcp 3128, 3401, 4827
squid_port_t udp 3401, 4827
[root@linuxprobe ~]# semanage port -a -t squid_port_t -p tcp 10000
[root@linuxprobe ~]# semanage port -l | grep -w -i squid_port_t
squid_port_t tcp 10000, 3128, 3401, 4827
squid_port_t udp 3401, 4827
更多的圖文信息以及其他的代理方式你可以看下http://www.linuxprobe.com/chapter-16.html#161這篇,講的非常詳細,相信能解決你的問題
❿ LINUX squid是什麼意思
代理伺服器,功能非常強大 很好用,注意在用的時候要開啟轉發功能