What is NFS? Network File System. Network access protocol for file systems. What is Networks and how to fix it? What should be in the networks file

What's it like practical use file /etc/networks? As far as I understand, you can specify network names 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 the ip utility, it doesn't 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 use of the /etc/networks file?

2 Solutions collect form web for “practical use of /etc/networks file”

As stated on the man page, the /etc/networks file must describe symbolic names for networks. With networking, this means a network address with a tail.0 at the end. Only supported simple networks class A, B or C.

In your example, the google-dns entry is incorrect. It's not network A, B or C. It's an ip-address-hostname relationship, so it belongs to /etc/hosts . In fact, the default entry doesn't match either.

Let's say you have an IP address of 192.168.1.5 from your corporate network. The entry in /etc/network could look like this:

Corpname 192.168.1.0

When using utilities such as route or netstat , these networks are translated (unless you suppress permission with the -n flag). The routing table might look like this:

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

The ip command never uses the hostname for input, so your example is unlikely to be relevant. Also you put the hostname in /etc/networks and not the network name!

Entries from /etc/networks are used by tools that attempt to convert numbers to names, such as the (deprecated) route command. Without a suitable entry it shows:

# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.1.254 0.0.0.0 UG 0 0 0 eth0 192.168.0.0 * 255.255.254.0 U 0 0 0 eth0

If we now add the line mylocalnet 192.168.0.0 to /etc/networks:

# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.1.254 0.0.0.0 UG 0 0 0 eth0 mylocalnet * 255.255.254.0 U 0 0 0 eth0

In practice this is never used.

Go!

When it comes to computer networks, you can often hear NFS mentioned. What does this abbreviation mean?

This is a distributed protocol file system, originally developed by Sun Microsystems in 1984, allowing a user on a client computer to access files over a network, similar to accessing local storage. NFS, like many other protocols, is based on the Open Network Computing Remote Procedure Call (ONC RPC) system.

In other words, what is NFS? It is an open standard, defined by Request for Comments (RFC), allowing anyone to implement the protocol.

Versions and variations

The inventor used only the first version for his own experimental purposes. When the development team added significant changes to the original NFS and released it outside of Sun's ownership, they designated new version as v2 so that interoperability between distributions can be tested and a fallback can be created.

NFS v2

Version 2 initially worked only over the User Datagram Protocol (UDP). Its developers wanted to keep the server side without blocking implemented outside the main protocol.

The virtual file system interface allows for a modular implementation reflected in a simple protocol. By February 1986, solutions had been demonstrated for operating systems such as System V release 2, DOS and VAX/VMS using Eunice. NFS v2 only allowed the first 2 GB of a file to be read due to 32-bit limitations.

NFS v3

The first proposal to develop NFS version 3 at Sun Microsystems was announced shortly after the release of the second distribution. The main motivation was to try to mitigate the performance problem of synchronous recording. By July 1992, practical improvements had resolved many of the shortcomings of NFS version 2, leaving only insufficient file support (64-bit file sizes and file offsets).

  • support for 64-bit file sizes and offsets to handle data larger than 2 gigabytes (GB);
  • support for asynchronous recording on the server to improve performance;
  • additional file attributes in many answers to avoid having to re-fetch them;
  • READDIRPLUS operation to obtain data and attributes along with file names when scanning a directory;
  • many other improvements.

During the introduction of version 3, support for TCP as a transport layer protocol began to increase. The use of TCP as a means of transferring data, performed using NFS over a WAN, began to allow large file sizes to be transferred for viewing and writing. Thanks to this, developers were able to overcome the 8 KB limits imposed by the User Datagram Protocol (UDP).

What is NFS v4?

Version 4, influenced by the Endres File System (AFS) and Server Message Block (SMB, also called CIFS), includes performance improvements, provides better security, and introduces a compliance protocol.

Version 4 was the first distribution developed by the Internet Engineering Task Force (IETF) after Sun Microsystems outsourced protocol development.

NFS version 4.1 aims to provide protocol support for leveraging clustered server deployments, including the ability to provide scalable parallel access to files distributed across multiple servers (pNFS extension).

The newest file system protocol, NFS 4.2 (RFC 7862), was officially released in November 2016.

Other extensions

With the development of the standard, corresponding tools for working with it appeared. For example, WebNFS, an extension for versions 2 and 3, allows the Network File System Access Protocol to more easily integrate into web browsers and enable work across firewalls.

Various third party protocols have also become associated with NFS. The most famous of them are:

  • Network Lock Manager (NLM) with byte protocol support (added to support UNIX System V file locking API);
  • Remote Quota (RQUOTAD), which allows NFS users to view storage quotas on NFS servers;
  • NFS over RDMA is an adaptation of NFS that uses remote direct memory access (RDMA) as the transmission medium;
  • NFS-Ganesha is an NFS server running in user space and supporting CephFS FSAL (File System Abstraction Layer) using libcephfs.

Platforms

Network File System is often used with operating systems Unix (such as Solaris, AIX, HP-UX), Apple's MacOS and Unix-like operating systems (such as Linux and FreeBSD).

It is also available for platforms such as Acorn RISC OS, OpenVMS, MS-DOS, Microsoft Windows, Novell NetWare and IBM AS/400.

Alternative protocols remote access files include Server Message Block (SMB, also called CIFS), Apple Transfer Protocol (AFP), NetWare Core Protocol (NCP), and OS/400 Server File System (QFileSvr.400).

This is due to the requirements of NFS, which are aimed mostly at Unix-like “shells”.

At the same time, the SMB and NetWare (NCP) protocols are used more often than NFS in systems running Microsoft Windows. AFP is most common on Apple Macintosh platforms, and QFileSvr.400 is most common on OS/400.

Typical implementation

Assuming a typical Unix-style scenario in which one computer (the client) needs access to data stored on another (the NFS server):

  • The server implements Network File System processes, running by default as nfsd, to make its data publicly available to clients. The server administrator determines how to export directory names and settings, typically using the /etc/exports configuration file and the exportfs command.
  • Administering server security ensures that it can recognize and approve an authenticated client. Its network configuration ensures that eligible clients can negotiate with it through any firewall system.
  • The client machine requests access to the exported data, usually by issuing a command. It queries the server (rpcbind) that is using the NFS port and subsequently connects to it.
  • If everything happens without errors, users on the client machine will be able to view and interact with the installed file systems on the server within the permitted parameters.

It should also be noted that automation of the Network File System process can also take place - perhaps using etc/fstab and/or other similar tools.

Development to date

By the 21st century, competing protocols DFS and AFS had not achieved any major commercial success compared to the Network File System. IBM, which previously acquired all commercial rights to the above technologies, has donated most of the AFS source code to the free developer community software in 2000. The Open AFS project still exists today. In early 2005, IBM announced the end of sales of AFS and DFS.

In turn, in January 2010, Panasas proposed NFS v 4.1 based on technology that improves parallel data access capabilities. The Network File System v 4.1 protocol defines a method for separating file system metadata from the location of specific files. So it goes beyond simple name/data separation.

What is NFS of this version in practice? The above feature distinguishes it from the traditional protocol, which contains the names of files and their data under one connection to the server. With Network File System v 4.1, some files can be shared across multi-node servers, but client involvement in sharing metadata and data is limited.

When implementing the fourth distribution of the protocol, the NFS server is a set of server resources or components; they are assumed to be controlled by the metadata server.

The client still contacts a single metadata server to traverse or interact with the namespace. As it moves files to and from the server, it can directly interact with a set of data owned by an NFS group.

Good afternoon, dear readers. I am publishing the second part. In the current part the main emphasis is on network implementation in Linux(how to set up a network in Linux, how to diagnose a network in Linux and maintain the network subsystem in Linux).

Configuring TCP/IP in Linux to work on an Ethernet network

To work with network protocols TCP/IP in Linux is enough to have only loopback interface, but if it is necessary to connect hosts with each other, naturally, it is necessary to have a network interface, data transmission channels (for example, twisted pair), perhaps some network equipment. Also, it is necessary to have installed ones (, etc.), usually supplied to. It is also necessary to have a network (for example /etc/hosts) and network support.

Network settings

Let's start understanding Linux network mechanisms with manual network configuration, that is, with the case when IP address network interface static. So, when setting up a network, you need to consider and configure the following parameters:

