traceroute, only print gateway information

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I can't find any info regarding this in the man-pages. How would one go about only printing the gateway using traceroute?







share|improve this question




















  • would you clarify the question? it is not entirely clear what your need is. Maybe an example?
    – Rui F Ribeiro
    Nov 28 '17 at 21:30











  • @RuiFRibeiro Basically I'm looking for a way to use traceroute to only print one line. That line being the one containing the gateway information, nothing else.
    – Lithicas
    Nov 28 '17 at 21:33










  • anything against netstat -nr? I think what you want with traceroute can be done, will check it out and will come back.
    – Rui F Ribeiro
    Nov 28 '17 at 21:35










  • @RuiFRibeiro I appreciate your help. Nothing against netstat -nr. It's only that it's a school assignment that requires me to use traceroute. I've read the man-pages but haven't found a flag that does what I want, apparently it is possible though.
    – Lithicas
    Nov 28 '17 at 21:37







  • 1




    You should read about e.g. grep, sed and awk and how they can be used to cut out lines from traceroute's output.
    – dessert
    Nov 28 '17 at 21:39














up vote
3
down vote

favorite












I can't find any info regarding this in the man-pages. How would one go about only printing the gateway using traceroute?







share|improve this question




















  • would you clarify the question? it is not entirely clear what your need is. Maybe an example?
    – Rui F Ribeiro
    Nov 28 '17 at 21:30











  • @RuiFRibeiro Basically I'm looking for a way to use traceroute to only print one line. That line being the one containing the gateway information, nothing else.
    – Lithicas
    Nov 28 '17 at 21:33










  • anything against netstat -nr? I think what you want with traceroute can be done, will check it out and will come back.
    – Rui F Ribeiro
    Nov 28 '17 at 21:35










  • @RuiFRibeiro I appreciate your help. Nothing against netstat -nr. It's only that it's a school assignment that requires me to use traceroute. I've read the man-pages but haven't found a flag that does what I want, apparently it is possible though.
    – Lithicas
    Nov 28 '17 at 21:37







  • 1




    You should read about e.g. grep, sed and awk and how they can be used to cut out lines from traceroute's output.
    – dessert
    Nov 28 '17 at 21:39












up vote
3
down vote

favorite









up vote
3
down vote

favorite











I can't find any info regarding this in the man-pages. How would one go about only printing the gateway using traceroute?







share|improve this question












I can't find any info regarding this in the man-pages. How would one go about only printing the gateway using traceroute?









share|improve this question











share|improve this question




share|improve this question










asked Nov 28 '17 at 21:28









Lithicas

1183




1183











  • would you clarify the question? it is not entirely clear what your need is. Maybe an example?
    – Rui F Ribeiro
    Nov 28 '17 at 21:30











  • @RuiFRibeiro Basically I'm looking for a way to use traceroute to only print one line. That line being the one containing the gateway information, nothing else.
    – Lithicas
    Nov 28 '17 at 21:33










  • anything against netstat -nr? I think what you want with traceroute can be done, will check it out and will come back.
    – Rui F Ribeiro
    Nov 28 '17 at 21:35










  • @RuiFRibeiro I appreciate your help. Nothing against netstat -nr. It's only that it's a school assignment that requires me to use traceroute. I've read the man-pages but haven't found a flag that does what I want, apparently it is possible though.
    – Lithicas
    Nov 28 '17 at 21:37







  • 1




    You should read about e.g. grep, sed and awk and how they can be used to cut out lines from traceroute's output.
    – dessert
    Nov 28 '17 at 21:39
















  • would you clarify the question? it is not entirely clear what your need is. Maybe an example?
    – Rui F Ribeiro
    Nov 28 '17 at 21:30











  • @RuiFRibeiro Basically I'm looking for a way to use traceroute to only print one line. That line being the one containing the gateway information, nothing else.
    – Lithicas
    Nov 28 '17 at 21:33










  • anything against netstat -nr? I think what you want with traceroute can be done, will check it out and will come back.
    – Rui F Ribeiro
    Nov 28 '17 at 21:35










  • @RuiFRibeiro I appreciate your help. Nothing against netstat -nr. It's only that it's a school assignment that requires me to use traceroute. I've read the man-pages but haven't found a flag that does what I want, apparently it is possible though.
    – Lithicas
    Nov 28 '17 at 21:37







  • 1




    You should read about e.g. grep, sed and awk and how they can be used to cut out lines from traceroute's output.
    – dessert
    Nov 28 '17 at 21:39















would you clarify the question? it is not entirely clear what your need is. Maybe an example?
– Rui F Ribeiro
Nov 28 '17 at 21:30





would you clarify the question? it is not entirely clear what your need is. Maybe an example?
– Rui F Ribeiro
Nov 28 '17 at 21:30













@RuiFRibeiro Basically I'm looking for a way to use traceroute to only print one line. That line being the one containing the gateway information, nothing else.
– Lithicas
Nov 28 '17 at 21:33




@RuiFRibeiro Basically I'm looking for a way to use traceroute to only print one line. That line being the one containing the gateway information, nothing else.
– Lithicas
Nov 28 '17 at 21:33












anything against netstat -nr? I think what you want with traceroute can be done, will check it out and will come back.
– Rui F Ribeiro
Nov 28 '17 at 21:35




anything against netstat -nr? I think what you want with traceroute can be done, will check it out and will come back.
– Rui F Ribeiro
Nov 28 '17 at 21:35












@RuiFRibeiro I appreciate your help. Nothing against netstat -nr. It's only that it's a school assignment that requires me to use traceroute. I've read the man-pages but haven't found a flag that does what I want, apparently it is possible though.
– Lithicas
Nov 28 '17 at 21:37





