首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >终端中如何绕过代理到ping google.com

终端中如何绕过代理到ping google.com
EN

Ask Ubuntu用户
提问于 2016-09-02 12:41:01
回答 3查看 14.4K关注 0票数 2

我正试图在我的ubuntu终端上点击google.com。但收到了错误信息。

代码语言:javascript
运行
复制
ping www.google.com
ping: unknown host www.google.com

我是我大学网络的代理人。我在互联网上看到了很多如何做到这一点的例子,但没有一个对我有用。

我正在使用Ubuntu14.04LTS(我是UBUNTU的新用户)

我尝试了以下解决方案

选项1

代码语言:javascript
运行
复制
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.http enabled true
gsettings set org.gnome.system.proxy.http host 'http://192.168.3.10'
gsettings set org.gnome.system.proxy.http port 3128
gsettings set org.gnome.system.proxy.http use-authentication true
gsettings set org.gnome.system.proxy.http authentication-user 'myusername'
gsettings set org.gnome.system.proxy.http authentication-password 'mypassword'

最后

代码语言:javascript
运行
复制
sudo gedit /etc/apt/apt.conf.d/20proxy

Acquire::http::Proxy "http://myusername:mypassword@192.168.3.10:8080"

选项2

代码语言:javascript
运行
复制
sudo -H gedit /etc/profile.d/proxy.sh
export http_proxy=http://username:password@proxyhost:port/ 
export ftp_proxy=http://username:password@proxyhost:port/
export telnet_proxy=http://username:password@proxyhost:port/

不幸的是,这两种方法都没有用。

EN

回答 3

Ask Ubuntu用户

回答已采纳

发布于 2016-09-02 15:01:31

打开你的终端,

代码语言:javascript
运行
复制
gedit .bashrc

再加上这些行,

代码语言:javascript
运行
复制
export http_proxy="http://myusername:mypassword@mycompanyproxy.com:8080"
export https_proxy="https://myusername:mypassword@mycompanyproxy.com:8080"

关闭终端,打开新终端

代码语言:javascript
运行
复制
sudo gedit /etc/apt/apt.conf

再加上以下几行,

代码语言:javascript
运行
复制
Acquire::http::Proxy "http://myusername:mypassword@mycompanyproxy.com:8080"
Acquire::https::Proxy "https://myusername:mypassword@mycompanyproxy.com:8080"
Acquire::socks::Proxy "socks://myusername:mypassword@mycompanyproxy.com:8080"

现在试着点击google

代码语言:javascript
运行
复制
ping www.google.com

它肯定会成功的。

票数 0
EN

Ask Ubuntu用户

发布于 2016-09-02 16:17:31

简短的回答:如果他们做得对,你就做不到。

很长的答案:您所处的网络必须通过代理(这就是为什么您需要设置这些环境变量,顺便说一句,这些变量应该在/etc/environment中设置,并且不要忘记排除列表no_proxy)。

默认情况下,ping使用ICMP数据包。如果您有socks代理,代理将专门处理TCP数据包和UDP数据包。

代理对最终用户来说是一种痛苦。从历史上看,它们是出于表现原因而使用的,但今天,它们几乎完全被用来管理这种关系(你的雇主、你的大学等等)。或者避免地理阻塞(避免在地理上被Hulu、Netflix和类似的网站阻塞)。

您可以绕过代理,但它需要大量的工作和“免费”的外部服务器。方法是在https上使用ssh隧道,或者使用VPN也可以模拟https连接。然而,这完全超出了问题的范围。

票数 2
EN

Ask Ubuntu用户

发布于 2016-09-02 13:02:52

如果您使用的是静态IP,您还应该添加DNS服务器。

  1. 编辑/etc/network/interfaces:sudo /etc/网络/接口
  2. iface eth0 inet static下面添加一行: DNS名称服务器8.8.8.8 8.8.4.4,这将使用Google的DNS服务器。
  3. 重新启动网络: sudo /etc/init.d/网络重新启动

注意:正如混沌所言,您也可以编辑/etc/resolv.conf,但是这些更改将被重写在reobot上。

Note2:有时sudo /etc/init.d/networking restart是不够的,但是完全重新启动会有所帮助。

票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/820036

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档