IP address- as already mentioned in the first part of the article - this is the unique address of the machine, in the format of four decimal numbers separated by dots. Usually, when working in local network, selected from private ranges, for example: 192.168.0.1

Subnet mask- same, 4 decimal numbers, which determine which part of the address belongs to the network/subnet address, and which part to the host address. A subnet mask is a number that is added (in binary form) with an IP address to determine which subnet the address belongs to. For example, the address 192.168.0.2 with a mask of 255.255.255.0 belongs to the subnet 192.168.0.

Subnet address- determined by the subnet mask. However, there are no subnets for loopback interfaces.

Broadcast address- the address used to send broadcast packets that will be received by all hosts on the subnet. Typically, it is equal to the subnet address with a host value of 255, that is, for the subnet 192.168.0 the broadcast will be 192.168.0.255, similarly, for the subnet 192.168 the broadcast will be 192.168.255.255. There is no broadcast address for loopback interfaces.

Gateway IP address- this is the address of the machine that is the default gateway for communication with the outside world. There can be several gateways if the computer is connected to several networks at the same time. The gateway address is not used on isolated networks (not connected to global network), because these networks have nowhere to send packets outside the network, the same applies to loopback interfaces.

Name server IP address (DNS server)- address of the server that converts host names into IP addresses. Usually provided by the provider.

Network settings files in Linux (configuration files)

To understand how the network works in Linux, I would definitely recommend reading the article "". In general, the entire operation of Linux is based on, which is born when the OS boots and produces its descendants, which in turn do all the necessary work, be it launching bash or a daemon. Yes, and the entire Linux boot is based on, which spells out the entire sequence of launching small utilities with various parameters that are sequentially started/stopped when the system starts/stops. The Linux network subsystem starts in the same way.

Each Linux distribution has a slightly different network initialization mechanism, but I think the general picture will be clear after reading. If you look at the start scripts of the network subsystem of any Linux distribution, then how to configure the network configuration using configuration files, it will become more or less clear, for example, in Debian (let’s take this distribution as a basis), a script is responsible for initializing the network /etc/init.d/networking, having looked at which:

Net-server:~#cat /etc/init.d/networking #!/bin/sh -e ### BEGIN INIT INFO # Provides: networking # Required-Start: mountkernfs $local_fs # Required-Stop: $local_fs # Should -Start: ifupdown # Should-Stop: ifupdown # Default-Start: S # Default-Stop: 0 6 # Short-Description: Raise network interfaces. ### END INIT INFO PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" [ -x /sbin/ifup ] || exit 0 . /lib/lsb/init-functions process_options() ( [ -e /etc/network/options ] || return 0 log_warning_msg "/etc/network/options still exists and it will be IGNORED! Read README.Debian of netbase." ) check_network_file_systems() ( [ -e /proc/mounts ] || return 0 if [ -e /etc/iscsi/iscsi.initramfs ]; then log_warning_msg "not deconfiguring network interfaces: iSCSI root is mounted." exit 0 fi exec 9<&0 < /proc/mounts while read DEV MTPT FSTYPE REST; do case $DEV in /dev/nbd*|/dev/nd*|/dev/etherd/e*) log_warning_msg "not deconfiguring network interfaces: network devices still mounted." exit 0 ;; esac case $FSTYPE in nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs) log_warning_msg "not deconfiguring network interfaces: network file systems still mounted." exit 0 ;; esac done exec 0<&9 9<&- } check_network_swap() { [ -e /proc/swaps ] || return 0 exec 9<&0 < /proc/swaps while read DEV MTPT FSTYPE REST; do case $DEV in /dev/nbd*|/dev/nd*|/dev/etherd/e*) log_warning_msg "not deconfiguring network interfaces: network swap still mounted." exit 0 ;; esac done exec 0<&9 9<&- } case "$1" in start) process_options log_action_begin_msg "Configuring network interfaces" if ifup -a; then log_action_end_msg $? else log_action_end_msg $? fi ;; stop) check_network_file_systems check_network_swap log_action_begin_msg "Deconfiguring network interfaces" if ifdown -a --exclude=lo; then log_action_end_msg $? else log_action_end_msg $? fi ;; force-reload|restart) process_options log_warning_msg "Running $0 $1 is deprecated because it may not enable again some interfaces" log_action_begin_msg "Reconfiguring network interfaces" ifdown -a --exclude=lo || true if ifup -a --exclude=lo; then log_action_end_msg $? else log_action_end_msg $? fi ;; *) echo "Usage: /etc/init.d/networking {start|stop}" exit 1 ;; esac exit 0