@RuiFRibeiro I appreciate your help. Nothing against netstat -nr. It's only that it's a school assignment that requires me to use traceroute. I've read the man-pages but haven't found a flag that does what I want, apparently it is possible though.
– Lithicas
Nov 28 '17 at 21:37





1




1




You should read about e.g. grep, sed and awk and how they can be used to cut out lines from traceroute's output.
– dessert
Nov 28 '17 at 21:39




You should read about e.g. grep, sed and awk and how they can be used to cut out lines from traceroute's output.
– dessert
Nov 28 '17 at 21:39










1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










With traceroute you've to enter maximum hop as 1 using m1 option as follows.



traceroute -m1 google.com


According to basic rules of computer network Gateway and host must be connected to same NIC of router. Otherwise Data Link Layer will unable to deliver packets from hosts to Gateway. So it's hop should be 1.



So by setting maximum hop as one and tracing any host will prit Gateway only.






share|improve this answer


















  • 1




    indeed, you beat me to it ; as an additional curiosity, the max limit is 64 hops.
    – Rui F Ribeiro
    Nov 28 '17 at 21:46







  • 1




    Brilliant, thank you for your time! And thank you @RuiFRibeiro for you help too!
    – Lithicas
    Nov 28 '17 at 21:48










  • Really good question.. Liked it
    – Abhik Bose
    Nov 28 '17 at 21:54










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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407596%2ftraceroute-only-print-gateway-information%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










With traceroute you've to enter maximum hop as 1 using m1 option as follows.



traceroute -m1 google.com


According to basic rules of computer network Gateway and host must be connected to same NIC of router. Otherwise Data Link Layer will unable to deliver packets from hosts to Gateway. So it's hop should be 1.



So by setting maximum hop as one and tracing any host will prit Gateway only.






share|improve this answer


















  • 1




    indeed, you beat me to it ; as an additional curiosity, the max limit is 64 hops.
    – Rui F Ribeiro
    Nov 28 '17 at 21:46







  • 1




    Brilliant, thank you for your time! And thank you @RuiFRibeiro for you help too!
    – Lithicas
    Nov 28 '17 at 21:48










  • Really good question.. Liked it
    – Abhik Bose
    Nov 28 '17 at 21:54














up vote
4
down vote



accepted










With traceroute you've to enter maximum hop as 1 using m1 option as follows.



traceroute -m1 google.com


According to basic rules of computer network Gateway and host must be connected to same NIC of router. Otherwise Data Link Layer will unable to deliver packets from hosts to Gateway. So it's hop should be 1.



So by setting maximum hop as one and tracing any host will prit Gateway only.






share|improve this answer


















  • 1




    indeed, you beat me to it ; as an additional curiosity, the max limit is 64 hops.
    – Rui F Ribeiro
    Nov 28 '17 at 21:46







  • 1




    Brilliant, thank you for your time! And thank you @RuiFRibeiro for you help too!
    – Lithicas
    Nov 28 '17 at 21:48










  • Really good question.. Liked it
    – Abhik Bose
    Nov 28 '17 at 21:54












up vote
4
down vote



accepted







up vote
4
down vote



accepted






With traceroute you've to enter maximum hop as 1 using m1 option as follows.



traceroute -m1 google.com


According to basic rules of computer network Gateway and host must be connected to same NIC of router. Otherwise Data Link Layer will unable to deliver packets from hosts to Gateway. So it's hop should be 1.



So by setting maximum hop as one and tracing any host will prit Gateway only.






share|improve this answer














With traceroute you've to enter maximum hop as 1 using m1 option as follows.



traceroute -m1 google.com


According to basic rules of computer network Gateway and host must be connected to same NIC of router. Otherwise Data Link Layer will unable to deliver packets from hosts to Gateway. So it's hop should be 1.



So by setting maximum hop as one and tracing any host will prit Gateway only.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 29 '17 at 7:35

























answered Nov 28 '17 at 21:45









Abhik Bose

1,5341217




1,5341217







  • 1




    indeed, you beat me to it ; as an additional curiosity, the max limit is 64 hops.
    – Rui F Ribeiro
    Nov 28 '17 at 21:46







  • 1




    Brilliant, thank you for your time! And thank you @RuiFRibeiro for you help too!
    – Lithicas
    Nov 28 '17 at 21:48










  • Really good question.. Liked it
    – Abhik Bose
    Nov 28 '17 at 21:54












  • 1




    indeed, you beat me to it ; as an additional curiosity, the max limit is 64 hops.
    – Rui F Ribeiro
    Nov 28 '17 at 21:46







  • 1




    Brilliant, thank you for your time! And thank you @RuiFRibeiro for you help too!
    – Lithicas
    Nov 28 '17 at 21:48










  • Really good question.. Liked it
    – Abhik Bose
    Nov 28 '17 at 21:54







1




1




indeed, you beat me to it ; as an additional curiosity, the max limit is 64 hops.
– Rui F Ribeiro
Nov 28 '17 at 21:46





indeed, you beat me to it ; as an additional curiosity, the max limit is 64 hops.
– Rui F Ribeiro
Nov 28 '17 at 21:46





1




1




Brilliant, thank you for your time! And thank you @RuiFRibeiro for you help too!
– Lithicas
Nov 28 '17 at 21:48




Brilliant, thank you for your time! And thank you @RuiFRibeiro for you help too!
– Lithicas
Nov 28 '17 at 21:48












Really good question.. Liked it
– Abhik Bose
Nov 28 '17 at 21:54




Really good question.. Liked it
– Abhik Bose
Nov 28 '17 at 21:54

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407596%2ftraceroute-only-print-gateway-information%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay