Find actual default gateway from command line
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I need to get the router IP which I thought I could do via the ip route
command (or many other variations). These all return a value for the default gateway which was fine until I discovered that what these commands return is actually the routers line in /etc/dhcpcd.conf
.
This wouldn't normally be an issue except the use case I'm trying to solve is when the default gateway has changed from what is configured (e.g. user moves house or gets a new ISP or even just a new router that is configured with a different IP address than the previous one). Obviously if the configuration is wrong in dhcpcd.conf
then there isn't a valid route to the internet.
Is there any command to get/find the actual IP address of the router or do I have to add a new gateway, ping something, if working great but if not then try another gateway?
linux networking
add a comment |Â
up vote
0
down vote
favorite
I need to get the router IP which I thought I could do via the ip route
command (or many other variations). These all return a value for the default gateway which was fine until I discovered that what these commands return is actually the routers line in /etc/dhcpcd.conf
.
This wouldn't normally be an issue except the use case I'm trying to solve is when the default gateway has changed from what is configured (e.g. user moves house or gets a new ISP or even just a new router that is configured with a different IP address than the previous one). Obviously if the configuration is wrong in dhcpcd.conf
then there isn't a valid route to the internet.
Is there any command to get/find the actual IP address of the router or do I have to add a new gateway, ping something, if working great but if not then try another gateway?
linux networking
Hi and welcome. Theip route
command gets the route information from the kernel, not from any configuration file. It may be true that the kernel information was previously supplied from configuration, butip route
doesn't know about that. In the end, the default route is what the kernel thinks that it is. In your case, when the machine was moved, what was done to update the default route?
â Andy Dalton
Sep 19 at 17:38
Yes - sorry you are right it's not directly from the config file. Nothing has been done at this point to update the default route. This is what I'm trying to solve so that the user doesn't have to do anything. I thought I had it all worked out and then realised that that the initial values I was working with were the old ones meaning writing them back to the config would be pointless. It sounds like from what you've said that it is going to be a matter of adding a new gateway and testing to see if there is actual connectivity?
â Josh
Sep 19 at 17:49
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I need to get the router IP which I thought I could do via the ip route
command (or many other variations). These all return a value for the default gateway which was fine until I discovered that what these commands return is actually the routers line in /etc/dhcpcd.conf
.
This wouldn't normally be an issue except the use case I'm trying to solve is when the default gateway has changed from what is configured (e.g. user moves house or gets a new ISP or even just a new router that is configured with a different IP address than the previous one). Obviously if the configuration is wrong in dhcpcd.conf
then there isn't a valid route to the internet.
Is there any command to get/find the actual IP address of the router or do I have to add a new gateway, ping something, if working great but if not then try another gateway?
linux networking
I need to get the router IP which I thought I could do via the ip route
command (or many other variations). These all return a value for the default gateway which was fine until I discovered that what these commands return is actually the routers line in /etc/dhcpcd.conf
.
This wouldn't normally be an issue except the use case I'm trying to solve is when the default gateway has changed from what is configured (e.g. user moves house or gets a new ISP or even just a new router that is configured with a different IP address than the previous one). Obviously if the configuration is wrong in dhcpcd.conf
then there isn't a valid route to the internet.
Is there any command to get/find the actual IP address of the router or do I have to add a new gateway, ping something, if working great but if not then try another gateway?
linux networking
linux networking
edited Sep 19 at 17:39
Andy Dalton
4,8691520
4,8691520
asked Sep 19 at 17:33
Josh
51
51
Hi and welcome. Theip route
command gets the route information from the kernel, not from any configuration file. It may be true that the kernel information was previously supplied from configuration, butip route
doesn't know about that. In the end, the default route is what the kernel thinks that it is. In your case, when the machine was moved, what was done to update the default route?
â Andy Dalton
Sep 19 at 17:38
Yes - sorry you are right it's not directly from the config file. Nothing has been done at this point to update the default route. This is what I'm trying to solve so that the user doesn't have to do anything. I thought I had it all worked out and then realised that that the initial values I was working with were the old ones meaning writing them back to the config would be pointless. It sounds like from what you've said that it is going to be a matter of adding a new gateway and testing to see if there is actual connectivity?
â Josh
Sep 19 at 17:49
add a comment |Â
Hi and welcome. Theip route
command gets the route information from the kernel, not from any configuration file. It may be true that the kernel information was previously supplied from configuration, butip route
doesn't know about that. In the end, the default route is what the kernel thinks that it is. In your case, when the machine was moved, what was done to update the default route?
â Andy Dalton
Sep 19 at 17:38
Yes - sorry you are right it's not directly from the config file. Nothing has been done at this point to update the default route. This is what I'm trying to solve so that the user doesn't have to do anything. I thought I had it all worked out and then realised that that the initial values I was working with were the old ones meaning writing them back to the config would be pointless. It sounds like from what you've said that it is going to be a matter of adding a new gateway and testing to see if there is actual connectivity?
â Josh
Sep 19 at 17:49
Hi and welcome. The
ip route
command gets the route information from the kernel, not from any configuration file. It may be true that the kernel information was previously supplied from configuration, but ip route
doesn't know about that. In the end, the default route is what the kernel thinks that it is. In your case, when the machine was moved, what was done to update the default route?â Andy Dalton
Sep 19 at 17:38
Hi and welcome. The
ip route
command gets the route information from the kernel, not from any configuration file. It may be true that the kernel information was previously supplied from configuration, but ip route
doesn't know about that. In the end, the default route is what the kernel thinks that it is. In your case, when the machine was moved, what was done to update the default route?â Andy Dalton
Sep 19 at 17:38
Yes - sorry you are right it's not directly from the config file. Nothing has been done at this point to update the default route. This is what I'm trying to solve so that the user doesn't have to do anything. I thought I had it all worked out and then realised that that the initial values I was working with were the old ones meaning writing them back to the config would be pointless. It sounds like from what you've said that it is going to be a matter of adding a new gateway and testing to see if there is actual connectivity?
â Josh
Sep 19 at 17:49
Yes - sorry you are right it's not directly from the config file. Nothing has been done at this point to update the default route. This is what I'm trying to solve so that the user doesn't have to do anything. I thought I had it all worked out and then realised that that the initial values I was working with were the old ones meaning writing them back to the config would be pointless. It sounds like from what you've said that it is going to be a matter of adding a new gateway and testing to see if there is actual connectivity?
â Josh
Sep 19 at 17:49
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f470076%2ffind-actual-default-gateway-from-command-line%23new-answer', 'question_page');
);
Post as a guest
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
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
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
Hi and welcome. The
ip route
command gets the route information from the kernel, not from any configuration file. It may be true that the kernel information was previously supplied from configuration, butip route
doesn't know about that. In the end, the default route is what the kernel thinks that it is. In your case, when the machine was moved, what was done to update the default route?â Andy Dalton
Sep 19 at 17:38
Yes - sorry you are right it's not directly from the config file. Nothing has been done at this point to update the default route. This is what I'm trying to solve so that the user doesn't have to do anything. I thought I had it all worked out and then realised that that the initial values I was working with were the old ones meaning writing them back to the config would be pointless. It sounds like from what you've said that it is going to be a matter of adding a new gateway and testing to see if there is actual connectivity?
â Josh
Sep 19 at 17:49