netstat -rn meaning in linux?

Discussion in 'Linux+' started by oslon, Dec 4, 2023.

  1. oslon

    oslon Bit Poster

    10
    0
    2
    I read the UNIX and LINUX system admin handbook about this topic but I'm not yet clear about it.
    I'm wondering what's the real answer to this? And what information is it really telling?
     
  2. JK2447
    Highly Decorated Member Award 500 Likes Award

    JK2447 Petabyte Poster Administrator Premium Member

    7,273
    985
    318
    Have a look at the ss command too if you're looking at netstat
     
    Certifications: VCP4, 5, 6, 6.5, 6.7, 7, 8, VCAP DCV Design, VMConAWS Skill, Google Cloud Digital Leader, BSc (Hons), HND IT, HND Computing, ITIL-F, MBCS CITP, MCP (270,290,291,293,294,298,299,410,411,412) MCTS (401,620,624,652) MCSA:Security, MCSE: Security, Security+, CPTS, CCA (XenApp6.5), MCSA 2012, VSP, VTSP
    WIP: ServiceNow Certified System Administrator Certification
  3. FlashDangerpants

    FlashDangerpants Byte Poster

    187
    57
    64
    -r displays the route table, so is equivalent to route print on Windows or sh ip route on Cisco.

    -n sets numbers instead of names. You can see some here. With "default" and "_gateway" being replaced with the numeric values in the second output.

    upload_2023-12-7_18-4-1.png

    Add a new route and it will show up under netstat -r

    upload_2023-12-7_18-9-36.png

    Now put your made up router into /etc/hosts ...
    upload_2023-12-7_18-11-49.png

    Do a netstat with an -r but no -n and you get names in the output

    upload_2023-12-7_18-12-41.png
     
    Certifications: MCITP Exchange 2010, MCSA Svr 2012
    WIP: Exchange 2013

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.