Thursday, January 12, 2017

networking - How to access internet and run apt-get through a middle server?




I have a machine running ubuntu 16.04. The machine can only access 1 remote server (also running ubuntu). The remote server has full access to internet though.



root@localmachine:~# ifconfig usb0
usb0 Link encap:Ethernet HWaddr 02:1e:10:1f:00:00
inet addr:10.1.0.94 Bcast:10.1.0.95 Mask:255.255.255.252
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4366027 errors:0 dropped:0 overruns:0 frame:0
TX packets:1813925 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:669835698 (669.8 MB) TX bytes:265999026 (265.9 MB)


root@localmachine:~# ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=62 time=58.4 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=62 time=59.2 ms


I need to install some package on this local machine via apt-get.



Is there a way to access internet throught the public server at 10.0.0.1 ?




Thank you for your reply.



The easiest way would be that you set up a proxy server on the middle server/gateway and set up your apt to use this proxy:



sudo vi /etc/apt/apt.conf.d/proxy.conf


And add this line:




Acquire::http::Proxy "http://user:password@proxy.server:port/";

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...