You can find several functions that check for the presence of mounted network file systems ( check_network_file_systems(), check_network_swap()), as well as checking the existence of some still unclear config /etc/network/options ( function process_options()), and at the very bottom, the design case "$1" in and in accordance with the entered parameter (start/stop/force-reload|restart or any other) performs certain actions. Of these same " certain actions", using the start argument as an example, you can see that the function is launched first process_options, then the phrase is sent to the log Configuring network interfaces, and the command is run ifup -a. If you look at man ifup , you can see that this command reads the config from a file /etc/network/interfaces and according to the key -a launches all interfaces that have the parameter auto.

The ifup and ifdown commands may be used to configure (or, respectively, deconfigure) network interfaces based on interface definitions in the file /etc/network/interfaces.

-a, --all
If given to ifup, affect all interfaces marked auto. Interfaces are brought up in the order in which they are defined in /etc/network/interfaces. If given to ifdown, affect all defined interfaces. Interfaces are brought down in the order in which they are currently listed in the state file. Only interfaces defined in /etc/network/interfaces will be brought down.

ip-server:~# cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface allow-hotplug eth0 iface eth0 inet dhcp allow-hotplug eth2 iface eth2 inet static address 192.168.1.1 netmask 255.255.255.0 gateway 192.168.1.254 broadcast 192.168.1.255

In this config the lines allow-hotplug And auto- these are synonyms and interfaces will be raised on command ifup -a. This, in fact, is the entire chain of operation of the network subsystem. Similarly, in other distributions: in RedHat and SUSE the network is launched by a script /etc/init.d/network. Having examined it, you can similarly find where the network configuration lies.

/etc/hosts

This file stores a list IP addresses And hostnames corresponding to them (addresses).The file format is no different from the master file:

Ip-server:~# cat /etc/hosts # ip host.in.domain host 127.0.0.1 localhost 127.0.1.1 ip-server.domain.local ip-server 192.168.1.1 ip-server.domain.local ip-server

Historically, this file was used instead of the DNS service. Currently, the file can also be used instead of the DNS service, but only on the condition that the number of machines in your network is measured in units, and not in tens or hundreds, because in this case, you will have to monitor the correctness of this file on each machine.

/etc/hostname

This file contains NetBIOS hostname:

Ip-server:~# cat /etc/hostname ip-server

This file stores the names and addresses of local and other networks. Example:

Ip-server:~# cat /etc/networks default 0.0.0.0 loopback 127.0.0.0 link-local 169.254.0.0 home-network 192.168.1.0

When using this file, networks can be managed by name. For example, do not add a route route add 192.168.1.12 , A route add.

/etc/nsswitch.conf

File defines hostname lookup order/network, the following lines are responsible for this setting:

For hosts: hosts: files dns For networks: networks: files

Parameter files specifies to use the specified files (/etc/hosts And /etc/networks respectively), parameter dns specifies to use the service dns.

/etc/host.conf

The file specifies name resolution parameters for the resolver

Ip-server:~# cat /etc/host.conf multi on

This file tells the resolv library to return all valid host addresses that appear in the /etc/hosts file, and not just the first one.

/etc/resolv.conf

This file defines the parameters of the mechanism for converting network names to IP addresses. In simple terms, defines DNS settings. Example:

Ip-server:~# cat /etc/resolv.conf nameserver 10.0.0.4 nameserver 10.0.0.1 search domain.local

First 2 lines indicate DNS servers. The third line specifies the search domains. If, when resolving a name, the name is not an FQDN name, then this domain will be substituted as an “end”. For example, when executing the ping host command, the pinged address is converted to host.domain.local. The remaining parameters can be read in man resolv.conf. Very often, Linux uses dynamic generation of this file, using the so-called. programs /sbin/resolvconf. This program is an intermediary between services that dynamically provide name servers (for example DHCP client) and services that use name server data. To use a dynamically generated file /etc/resolv.conf, you need to make this file a symbolic link to /etc/resolvconf/run/resolv.conf. In some distributions the path may be different; this will definitely be written in man resolveconf.

