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.
networking server ssh
add a comment |
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.
networking server ssh
do you havessh
access to that server?
– RoVo
Feb 26 at 9:37
yes. i can run ssh root@10.0.0.1 and access the public server
– Tran Ngu Dang
Feb 26 at 9:42
add a comment |
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.
networking server ssh
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.
networking server ssh
networking server ssh
asked Feb 26 at 9:31
Tran Ngu DangTran Ngu Dang
1585
1585
do you havessh
access to that server?
– RoVo
Feb 26 at 9:37
yes. i can run ssh root@10.0.0.1 and access the public server
– Tran Ngu Dang
Feb 26 at 9:42
add a comment |
do you havessh
access to that server?
– RoVo
Feb 26 at 9:37
yes. i can run ssh root@10.0.0.1 and access the public server
– Tran Ngu Dang
Feb 26 at 9:42
do you have
ssh
access to that server?– RoVo
Feb 26 at 9:37
do you have
ssh
access to that server?– RoVo
Feb 26 at 9:37
yes. i can run ssh root@10.0.0.1 and access the public server
– Tran Ngu Dang
Feb 26 at 9:42
yes. i can run ssh root@10.0.0.1 and access the public server
– Tran Ngu Dang
Feb 26 at 9:42
add a comment |
2 Answers
2
active
oldest
votes
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/";
Thank you for your support. I failed with the SOCKS setup from the RoVo. But it seems setting up a squid proxy server at 10.0.0.1 does indeed work
– Tran Ngu Dang
yesterday
add a comment |
Open a terminal and start ssh
dynamic port forwarding:
ssh -D 1080 root@10.0.0.1
This will start a socks proxy on your computer on port 1080.
Add this line to your /etc/apt/apt.conf
file:
Acquire::socks::Proxy "socks5h://localhost:1080";
Then you can run your apt update
/ apt install
commands. When you're done, you can close the ssh
connection and revert the changes in apt.conf
.
You can also tell your Browser or other applications to use that Socks proxy and access the Internet.
I run the command and get this error: Failed to fetch ports.ubuntu.com/ubuntu-ports/pool/universe/a/autossh/… Cannot initiate the connection to 1080:80 (0.0.4.56). - connect (22: Invalid argument)
– Tran Ngu Dang
Feb 26 at 11:02
the dynamic port forwarding seems to be correct: tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN 21096/ssh
– Tran Ngu Dang
Feb 26 at 11:03
Do i need to setup the remote server as a proxy server ?
– Tran Ngu Dang
Feb 26 at 11:03
sorry, the line inapt.conf
was wrong, I edited that. Please try again.
– RoVo
Feb 26 at 12:13
1
The DNS request is not sent via Socks Proxy, in apt.conf, changesocks5://
tosocks5h://
, that should work, fingers crossed. Sorry, it's difficult to test for me, because I have connection ...
– RoVo
Feb 26 at 15:13
|
show 1 more comment
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1121350%2fhow-to-access-internet-and-run-apt-get-through-a-middle-server%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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/";
Thank you for your support. I failed with the SOCKS setup from the RoVo. But it seems setting up a squid proxy server at 10.0.0.1 does indeed work
– Tran Ngu Dang
yesterday
add a comment |
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/";
Thank you for your support. I failed with the SOCKS setup from the RoVo. But it seems setting up a squid proxy server at 10.0.0.1 does indeed work
– Tran Ngu Dang
yesterday
add a comment |
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/";
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/";
edited Feb 26 at 10:26
terdon♦
66.6k12139221
66.6k12139221
answered Feb 26 at 9:54
AlpyAlpy
33016
33016
Thank you for your support. I failed with the SOCKS setup from the RoVo. But it seems setting up a squid proxy server at 10.0.0.1 does indeed work
– Tran Ngu Dang
yesterday
add a comment |
Thank you for your support. I failed with the SOCKS setup from the RoVo. But it seems setting up a squid proxy server at 10.0.0.1 does indeed work
– Tran Ngu Dang
yesterday
Thank you for your support. I failed with the SOCKS setup from the RoVo. But it seems setting up a squid proxy server at 10.0.0.1 does indeed work
– Tran Ngu Dang
yesterday
Thank you for your support. I failed with the SOCKS setup from the RoVo. But it seems setting up a squid proxy server at 10.0.0.1 does indeed work
– Tran Ngu Dang
yesterday
add a comment |
Open a terminal and start ssh
dynamic port forwarding:
ssh -D 1080 root@10.0.0.1
This will start a socks proxy on your computer on port 1080.
Add this line to your /etc/apt/apt.conf
file:
Acquire::socks::Proxy "socks5h://localhost:1080";
Then you can run your apt update
/ apt install
commands. When you're done, you can close the ssh
connection and revert the changes in apt.conf
.
You can also tell your Browser or other applications to use that Socks proxy and access the Internet.
I run the command and get this error: Failed to fetch ports.ubuntu.com/ubuntu-ports/pool/universe/a/autossh/… Cannot initiate the connection to 1080:80 (0.0.4.56). - connect (22: Invalid argument)
– Tran Ngu Dang
Feb 26 at 11:02
the dynamic port forwarding seems to be correct: tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN 21096/ssh
– Tran Ngu Dang
Feb 26 at 11:03
Do i need to setup the remote server as a proxy server ?
– Tran Ngu Dang
Feb 26 at 11:03
sorry, the line inapt.conf
was wrong, I edited that. Please try again.
– RoVo
Feb 26 at 12:13
1
The DNS request is not sent via Socks Proxy, in apt.conf, changesocks5://
tosocks5h://
, that should work, fingers crossed. Sorry, it's difficult to test for me, because I have connection ...
– RoVo
Feb 26 at 15:13
|
show 1 more comment
Open a terminal and start ssh
dynamic port forwarding:
ssh -D 1080 root@10.0.0.1
This will start a socks proxy on your computer on port 1080.
Add this line to your /etc/apt/apt.conf
file:
Acquire::socks::Proxy "socks5h://localhost:1080";
Then you can run your apt update
/ apt install
commands. When you're done, you can close the ssh
connection and revert the changes in apt.conf
.
You can also tell your Browser or other applications to use that Socks proxy and access the Internet.
I run the command and get this error: Failed to fetch ports.ubuntu.com/ubuntu-ports/pool/universe/a/autossh/… Cannot initiate the connection to 1080:80 (0.0.4.56). - connect (22: Invalid argument)
– Tran Ngu Dang
Feb 26 at 11:02
the dynamic port forwarding seems to be correct: tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN 21096/ssh
– Tran Ngu Dang
Feb 26 at 11:03
Do i need to setup the remote server as a proxy server ?
– Tran Ngu Dang
Feb 26 at 11:03
sorry, the line inapt.conf
was wrong, I edited that. Please try again.
– RoVo
Feb 26 at 12:13
1
The DNS request is not sent via Socks Proxy, in apt.conf, changesocks5://
tosocks5h://
, that should work, fingers crossed. Sorry, it's difficult to test for me, because I have connection ...
– RoVo
Feb 26 at 15:13
|
show 1 more comment
Open a terminal and start ssh
dynamic port forwarding:
ssh -D 1080 root@10.0.0.1
This will start a socks proxy on your computer on port 1080.
Add this line to your /etc/apt/apt.conf
file:
Acquire::socks::Proxy "socks5h://localhost:1080";
Then you can run your apt update
/ apt install
commands. When you're done, you can close the ssh
connection and revert the changes in apt.conf
.
You can also tell your Browser or other applications to use that Socks proxy and access the Internet.
Open a terminal and start ssh
dynamic port forwarding:
ssh -D 1080 root@10.0.0.1
This will start a socks proxy on your computer on port 1080.
Add this line to your /etc/apt/apt.conf
file:
Acquire::socks::Proxy "socks5h://localhost:1080";
Then you can run your apt update
/ apt install
commands. When you're done, you can close the ssh
connection and revert the changes in apt.conf
.
You can also tell your Browser or other applications to use that Socks proxy and access the Internet.
edited Feb 26 at 15:10
answered Feb 26 at 10:09
RoVoRoVo
7,7791943
7,7791943
I run the command and get this error: Failed to fetch ports.ubuntu.com/ubuntu-ports/pool/universe/a/autossh/… Cannot initiate the connection to 1080:80 (0.0.4.56). - connect (22: Invalid argument)
– Tran Ngu Dang
Feb 26 at 11:02
the dynamic port forwarding seems to be correct: tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN 21096/ssh
– Tran Ngu Dang
Feb 26 at 11:03
Do i need to setup the remote server as a proxy server ?
– Tran Ngu Dang
Feb 26 at 11:03
sorry, the line inapt.conf
was wrong, I edited that. Please try again.
– RoVo
Feb 26 at 12:13
1
The DNS request is not sent via Socks Proxy, in apt.conf, changesocks5://
tosocks5h://
, that should work, fingers crossed. Sorry, it's difficult to test for me, because I have connection ...
– RoVo
Feb 26 at 15:13
|
show 1 more comment
I run the command and get this error: Failed to fetch ports.ubuntu.com/ubuntu-ports/pool/universe/a/autossh/… Cannot initiate the connection to 1080:80 (0.0.4.56). - connect (22: Invalid argument)
– Tran Ngu Dang
Feb 26 at 11:02
the dynamic port forwarding seems to be correct: tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN 21096/ssh
– Tran Ngu Dang
Feb 26 at 11:03
Do i need to setup the remote server as a proxy server ?
– Tran Ngu Dang
Feb 26 at 11:03
sorry, the line inapt.conf
was wrong, I edited that. Please try again.
– RoVo
Feb 26 at 12:13
1
The DNS request is not sent via Socks Proxy, in apt.conf, changesocks5://
tosocks5h://
, that should work, fingers crossed. Sorry, it's difficult to test for me, because I have connection ...
– RoVo
Feb 26 at 15:13
I run the command and get this error: Failed to fetch ports.ubuntu.com/ubuntu-ports/pool/universe/a/autossh/… Cannot initiate the connection to 1080:80 (0.0.4.56). - connect (22: Invalid argument)
– Tran Ngu Dang
Feb 26 at 11:02
I run the command and get this error: Failed to fetch ports.ubuntu.com/ubuntu-ports/pool/universe/a/autossh/… Cannot initiate the connection to 1080:80 (0.0.4.56). - connect (22: Invalid argument)
– Tran Ngu Dang
Feb 26 at 11:02
the dynamic port forwarding seems to be correct: tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN 21096/ssh
– Tran Ngu Dang
Feb 26 at 11:03
the dynamic port forwarding seems to be correct: tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN 21096/ssh
– Tran Ngu Dang
Feb 26 at 11:03
Do i need to setup the remote server as a proxy server ?
– Tran Ngu Dang
Feb 26 at 11:03
Do i need to setup the remote server as a proxy server ?
– Tran Ngu Dang
Feb 26 at 11:03
sorry, the line in
apt.conf
was wrong, I edited that. Please try again.– RoVo
Feb 26 at 12:13
sorry, the line in
apt.conf
was wrong, I edited that. Please try again.– RoVo
Feb 26 at 12:13
1
1
The DNS request is not sent via Socks Proxy, in apt.conf, change
socks5://
to socks5h://
, that should work, fingers crossed. Sorry, it's difficult to test for me, because I have connection ...– RoVo
Feb 26 at 15:13
The DNS request is not sent via Socks Proxy, in apt.conf, change
socks5://
to socks5h://
, that should work, fingers crossed. Sorry, it's difficult to test for me, because I have connection ...– RoVo
Feb 26 at 15:13
|
show 1 more comment
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1121350%2fhow-to-access-internet-and-run-apt-get-through-a-middle-server%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
do you have
ssh
access to that server?– RoVo
Feb 26 at 9:37
yes. i can run ssh root@10.0.0.1 and access the public server
– Tran Ngu Dang
Feb 26 at 9:42