Ubuntu proxy settings (for those who are having trouble with on-campus proxies, assuming environment to use Docker, kubernetes, etc.)

System settings

sudo vi /etc/profile

Add the following

export http_proxy=http://xxx.xxx.xxx.xxx:xxxx/
export https_proxy=${http_proxy}
export HTTP_PROXY=${http_proxy}
export HTTPS_PROXY=${https_proxy}
export DOCKER_HOST_IP=172.17.0.1
export no_proxy=172.17.0.0/16
export NO_PROXY=${no_proxy}

Set 172.17.0.0/16 to no_proxy so that communication between nodes of kubernetes does not go through the proxy. (172.17.0.1 is sufficient if you use only Docker) Also, if there are other IP addresses that you do not want to go through the proxy in the local environment, separate them with ",". This point is also common to other setting items.

Reflect the changes.

source /etc/profile

apt settings

sudo vi /etc/apt/apt.conf

Described below

Acquire::http::Proxy "http://xxx.xxx.xxx.xxxx:xxxx";
Acquire::https::Proxy "http://xxx.xxx.xxx.xxx:xxxx";

curl settings

vi ~/.curlrc

Described below

proxy = "http://xxx.xxx.xxx.xxx:xxx/" 
noproxy = "172.17.0.0/16"

Docker settings

sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf

Described below

[Service]
Environment="HTTP_PROXY=http://xxx.xxx.xxx.xxx:xxxx/"
Environment="HTTPS_PROXY=http://xxx.xxx.xxx.xxx:xxx/"
Environment="NO_PROXY=172.17.0.0/16"
vi ~/.docker/config.json

Described below

{
 "proxies":
 {
   "default":
   {
     "httpProxy": "http://xxx.xxx.xxx.xxx:xxxx",
     "httpsProxy": "http://xxx.xxx.xxx.xxx:xxxx",
     "noProxy": "172.17.0.0/16"
   }
 }
}

Reflect changes

sudo systemctl daemon-reload
sudo systemctl restart docker

ssh settings

sudo vi ~/.ssh/config

Describe the following (if you want to access [email protected]:yyyy with ssh -T example) Also, if you're having trouble resolving your example.com domain name, look up your IP address. And write it directly.

Host example
    User hoge
    HostName example.com
    Port yyyy
    ProxyCommand connect -H http://xxx.xxx.xxx.xxx:xxxx %h %p
    IdentityFile ~/.ssh/id_rsa_pub

Recommended Posts

Ubuntu proxy settings (for those who are having trouble with on-campus proxies, assuming environment to use Docker, kubernetes, etc.)
[For those who create portfolios] How to use binding.pry with Docker
Use docker in proxy environment on ubuntu 20.04.1
How to use nginx-ingress-controller with Docker for Mac
For those who want to use MySQL for the database in the environment construction of Rails6 ~.
How to quit Docker for Mac and build a Docker development environment with Ubuntu + Vagrant
How to build docker environment with Gradle for intelliJ
[For those who create portfolios] How to use font-awesome-rails
[For those who create portfolios] How to use chart kick
Configuration script for using docker in proxy environment on ubuntu 20.04.1
You are required to use winpty with docker exec [Windows]