Network configuration

After reviewing the main configuration files, you can look at . The command has already been mentioned above ifup, ifdown, but these tools are not entirely universal; for example, RH distributions do not have these commands by default. In addition, new distributions have introduced a new high-level network management tool - which belongs to the iproute package. I will dedicate it to him (the iproute package). And in the current post I will not consider it. The commands described below belong to .

So, to be sure that the command works on any Linux distribution, you need to use two main old commands. This , and arp. The first team (responsible for setting up network interfaces(ip, mask, gateway), second () - routing setup, third (arp) - arp table management. I would like to note that executing these commands without disabling the standard SystemV startup script of the network subsystem will make changes only until the first reboot/restart of the network service, because if you think about it, you can understand that the script /etc/init.d/networking the next time it starts, it will re-read the above configs and apply the old settings. Accordingly, the way out for permanently setting the settings is either to enter the ifconfig command with the appropriate parameters in , or to manually correct the corresponding configs of the network interfaces.

Also, if the command is executed ifconfig with missing parameters(for example, only an IP address), then the rest are added automatically (for example, a broadcast address is added by default with a host address ending in 255 and the default subnet mask is 255.255.255.0).

Routing for existing interfaces in modern kernels it is always raised automatically by the kernel. Or rather, direct routes to the network according to the IP settings and the subnet into which the raised interface looks are formed automatically, by the kernel. The gateway field for such entries indicates the address of the output interface or *. In older versions of the kernel (I can’t tell you the kernel number from which routes began to rise automatically), it was necessary to add the route manually.

If there is a need to organize your routes, then you need to use . With this command you can add and remove routes, but again, this will only help until you restart /etc/init.d/networking (or another script responsible for the network in your distribution). In order for routes to be added automatically, you must, in the same way as with the ifconfig command, add commands for adding routes to rc.local, or manually correct the corresponding network interface configs (for example, in Deb - /etc/network/options).

By what rules routes to networks are formed, I'm in

Linux network diagnostics

There are a large number of network diagnostic tools in Linux, often very similar to utilities from Microsoft. I will look at 3 main network diagnostic utilities, without which it will be difficult to identify problems.

I think that this utility is familiar to almost everyone. This utility works by sending so-called ICMP packets to the remote server, which will be specified in the command parameters, the server returns the sent commands, and pingcounts the time required for the sent packet to reach the server and return. For example:

# ping ya.ru PING ya.ru (87.250.251.3) 56(84) bytes of data. 64 bytes from www.yandex.ru (87.250.251.3): icmp_seq=1 ttl=57 time=42.7 ms 64 bytes from www.yandex.ru (87.250.251.3): icmp_seq=2 ttl=57 time=43.2 ms 64 bytes from www.yandex.ru (87.250.251.3): icmp_seq=3 ttl=57 time=42.5 ms 64 bytes from www.yandex.ru (87.250.251.3): icmp_seq=4 ttl=57 time=42.5 ms 64 bytes from www .yandex.ru (87.250.251.3): icmp_seq=5 ttl=57 time=41.9 ms ^C --- ya.ru ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4012ms rtt min/ avg/max/mdev = 41.922/42.588/43.255/0.500 ms

As can be seen from the above example, ping gives us a bunch of useful information. First of all, we found out that we can establish a connection with the host ya.ru(sometimes they say that “the ya.ru host is available to us”). Secondly, we see that DNS is working correctly, because the “pinged” name was correctly converted to an IP address (PING ya.ru (87.250.251.3)). Further, in field icmp_seq= numbering of sent packets is indicated. Each sent packet is sequentially assigned a number, and if there are “dips” in this numbering, this will tell us that the connection with the “pinged” is unstable, and may also mean that the server to which the packets are sent is overloaded. By value time= we see, how long did the package travel to 87.250.251.3 and back. You can stop the ping utility by pressing Ctrl+C.

Also, ping utility It is interesting because it can allow you to see exactly where the problems occurred. Let's say ping utility displays a message network not reachable (network not available), or other similar message. This most likely indicates that your system is configured incorrectly. In this case, you can send packets to the provider’s IP address to understand where the problem occurs (between the local PC or “further”). If you are connected to the Internet through a router, you can send packets via its IP. Accordingly, if the problem appears already at this stage, this indicates incorrect configuration of the local system, or damage to the cable; if the router is recalled, but the provider’s server is not, then the problem is in the provider’s communication channel, etc. Finally, if the name to IP conversion fails, then you can check the IP connection; if the responses come correctly, then you can guess that the problem is in the DNS.

It should be noted that this utility is not always a reliable diagnostic tool. The remote server can block responses to ICMP requests.

traceroute

In simple terms, the command is called route tracing. As the name suggests, this utility will show which route the packets took to reach the host. traceroute utility somewhat similar to ping, but displays more interesting information. Example:

# traceroute ya.ru traceroute to ya.ru (213.180.204.3), 30 hops max, 60 byte packets 1 243-083-free.kubtelecom.ru (213.132.83.243) 6.408 ms 6.306 ms 6.193 ms 2 065-064-free .kubtelecom.ru (213.132.64.65) 2.761 ms 5.787 ms 5.777 ms 3 lgw.kubtelecom.ru (213.132.75.54) 5.713 ms 5.701 ms 5.636 ms 4 KubTelecom-lgw.Krasnodar.gldn.net (1 94.186.6.177) 81.430 ms 81.581 ms 81.687 ms 5 cat26.Moscow.gldn.net (194.186.10.118) 47.789 ms 47.888 ms 48.011 ms 6 213.33.201.230 (213.33.201.230) 43.322 ms 41.783 ms 41. 106 ms 7 carmine-red-vlan602.yandex.net (87.250. 242.206) 41.199 ms 42.578 ms 42.610 ms 8 www.yandex.ru (213.180.204.3) 43.185 ms 42.126 ms 42.679 ms

As you can see, you can trace the route from the provider’s router 243-083-free.kubtelecom.ru (213.132.83.243) (South of Russia) to the end host at www.yandex.ru (213.180.204.3) in Moscow.

dig

This utility sends queries to DNS servers and returns information about the specified domain. Example:

# dig @ns.kuban.ru roboti.ru ;<<>> DiG 9.3.6-P1<<>> @ns.kuban.ru roboti.ru ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64412 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0 ;; QUESTION SECTION: ;roboti.ru. IN A ;; ANSWER SECTION: roboti.ru. 448 IN A 72.52.4.90 ;; AUTHORITY SECTION: roboti.ru. 345448 IN NS ns1.sedoparking.com. roboti.ru. 345448 IN NS ns2.sedoparking.com. ;; Query time: 102 msec ;; SERVER: 62.183.1.244#53(62.183.1.244) ;; WHEN: Thu Feb 17 19:44:59 2011 ;; MSG SIZE rcvd: 94

dig command sent a request DNS server - ns.kuban.ru (@ns.kuban.ru- this parameter is not necessary to specify, in this case the source of information about DNS will be the server from your system settings) about the domain name roboti.ru. As a result, I received a response, in which we can see in the section ANSWER SECTION information about domain IP addresses, in the section AUTHORITY SECTION information about the so-called authoritative DNS servers. The third line from the bottom tells us which server provided the response.

Other diagnostic utilities

ping, dig and other diagnostic utilities with parameters can be found in the post.

Connecting a new network card

Connecting and launching a new network card comes down to a few steps:

1. Physical connection of the card

3. View the output of whether the system has detected a new network card:

Let's see the conclusion BEFORE connecting a new card:

Server:~# dmesg | grep eth [ 4.720550] e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection [ 5.130191] e1000: eth1: e1000_probe: Intel(R) PRO/1000 Network Connection [ 15.285527] e1000: eth2: e1000_watchdog: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX [ 15.681056] e1000: eth0: e1000_watchdog: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX

The output shows that the system has 2 network cards eth1 and eth2. We connect the third one and look at the output:

Server:~# dmesg | grep eth [ 4.720513] e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection [ 5.132029] e1000: eth1: e1000_probe: Intel(R) PRO/1000 Network Connection [ 5.534684] e1000: eth2: e1000_probe: Intel(R ) Pro/1000 Network Connection [39.274875] udev: Renamed Network Interface Eth2 to Eth3 [39.287661] UDEV: Renamed Network IntH1_RENAME_REN TO ETH2 [45.670744] ETH2 [45.670744] 1000: ETH2: E1000_WatchDOG: Nic Link Is up 1000 MBPS Full Duplex, Flow Control: RX [ 46.237232] e1000: eth0: e1000_watchdog: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX [ 96.977468] e1000: eth3: e1000_watchdog: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX

IN dmesg we see that a new network has appeared - eth3, which is actually eth2, but renamed by the udev device manager to eth3, and eth2 is actually a renamed eth1 (we will talk about udev in a separate post). The appearance of our new network in dmesg tells us that the network card supported core and correct decided. All that's left is to set up the new interface in /etc/network/interfaces(Debian) because this map was not initialized by the startup script /etc/init.d/network. ifconfig sees this map:

Server:~# ifconfig eth3 eth3 Link encap:Ethernet HWaddr 08:00:27:5f:34:ad inet6 addr: fe80::a00:27ff:fe5f:34ad/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric: 1 RX packets:311847 errors:0 dropped:0 overruns:0 frame:0 TX packets:126 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:104670651 (99.8 MiB) TX bytes: 16184 (15.8 KiB)

but again - it does not configure. How to configure the network card was discussed above.

Summary

I think that's all for today. When I started writing this article, I thought that I would fit into one post, but it turned out to be huge. Therefore, it was decided to split the article into two. In total, I tried to present, not a step-by-step procedure for setting up a network, but to outline the principle and explain the understanding of how the network starts and works in Linux. I really hope that I succeeded. I will be glad to see your comments and additions. Over time, I will add to the article.

Plastic bag ifupdown is a comprehensive tool for configuring network parameters, in particular used to initialize the network when loading the operating system into Debian GNU\Linux(together with the corresponding scripts ifupdown-clean, ifupdown, networking located in the directory /etc/init.d)

Since version 6.0 (squeeze), Debian developers have classified the ifupdown package as obsolete in the documentation and recommend using tools such as NetworkManager or Wicd. This approach is justified for workstations with installed graphical user interface tools. For servers, the use of ifupdown, a stable, feature-rich, well-documented network subsystem management tool, continues to be used.

The ifupdown package contains two commands ifup And ifdown to enable or disable the network connection (in this case the eth1 interface):

# ifdown eth1 # ifup eth1

These commands by default use the settings written in the file /etc/network/interfaces.

To start, restart and stop the network subsystem you should use a script /etc/init.d/networking with parameters start, restart And stop respectively:

# /etc/init.d/networking restart

Network interface settings file /etc/network/interfaces

The /etc/network/interfaces file is in a text format that can be edited by a system administrator using a text editor, while the ifup and ifdown commands can also read it and recognize the settings specified in it.

An example of this file:

Auto lo eth1 eth0 iface lo inet loopback iface eth1 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 192.168.1.1 192.168.1.10 iface eth0 inet dhcp

Keyword auto with space-separated listing of interface names specifies to enable these interfaces at system startup. Keyword iface is a description of the interface (general format: iface). So, in the example:

  • in line iface lo inet loopback local interface lo is configured for interaction of applications within a given computer (loopback)
  • in line iface eth1 inet static interface eth1 is configured on static configuration method(network parameters are specified manually, static). Next, the parameters for static interface configuration are indicated (general format:): IP address ( address), Subnet mask ( netmask), default gateway ( gateway), DNS server addresses ( dns-nameservers) etc. If there are several DNS servers, they are listed separated by a space.
  • in line iface eth0 dhcp indicates the configuration of the eth0 interface by dynamic node configuration protocol.

Protocol DHCP(Dynamic Host Configuration Protocol) allows a computer to automatically obtain an IP address over the network and other parameters necessary for the operation of the network interface. To use the DHCP protocol, it is necessary that this broadcast domain be configured DHCP server. When setting up a network device, the computer contacts the DHCP server and receives the required network parameters.

In addition to static and dynamic interface configuration, there is a manual configuration method ( manual), which assumes that the interface will be configured using tools third-party to ifupdown.

The interfaces file syntax is described in detail on the corresponding help page ( man interfaces).

Adding a Permanent Static Route

Interface options in the interfaces file allow you to specify commands to be executed when the interface is enabled ( up option) and switching off ( down option).

For example, let's set up a permanent network configuration with a static route through an alternative gateway (a fragment of the /etc/network/interfaces file is shown):

Iface eth1 inet static address 192.168.1.100 netmask 255.255.255.0 up ip route add 192.168.24.0/24 via 192.168.1.2 gateway 192.168.1.1

Let's apply this configuration using the ifdown/ifup commands and view the routing table:

# ifdown eth1 # ifup eth1 # ip route show dev eth1 192.168.1.0/24 proto kernel scope link src 192.168.1.100 192.168.24.0/24 via 192.168.1.2 default via 192.168.1.1

Multiple IP addresses on one network interface

The task of adding multiple IP addresses to an interface using the /etc/network/interfaces file is solved as follows:

Auto eth1 eth1:add iface eth1 inet static address 192.168.11.10 netmask 255.255.255.0 gateway 192.168.11.1 iface eth1:add inet static address 192.168.11.11 netmask 255.255.255.0

The alias is specified with a colon after the interface name. It is also necessary to specify automatic launch of the new interface in the auto parameter.

To apply this configuration, you must run the following commands:

# ifdown eth1; ifup eth1; ifup eth1:add

# /etc/init.d/networking restart


Sometimes networks errors and other Windows system errors can be related to problems in the Windows registry. Several programs can use the networks file, but when those programs are uninstalled or modified, sometimes "orphaned" (incorrect) Windows registry entries are left behind.

Basically, this means that while the actual path of the file may have changed, its incorrect former location is still recorded in the Windows Registry. When Windows tries to look up these incorrect file references (file locations on your PC), a networks. Additionally, a malware infection may have corrupted registry entries associated with Microsoft Windows. Thus, these corrupted Windows registry entries need to be fixed to fix the problem at the root.

Manually editing the Windows registry to remove invalid networks keys is not recommended unless you are a PC service professional. Mistakes made when editing the registry can render your PC inoperable and cause irreparable damage to your operating system. In fact, even one comma placed in the wrong place can prevent your computer from booting!

Because of this risk, we highly recommend using a trusted registry cleaner such as WinThruster (Developed by Microsoft Gold Certified Partner) to scan and repair any networks. Using a registry cleaner, you can automate the process of finding corrupted registry entries, missing file references (such as networks causing the error), and broken links within the registry. Before each scan, a backup copy is automatically created, allowing you to undo any changes with one click and protecting you from possible damage to your computer. The best part is that eliminating registry errors can dramatically improve system speed and performance.


Warning: Unless you are an experienced PC user, we DO NOT recommend manually editing the Windows Registry. Using Registry Editor incorrectly may cause serious problems that may require you to reinstall Windows. We do not guarantee that problems resulting from incorrect use of Registry Editor can be corrected. You use Registry Editor at your own risk.

Before manually restoring the Windows registry, you need to create a backup by exporting the networks-related part of the registry (for example, Microsoft Windows):

  1. Click on the button Begin.
  2. Enter " command" V search bar... DON'T CLICK YET ENTER!
  3. While holding down the keys CTRL-Shift on your keyboard, press ENTER.
  4. A dialog box for access will be displayed.
  5. Click Yes.
  6. The black box opens with a blinking cursor.
  7. Enter " regedit" and press ENTER.
  8. In the Registry Editor, select the key associated with the networks (for example, Microsoft Windows) that you want to back up.
  9. On the menu File select Export.
  10. On the list Save to select the folder where you want to save the Microsoft Windows key backup.
  11. In field File name Enter a name for the backup file, such as "Microsoft Windows Backup".
  12. Make sure the field Export range value selected Selected branch.
  13. Click Save.
  14. The file will be saved with extension .reg.
  15. You now have a backup of your networks-related registry entry.

The following steps for manually editing the registry will not be described in this article, as they are likely to damage your system. If you would like more information about editing the registry manually, please check out the links below.