How to determine gateway address in a shared connection? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionChanging DD-WRT's default IP addressNetwork connectivity trouble to non-routing multi-homed hosts?Additional routes with DHCP's gatewaySimultaneous eth and wlan connectionHow to setup a local gatewayRouting traffic to my ipv4 routes except 0.0.0.0 address?Permanent outgoing IP address with enabled DHCPShared Internet IssueRouting Issue concerning VPN GatewayDisable Internet Access on Eth0
Can anything be seen from the center of the Boötes void? How dark would it be?
Trademark violation for app?
Around usage results
Maximum summed powersets with non-adjacent items
How do I find out the mythology and history of my Fortress?
How do pianists reach extremely loud dynamics?
How to tell that you are a giant?
Extracting terms with certain heads in a function
Is there any way for the UK Prime Minister to make a motion directly dependent on Government confidence?
Do jazz musicians improvise on the parent scale in addition to the chord-scales?
Would "destroying" Wurmcoil Engine prevent its tokens from being created?
Crossing US/Canada Border for less than 24 hours
Why do we bend a book to keep it straight?
What causes the direction of lightning flashes?
What are the out-of-universe reasons for the references to Toby Maguire-era Spider-Man in ITSV
How come Sam didn't become Lord of Horn Hill?
Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?
Can you use the Shield Master feat to shove someone before you make an attack by using a Readied action?
When the Haste spell ends on a creature, do attackers have advantage against that creature?
Find the length x such that the two distances in the triangle are the same
For a new assistant professor in CS, how to build/manage a publication pipeline
Is there a kind of relay only consumes power when switching?
8 Prisoners wearing hats
Do square wave exist?
How to determine gateway address in a shared connection?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionChanging DD-WRT's default IP addressNetwork connectivity trouble to non-routing multi-homed hosts?Additional routes with DHCP's gatewaySimultaneous eth and wlan connectionHow to setup a local gatewayRouting traffic to my ipv4 routes except 0.0.0.0 address?Permanent outgoing IP address with enabled DHCPShared Internet IssueRouting Issue concerning VPN GatewayDisable Internet Access on Eth0
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Suppose you have two computers, A and B, both running Ubuntu 16.04.
Then you connect them with an ethernet cable and share the connection from A to B, using network manager with the option "Shared with other computers". This usually gives A the IP 10.42.0.1, but if that IP Class is already taken (for example in A you have a wifi hotspot connection set before plugging the cable) can be 10.42.1.1.
Given that on B I select the connection to be used only for resource in its network, so there is no default gateway. I tried to take a look at ip route
of B and I get:
10.42.0.0/24 dev eno1 proto kernel scope link src 10.42.0.1 metric 100
A address is exactly what field src
is, but from the man page it says:
src ADDRESS: the source address to prefer when sending to the destina tions covered by the route prefix.
So to my understanding should be one of the B's interface address, not the "gateway" (A address)...
What am I missing and how can I determine in B the address of A ?
Edit
I'll try to explain what my final goal is. I want to schedule a daily file transfer (with scp) from B to A. However I have very limited physical access to B and no remote access at all, while I have remote access to A.
The connection between A and B has the only function to transfer that file, so I don't want A as default gateway (B has also a ppp connection for other services not managed by me) .
Basically I want to be free to change A IP in the future without touching B.. So I want to use a bash script to retrieve A IP address.
networking ip gateway connection-sharing
|
show 1 more comment
Suppose you have two computers, A and B, both running Ubuntu 16.04.
Then you connect them with an ethernet cable and share the connection from A to B, using network manager with the option "Shared with other computers". This usually gives A the IP 10.42.0.1, but if that IP Class is already taken (for example in A you have a wifi hotspot connection set before plugging the cable) can be 10.42.1.1.
Given that on B I select the connection to be used only for resource in its network, so there is no default gateway. I tried to take a look at ip route
of B and I get:
10.42.0.0/24 dev eno1 proto kernel scope link src 10.42.0.1 metric 100
A address is exactly what field src
is, but from the man page it says:
src ADDRESS: the source address to prefer when sending to the destina tions covered by the route prefix.
So to my understanding should be one of the B's interface address, not the "gateway" (A address)...
What am I missing and how can I determine in B the address of A ?
Edit
I'll try to explain what my final goal is. I want to schedule a daily file transfer (with scp) from B to A. However I have very limited physical access to B and no remote access at all, while I have remote access to A.
The connection between A and B has the only function to transfer that file, so I don't want A as default gateway (B has also a ppp connection for other services not managed by me) .
Basically I want to be free to change A IP in the future without touching B.. So I want to use a bash script to retrieve A IP address.
networking ip gateway connection-sharing
Use different subnets, e.g. 192.168.n.x
– ctrl-alt-delor
Apr 13 at 15:56
Just edited my question, I made confusion with A's ip route command, src is fine and has nothing to do with my question..
– rok
Apr 13 at 16:18
1
I’m missing what your actual goal is. Sharing a connection but without a gateway ? and then knowing the gateway's address ? does not make much sense networking-wise. Do you just want to connect the two computers together ? OR do you need to use computer A as a gateway for B to the Internet and/or to a LAN with different network address ? OR do you perhaps need to use computer A to let B access a wider LAN (i.e. a bridge) ? or what else ?
– LL3
Apr 13 at 16:57
Edited with more details. Please see if it's clear now..
– rok
Apr 13 at 17:20
I see. The thing is, since you don’t want computer A being a gateway for B, there’s no gateway to be known. I suppose the easiest approach for your case could be: 1. set your computer B’s dedicated interface to “addresses only” so that it won’t pollute the PPP’s DNS configuration and 2. query either the NetworkManager or the DHCP client process that handles computer B’s dedicated interface to get the DHCP server address, because that should always be computer A’s “shared connection”’s address.
– LL3
Apr 13 at 19:00
|
show 1 more comment
Suppose you have two computers, A and B, both running Ubuntu 16.04.
Then you connect them with an ethernet cable and share the connection from A to B, using network manager with the option "Shared with other computers". This usually gives A the IP 10.42.0.1, but if that IP Class is already taken (for example in A you have a wifi hotspot connection set before plugging the cable) can be 10.42.1.1.
Given that on B I select the connection to be used only for resource in its network, so there is no default gateway. I tried to take a look at ip route
of B and I get:
10.42.0.0/24 dev eno1 proto kernel scope link src 10.42.0.1 metric 100
A address is exactly what field src
is, but from the man page it says:
src ADDRESS: the source address to prefer when sending to the destina tions covered by the route prefix.
So to my understanding should be one of the B's interface address, not the "gateway" (A address)...
What am I missing and how can I determine in B the address of A ?
Edit
I'll try to explain what my final goal is. I want to schedule a daily file transfer (with scp) from B to A. However I have very limited physical access to B and no remote access at all, while I have remote access to A.
The connection between A and B has the only function to transfer that file, so I don't want A as default gateway (B has also a ppp connection for other services not managed by me) .
Basically I want to be free to change A IP in the future without touching B.. So I want to use a bash script to retrieve A IP address.
networking ip gateway connection-sharing
Suppose you have two computers, A and B, both running Ubuntu 16.04.
Then you connect them with an ethernet cable and share the connection from A to B, using network manager with the option "Shared with other computers". This usually gives A the IP 10.42.0.1, but if that IP Class is already taken (for example in A you have a wifi hotspot connection set before plugging the cable) can be 10.42.1.1.
Given that on B I select the connection to be used only for resource in its network, so there is no default gateway. I tried to take a look at ip route
of B and I get:
10.42.0.0/24 dev eno1 proto kernel scope link src 10.42.0.1 metric 100
A address is exactly what field src
is, but from the man page it says:
src ADDRESS: the source address to prefer when sending to the destina tions covered by the route prefix.
So to my understanding should be one of the B's interface address, not the "gateway" (A address)...
What am I missing and how can I determine in B the address of A ?
Edit
I'll try to explain what my final goal is. I want to schedule a daily file transfer (with scp) from B to A. However I have very limited physical access to B and no remote access at all, while I have remote access to A.
The connection between A and B has the only function to transfer that file, so I don't want A as default gateway (B has also a ppp connection for other services not managed by me) .
Basically I want to be free to change A IP in the future without touching B.. So I want to use a bash script to retrieve A IP address.
networking ip gateway connection-sharing
networking ip gateway connection-sharing
edited Apr 13 at 17:20
rok
asked Apr 13 at 15:49
rokrok
9619
9619
Use different subnets, e.g. 192.168.n.x
– ctrl-alt-delor
Apr 13 at 15:56
Just edited my question, I made confusion with A's ip route command, src is fine and has nothing to do with my question..
– rok
Apr 13 at 16:18
1
I’m missing what your actual goal is. Sharing a connection but without a gateway ? and then knowing the gateway's address ? does not make much sense networking-wise. Do you just want to connect the two computers together ? OR do you need to use computer A as a gateway for B to the Internet and/or to a LAN with different network address ? OR do you perhaps need to use computer A to let B access a wider LAN (i.e. a bridge) ? or what else ?
– LL3
Apr 13 at 16:57
Edited with more details. Please see if it's clear now..
– rok
Apr 13 at 17:20
I see. The thing is, since you don’t want computer A being a gateway for B, there’s no gateway to be known. I suppose the easiest approach for your case could be: 1. set your computer B’s dedicated interface to “addresses only” so that it won’t pollute the PPP’s DNS configuration and 2. query either the NetworkManager or the DHCP client process that handles computer B’s dedicated interface to get the DHCP server address, because that should always be computer A’s “shared connection”’s address.
– LL3
Apr 13 at 19:00
|
show 1 more comment
Use different subnets, e.g. 192.168.n.x
– ctrl-alt-delor
Apr 13 at 15:56
Just edited my question, I made confusion with A's ip route command, src is fine and has nothing to do with my question..
– rok
Apr 13 at 16:18
1
I’m missing what your actual goal is. Sharing a connection but without a gateway ? and then knowing the gateway's address ? does not make much sense networking-wise. Do you just want to connect the two computers together ? OR do you need to use computer A as a gateway for B to the Internet and/or to a LAN with different network address ? OR do you perhaps need to use computer A to let B access a wider LAN (i.e. a bridge) ? or what else ?
– LL3
Apr 13 at 16:57
Edited with more details. Please see if it's clear now..
– rok
Apr 13 at 17:20
I see. The thing is, since you don’t want computer A being a gateway for B, there’s no gateway to be known. I suppose the easiest approach for your case could be: 1. set your computer B’s dedicated interface to “addresses only” so that it won’t pollute the PPP’s DNS configuration and 2. query either the NetworkManager or the DHCP client process that handles computer B’s dedicated interface to get the DHCP server address, because that should always be computer A’s “shared connection”’s address.
– LL3
Apr 13 at 19:00
Use different subnets, e.g. 192.168.n.x
– ctrl-alt-delor
Apr 13 at 15:56
Use different subnets, e.g. 192.168.n.x
– ctrl-alt-delor
Apr 13 at 15:56
Just edited my question, I made confusion with A's ip route command, src is fine and has nothing to do with my question..
– rok
Apr 13 at 16:18
Just edited my question, I made confusion with A's ip route command, src is fine and has nothing to do with my question..
– rok
Apr 13 at 16:18
1
1
I’m missing what your actual goal is. Sharing a connection but without a gateway ? and then knowing the gateway's address ? does not make much sense networking-wise. Do you just want to connect the two computers together ? OR do you need to use computer A as a gateway for B to the Internet and/or to a LAN with different network address ? OR do you perhaps need to use computer A to let B access a wider LAN (i.e. a bridge) ? or what else ?
– LL3
Apr 13 at 16:57
I’m missing what your actual goal is. Sharing a connection but without a gateway ? and then knowing the gateway's address ? does not make much sense networking-wise. Do you just want to connect the two computers together ? OR do you need to use computer A as a gateway for B to the Internet and/or to a LAN with different network address ? OR do you perhaps need to use computer A to let B access a wider LAN (i.e. a bridge) ? or what else ?
– LL3
Apr 13 at 16:57
Edited with more details. Please see if it's clear now..
– rok
Apr 13 at 17:20
Edited with more details. Please see if it's clear now..
– rok
Apr 13 at 17:20
I see. The thing is, since you don’t want computer A being a gateway for B, there’s no gateway to be known. I suppose the easiest approach for your case could be: 1. set your computer B’s dedicated interface to “addresses only” so that it won’t pollute the PPP’s DNS configuration and 2. query either the NetworkManager or the DHCP client process that handles computer B’s dedicated interface to get the DHCP server address, because that should always be computer A’s “shared connection”’s address.
– LL3
Apr 13 at 19:00
I see. The thing is, since you don’t want computer A being a gateway for B, there’s no gateway to be known. I suppose the easiest approach for your case could be: 1. set your computer B’s dedicated interface to “addresses only” so that it won’t pollute the PPP’s DNS configuration and 2. query either the NetworkManager or the DHCP client process that handles computer B’s dedicated interface to get the DHCP server address, because that should always be computer A’s “shared connection”’s address.
– LL3
Apr 13 at 19:00
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f512291%2fhow-to-determine-gateway-address-in-a-shared-connection%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f512291%2fhow-to-determine-gateway-address-in-a-shared-connection%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
Use different subnets, e.g. 192.168.n.x
– ctrl-alt-delor
Apr 13 at 15:56
Just edited my question, I made confusion with A's ip route command, src is fine and has nothing to do with my question..
– rok
Apr 13 at 16:18
1
I’m missing what your actual goal is. Sharing a connection but without a gateway ? and then knowing the gateway's address ? does not make much sense networking-wise. Do you just want to connect the two computers together ? OR do you need to use computer A as a gateway for B to the Internet and/or to a LAN with different network address ? OR do you perhaps need to use computer A to let B access a wider LAN (i.e. a bridge) ? or what else ?
– LL3
Apr 13 at 16:57
Edited with more details. Please see if it's clear now..
– rok
Apr 13 at 17:20
I see. The thing is, since you don’t want computer A being a gateway for B, there’s no gateway to be known. I suppose the easiest approach for your case could be: 1. set your computer B’s dedicated interface to “addresses only” so that it won’t pollute the PPP’s DNS configuration and 2. query either the NetworkManager or the DHCP client process that handles computer B’s dedicated interface to get the DHCP server address, because that should always be computer A’s “shared connection”’s address.
– LL3
Apr 13 at 19:00