practical usage of /etc/networks file

Martin

What is the practical usage of /etc/networks file? As I understand, one can give names to networks in this file. For example:

root@fw-test:~# cat /etc/networks
default         0.0.0.0
loopback        127.0.0.0
link-local      169.254.0.0
google-dns      8.8.4.4
root@fw-test:~# 

However, if I try to use this network name for example in ip utility, it does not work:

root@fw-test:~# ip route add google-dns via 104.236.63.1 dev eth0
Error: an inet prefix is expected rather than "google-dns".
root@fw-test:~# ip route add 8.8.4.4 via 104.236.64.1 dev eth0
root@fw-test:~#

What is the practical usage of /etc/networks file?

chaos

As written in the manual page, the /etc/networks file is to describe symbolic names for networks. With network, it is meant the network address with tailing .0 at the end. Only simple Class A, B or C networks are supported.

In your example the google-dns entry is wrong. It's not a A,B or C network. It's an ip-address-hostname-relationship therefore it belongs to /etc/hosts. Actually the default entry is also not conformant.

Lets imagine you have an ip address 192.168.1.5 from your corporate network. An entry in /etc/network could then be:

corpname 192.168.1.0

When using utilities like route or netstat, those networks are translated (if you don't suppress resolution with the -n flag). A routing table could then look like:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
corpname        *               255.255.255.0   U     0      0        0 eth0

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Practical usage for linked data

From Dev

Practical usage of params indexer

From Dev

Practical usage of Hadoop in project

From Dev

Practical usage of XML?

From Dev

Practical examples of OWIN middleware usage

From Dev

Practical usage of AutoMapper with POST request

From Dev

Practical usage of AutoMapper with POST request

From Dev

Understanding practical usage of __ (double underscore) in python

From Dev

Practical usage of await on the same line as the async call?

From Dev

Other builtin or practical examples of python `with` statement usage?

From Dev

Practical parameter file reading in java

From Dev

Practical use for moving file descriptors

From Dev

Spring Context and Bean Lifecycle callbacks: practical examples of usage

From Dev

What is the practical usage of an array of an unbounded wildcard parameterized type?

From Dev

What are examples of practical usage of x86 processor interrupt flag?

From Dev

Practical difference between .pls and .sql file in oracle

From Dev

Practical protection of a single file against change and deletion

From Dev

Is there a practical way to view ext file system on Windows?

From Dev

Minimizing Realm File Size: Practical approach

From Dev

Cucumber: usage file in scenario

From Dev

Usage of getc with a file

From Dev

File list as per their usage

From Dev

File System Usage Indicator

From Dev

git exclude file usage

From Dev

The usage of Mipfilter in effect file

From Dev

correct usage of .gitignore (for file types)

From Java

Unusual usage of .h file in C

From Dev

Usage of mmap and reloading changes to the file

From Dev

CPU and memory usage of a file javascript

Related Related

HotTag

Archive