Difference between revisions of "Network Tools in Linux"
(Created page with " == Motivation == We have learned the basics of how a network works. Now lets look at more tools that help you debug and troubleshoot network issues. == x ==") |
(→x) |
||
Line 4: | Line 4: | ||
We have learned the basics of how a network works. Now lets look at more tools that help you debug and troubleshoot network issues. |
We have learned the basics of how a network works. Now lets look at more tools that help you debug and troubleshoot network issues. |
||
− | == |
+ | == DNS Lookup == |
+ | |||
+ | When you go to a website you do not need to remember the IP address. You use a name for that. e.g. you go to www.google.com. In order to find the associated IP address you need to lookup that name. The tools for that are: host nslookup or dig. For simple lookups I prefer '''host''', while the other tools will give you more detailed information of how the lookup worked. |
||
+ | |||
+ | <pre> |
||
+ | host www.google.com |
||
+ | www.google.com has address 172.217.16.196 |
||
+ | www.google.com has IPv6 address 2a00:1450:4001:817::2004 |
||
+ | </pre> |
||
+ | |||
+ | Sometimes you want to define aliases for certain hosts. Especially in your private network at home you will not want to run your own DNS system. A simple file that relates IP addresses to names will be sufficient to make your life easiser. This is the /etc/hosts file where you can add names to your IP addresses. E.g. your hosts file could look like this: |
||
+ | |||
+ | <pre> |
||
+ | $ cat /etc/hosts |
||
+ | 127.0.0.1 localhost |
||
+ | ::1 localhost ip6-localhost ip6-loopback |
||
+ | |||
+ | 192.168.19.27 laptop1 acer |
||
+ | 192.168.19.101 handy lg200 |
||
+ | 192.168.19.1 netgear |
||
+ | |||
+ | </pre> |
Revision as of 08:05, 27 March 2020
Motivation
We have learned the basics of how a network works. Now lets look at more tools that help you debug and troubleshoot network issues.
DNS Lookup
When you go to a website you do not need to remember the IP address. You use a name for that. e.g. you go to www.google.com. In order to find the associated IP address you need to lookup that name. The tools for that are: host nslookup or dig. For simple lookups I prefer host, while the other tools will give you more detailed information of how the lookup worked.
host www.google.com www.google.com has address 172.217.16.196 www.google.com has IPv6 address 2a00:1450:4001:817::2004
Sometimes you want to define aliases for certain hosts. Especially in your private network at home you will not want to run your own DNS system. A simple file that relates IP addresses to names will be sufficient to make your life easiser. This is the /etc/hosts file where you can add names to your IP addresses. E.g. your hosts file could look like this:
$ cat /etc/hosts 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback 192.168.19.27 laptop1 acer 192.168.19.101 handy lg200 192.168.19.1 netgear