Linux Network Administrator Manual (5) Chapter 5 Configure TCPIP Network PROC File System Setup Host Name Assign IP Address IP I

zhaozj2021-02-11  249

Linux Network Administrator Manual (5)

2000-07-28 17:01

Publisher: NetBull Readings: 2706 Translation: Zhao Wei GoHigh@shtdu.edu.cn Chapter 5 Configure TCP / IP Network In this chapter, we will discuss all the steps to undergo TCP / IP networks on the machine. We will start the assignment of the IP address, step by step to describe the configuration process of the TCP / IP network interface, and introduce several tools that are very useful when resolving the network installation issue. Most of the work described in this chapter usually only needs to do it. Then, when you want to add new systems to the network, or when you completely reconfigure your system, you will contact Many profiles. However, some commands for configuring TCP / IP must be executed every time the system is booted. This is usually done by calling them in the system / etc / rc script. Typically, the network proprietary part of this process includes a script called RC.NET or RC.INET. Sometimes, you will also see two script files named rc.inet1 and rc.inet2, the former one for initializing the core part of the network, while the latter launches basic network services and applications. In this chapter, I will pay attention to the concept of the latter. Below, I will discuss the results of the role of RC.inet1, and the application will be discussed in the following sections. After reading this chapter, you will build a command order of TCP / IP on your computer. Then, you should replace any example commands in the computer on the computer, confident that rc.inet1 is executed when the system boots and reboots your machine. As you wish, the Linux version of Linux is a good example of a good example of the network RC script. 5.1 Installing the Proc File System Some Net-2 Configuration Tools To rely on the Proc file system to communicate with the kernel. This is an interface that uses a mechanism like file system to allow access to kernel runtime information. When loading, you can list files like any other file system, or display them. Typical items include loadavg files containing a system average load, or display the current core memory and MEMINFO for exchange usage. For this, the network code adds a NET directory. It contains many files, which displays the Icon core ARP table, TCP connection status, and routing [Select] table. Many network management tools take their information from these files. The Proc file system (or also known as procfs) is usually loaded on the / proc directory when the system is booted. The best way is to add the following lines to / etc / fstab: # Procfs Mont Point: None / Proc Proc DEFAULTS and executes "mount / proc" from your / etc / rc script. By default, now ProCFS is configured in most kernels. If PROCFS is not in your kernel, you will get a message like this: "Mount: FS Type Procfs Not Supported by Kernel" ("Load: Nuclein does not support file system type Procfs"). You must recompile the kernel and answer "Yes" when you ask Procfs. 5.2 Installing the Executive File If you are using a package (unpacking) Linux release version, it will likely include the primary web application and a utility and an attached example file. The only situation you might must get and install new tools is when you have a new kernel version. Because they sometimes contain changes in the network layer of the kernel, you will need to update the basic configuration tool. This at least includes recompilation, but sometimes you may need to get the latest execution file group. These usually distribute together with the kernel, packaged in the form of a document and clearly named Net-xxx.tar.gz, where xxx is the version number. The 0.32b matched 0.32b in this book, the latest core (1.1.12 and later) when writing is 0.32D.

If you want yourself to compile and install a standard TCP / IP web application, you can get the original program from many Linux FTP servers. These are programs that are more or less from NET-BSD or other original procedures. Other applications, such as XMOSAIC, Xarchie, or Gopher, and IRC clients must be obtained separately. Most of these programs If compiled according to the instructions, the same as the box version. The official NET-3 FTP site is SunAcm.Swan.ac.uk, the mirror site in System / Network / SunaCM under Sunsite.unc.edu. The latest NET-2E patch and execution program are ftp.aris.com. Matthias Urlichs originated from the BSD network code in ftp.ira.uka.de.in / pub / system / linux /. 5.3 Another example of the remainder of this book, let me introduce a new example, this example is simpler than the example of the University of Groucho Marx and may be more close to the problem you are actually encountered. Consider Virtual Brewery, a small brewed - as the name pointed out - a virtual beer company. In order to manage their business more effectively, virtual winemakers want to connect their computer, which is just the PC running Bright and Shiny 1.0 (bright and shining 1.0). On the same floor, I just walked through the hall, there is a job with a similar grape winery. They have airs' Ethernet. Naturally, the two companies want to connect their networks when their networks start working properly. As a first step, they want to set a gateway host for forwarding the data between the two subnets. Next, they also want to have a UUCP link to the outside world. Through this connection, they can exchange emails and news. Finally, they also want to install a SLIP connection so that sometimes connect to the Internet. 5.4 Setting the host name (hostname) Most of the case - If not all, the web application depends on the reasonably set local hostname. This is usually done by the boot process by executing the hostname command. If you want to set the host name to Name, its call such as # HostName Name is also a common thing to use an arbitrary host name that is not related to any domain name. For example, the host of a virtual winery may be called Vale.vbrew.com, Vlager.vbrew.com, etc. These are their formal, all domain names. The local host name will be the first part of this name, such as Vale. However, since the local host name is often used to find the IP address of the host, you must be aware that the resolution library can find the IP address of the host. This usually means you have to write this name into / etc / hosts (see below). Some people recommend using the DomainName command to set the remainder of the domain named FQDN in the core. In this case, you can combine the output of HostName and DomainName to get FQDN again. However, this is halfway to half. DomainName is generally used to set up the host's NIS domain, which may be completely different from the DNS domain belonging to your host. NIS will be discussed in Chapter 10. 5.5 Assign IP Address If you configure the networking software on your host (for example, in order to run Inn Network News Software), you can safely skip this section because you only need to assign a loopback interface. Interface, it is always 127.0.0.0.1. For real networks like Ethernet, things have some complicated. If you want to connect your host to an outgoing network, you must ask the administrator of the network to give you an IP address of this network.

When the entire network is set by yourself, you must describe your IP address as follows. Hosts within a local network should usually have the same logical IP network address. Therefore, you must assign an IP network address. If you have a few physical networks, you or you must assign them different network numbers (network addresses), or use subnet technology to divide your IP address range into several subnets. If your network is not connected to the Internet, you can freely select any (legitimate) network address. You only have to be sure to choose one of the Class C, Class B, or Class C, otherwise things may work properly. However, if you plan to connect the Internet in the near future, you have to get a formal (official) IP address. The best way to do is to ask your network service provider to help you. If you want to get a network address is just because you may connect to the Internet, you have a network address application form from HostMaster@internic.net. In order to operate several Ethernet (or other networks, once the driver is available), you must separate your network into a subnet. Note that only when you have multiple broadcast networks (Broadcast NetWork), you need to apply subnet technology; your point-to-point connection is not counted. For example, if you have an Ethernet, and there is one or more SLIP links to the outside world, you don't need to split your network. Its reasons will be given in Chapter 7. As an example, the network administrator of the winery applies to NIC a Class B network number to get 191.72.0.0. In order to adapt to two Ethernet, she decided to use the 8 bits of the host part as an additional subnet ratio. 8 bits remaining in the mainframe, allowing each subnet to have 254 hosts. Then, she gave the subnet No. 1 to the winery, the subnet number 2 gave the winery. Such their network address is 191.72.1.0 and 191.72.2.0, respectively. The subnet mask is 255.255.255.0. Gateway VLAGER between two networks, allocated to its host number 1, which gives it IP address 191.72.1.1 and 191.72.2.1. Figure 5.1 shows these two subnets and gateways. Note that in this example, I use a Class B network to make things simplistic; and a Class C network will be more realistic. With new network code, the segmentation of the subnet is not limited to byte boundary, so even a C-class network can also be divided into several subnets. For example, you can use the 2-bit host part as a network mask, you can get four possible subnets, each subnet can have 64 hosts. [1] 5.6 Writing Hosts and Networks files After dividing your network into subnet, you should use the / etc / hosts file to prepare some simple hostname parsing. If you don't plan to use DNS or NIS as an address resolution, you must write all hostnames to your HOSTS file. Figure 5.1 Virtual Winery and Virtual Winery - Two Subnets. Even if you want to run DNS or NIS during normal operation, you will still write some hostnames into the / etc / hosts file. One reason is that even if there is no network interface being running, you still want to have some name resolution, for example, during system boot. This is not only for convenience, but also allows you to use the symbol host name in the RC.inet script. This way, when you change the IP address, you only need to copy the updated HOSTS file to all machines and restart the machine. There is no need to edit a large number of RC files separately. Typically, you should put all local hostnames and addresses to Hosts, join the names and addresses of any gateways and NIS servers. [2] Similarly, in the initial test phase, you should be sure that your parser uses only information in the HOSTS file.

Your DNS or NIS software may include a sample file that may generate strange results when using these files. In order to let all the applications use the / etc / hosts file when looking up an IP address of a host, you must edit the /etc/host.conf file. Use well character to release all rows starting with keyword Order and insert a line of the Order Hosts parser library will be discussed in detail in Chapter 6. Each line in the Hosts file contains one, each of which consists of one IP address, a host name, and an optional list of the optional host. The individual domains are separated by spaces or tabs, and the address domain must start from the first column. Any line starting with the well character is considered a note, it is ignored. The host name can be wholly-owned or related to the local domain. For Vale, you can usually enter a full-scale Vale.vbrew.com, and the Vale name itself, so that the host has two names and short local names. This is an example of the Hosts file style of the virtual winery. These include two special names, VLAGER-IF1, and VLAGER-IF2, which gives the address of the two interfaces used by the VLAGER. # # Hosts file for Virtual Brewery / Virtual Winery # # IP local fully qualified domain name # 127.0.0.1 localhost # 191.72.1.1 vlager vlager.vbrew.com 191.72.1.1 vlager-if1 191.72.1.2 vstout vstout.vbrew.com 191.72. 1.3 vale vale.vbrew.com # 191.72.2.1 vlager-if2 191.72.2.2 vbeaujolais vbeaujolais.vbrew.com 191.72.2.3 vbardolino vbardolino.vbrew.com 191.72.2.4 vchianti vchianti.vbrew.com treated as the same as the IP address of the host, sometimes You may also want to use a symbol name for the network number. Therefore, the HOSTS file has a file called / etc / networks, which is used to map the network name to the network number and vice versa. In a virtual winery, we can install a NetWorks file below: [3] # / etc / networks for the Virtual Brewry Brew-Net 191.72.1.0 Wine-Net 191.72.2.0 5.7 IP interface configuration is in the previous chapter After setting up your hardware, you must let the kernel's network software knows these devices. There are several commands to configure network interfaces and initialization routing tables. These tasks are usually done by the rc.inet1 script when the system starts boot each time the system is started. Basic tools for these tasks are called ifconfig (here "if" means interface, and Route. Ifconfig is used to enable an interface to be accessed by the network layer of the kernel. This includes allocation of IP addresses and assignments of other parameters, activating interfaces - also known as "TAKING UP"). Here, activation means that the kernel will send and receive IP datagrams through the interface. The easiest way to call it is ifconfig interface ip-address it assigns IP address IP-address to interface Interface and activate it. All other parameters are set to default. For example, the default subnet mask is obtained from the network type of IP address, such as 255.255.0.0 is a mask of class B address. IfConfig will give a detailed discussion at the end of this chapter. Route allows you to increase or delete routing of routing tables for kernels. It can call Route [add | del] Target here that add and Dell are routes that decide to increase or delete to destination (TARGET) networks or hosts.

5.7.1 Loopback interface The first-activated interface is a loopback interface: # ifconfig LO 127.0.0.1 Sometimes, you will also see the usage of the ip address using the false master name localhost. IfConfig will find this name in the hosts file, there should be a statement of 127.0.0.1 in the hosts file: # Sample / etc / hosts entry for localhost localhost 127.0.0.1 To view an interface configuration, you want to use Interface name as calling the ifconfig: $ ifconfig lo lo Link encap Local Loopback inet addr 127.0.0.1 Bcast [NONE SET] Mask 255.0.0.0 UP BROADCAST LOOPBACK RUNNING MTU 2000 Metric 1 RX packets 0 errors 0 dropped 0 overrun 0 TX packets 0 errors 0 Dropped 0 Overrun 0 As you can see, the Lookback interface is given 255.0.0.0 mask because 127.0.0.1 is a Class A address. This address does not have a broadcast address set, but this is not used in loopback. However, if you run the RWHOD background service program on the host, you must set the broadcast address of the LoopBack device so that RWHO can run correctly. How to set the broadcast address will be described in the "About IFCONFIG" section below. Now, you can almost start running your rice - "Network". The last default is one of the routing selection table, which will tell IP, which can use this interface as the route of 127.0.0.1 to the purpose. This is done by typing the following command. # Route Add 127.0.0.1 again, you can use localhost to replace this IP address. Next, you have to check if each matter is working properly, for example by using ping. PING is a network equivalent of a sonar device [4] for verifying if a given address is really achievable, and the measurement is sent to a given address and then returning to the host. The time required is often referred to as a return time. # Ping localhost ping localhost (127.0.0.1): 56 Data bytes 64 bytes from 127.0.0.1: ICMP SEQ = 0 TTL = 32 TIME = 1 MS 64 bytes from 127.0.0.1: ICMP SEQ = 1 TTL = 32 TIME = 0 ms 64 bytes from 127.0.0.1: ICMP SEQ = 2 TTL = 32 TIME = 0 ms ^ c --- Localhost Ping Statistics --- 3 Packets Transmitted, 3 Packets Received, 0% Packet Loss Round-Trip Min / Avg / Max = 0/0/1 MS When Ping is called, it will continue to send a packet unless it is interrupted by the user. The above ^ c marked our place in Ctrl-C. The above example shows 127.0.0.1 packets to send out and a response is almost instantaneously returned to ping. This means that you have successfully set the first network interface. If you get the output information you get from ping, you will encounter your problem. View the error message to see if it pointed out that some files are not properly installed.

View if the IFCONFIG and ROUTE executive files you use are compatible with the kernel version you run, and the most important thing is to check the compiled kernel is a network enable (activation) (you can exist / proc / net directory) see). If you get an error message, "The network is not arrogant," Then you are likely to use the wrong route command. Please confident that you use the same address as IFCONFIG. The steps described above are sufficient to use a web application on a single machine. Add the above line to Rc.inet1 and confident that these two RC.inet scripts have been executed in / etc / rc, you can reboot your machine and test a variety of applications. For example, "Telnet Localhost" will create a Telnet connection to your host, give you a login prompt screen. However, the LoopBack interface is useful, not only in the network book as an example, or as a test table during development, but also used for some applications when normal operations are actually operated. [5] So, whether your machine is connected to a network, you always have to configure it. 5.7.2 Ethernet interface Configure an Ethernet interface and configure the loopback interface. It is just a slightly parameter that needs to be used when you use subnet technology. In a virtual winery, we have split IP networks into Class C subnets, which is originally a Class B network. To make the interface to identify this change, the parameters of ifconfig should look like this: # ifconfig eth0 VStout Netmask 255.255.255.0 It assigns the VStout (191.72.1.2) IP address to the Eth0 interface. If we have omitted the network mask, IFConfig will inference the mask of the IP address class, which will already have a network mask such as 255.255.0.0. Now, a quick view display: # ifconfig eth0 Eth0 Link ENCAP 10MPS Ethernet Hwaddr 00:00: C0: 90: B3: 42 inet addr 191.72.1.2 bcast 191.72.1.255 mask 255.255.255.0 Up Broadcast Running MTU 1500 Metric 1 RX Packets 0 ERRORS 0 DROPPED 0 OVERRUN 0 TX Packets 0 Errors 0 Dropped 0 Overrun 0 You can see that ifconfig automatically sets the broadcast address (the BCAST field above) into a common value, the host part of the host part of the host part of the host part of the host part of the host part of the host part of the host part of the host part of the host The position is 1. Similarly, the Message Transfer Unit (the size of the maximum Ethernet frame generated by the interface) has been set to a maximum of 1500 bytes. All of these values ​​can be overwritten with a specific option, which will be discussed below. That's very similar to Loopback, you must now install a routing option, which will notify the core for the network that can reach through Eth0. For virtual brewing mills, you should call Route # route add -net 191.72.1.0 as follows, which looks a bit like a magic, because it is not clear how Route detects which interface to be routed. However, the trick is very simple: the kernel detects all the configured interfaces and compares the destination address (192.72.1.0) with the network portion of the interface address (also interspersed with the network mask). Only the ETH0 interface matches it.

Now, what is the -net option? Using this option is because Route can handle routing to the network, you can handle routing to stand-alone (as you have seen about Localhost). When the given address is indicated by a point-in group representation, Route is trying to speculate that it is a network number or a host address by viewing the host part ratio. If the host part of the address is zero, Route assumes that it represents a network, otherwise ROUTE is used as a host address. Therefore, Route will think that 192.72.1.0 is a host address instead of a network number because it does not know that we use subnet technology. Therefore, we must give the -net logo, clearly to the Route it represents a network. Of course, the above ROUTE command is typed very long and it is easy to enable. A easier way is to use the network name we have defined in / dev / networks. This makes this command very easy to read; and the -NET flag can be omitted, because Route now knows 191.72.1.0 to represent a network. # Route Add Brew-Net Now We have completed basic configuration steps, we have to make sure that the Ethernet interface does function properly. Optional host from your Ethernet network, such as Vlager, and type # ping Vlager ping Vlager: 64 byte packets 64 bytes from 191.72.1.1: ICMP SEQ = 0. Time = 11. MS 64 bytes from 191.72.1.1: ICMP SEQ = 1. Time = 7. MS 64 bytes from 191.72.1.1: ICMP SEQ = 2. Time = 12. MS 64 bytes from 191.72.1.1: ICMP SEQ = 3. Time = 3. MS ^ C -------- vStout.vbrew.com ping statistics ---- 4 packets transmitted, 4 packets received, 0% packet loss round-trip (ms) min / avg / max = 3/8/12 If you can't see anything like this So, it is clear that there is a problem. If you encounter an abnormal package loss rate, this means a hardware problem, such as bad or lost terminal head, and so on. If you have confiscated any packets at a point, you should use NetStat to check the interface configuration. Ifconfig's packet statistics will tell you whether the interface has sent any packets. If you can also visit the remote host, you should also check the statistics of its interface. With this method, you can correctly determine where this packet is lost. In addition, you should use Route to display the selection (routing) information to see if the routing items of the two hosts are correct. When you call Route without using any parameter, you will print out the entire kernel selection path (-n option just make it print out the address with the point 4 group indication, not the host name): # route -n kernel routing table Destination Gateway Genmask Flags Metric Ref Use 127.0.0.1 * 255.255.255.255 UH 1 0 191.72.1.0 * 255.255.255.0 U 1 0 Detailed meaning of these domains will be given in the "NetStat check" section below. The Flag column contains a list of each interface flag. U Always set for the active interface, H refers to the destination address represents a host. If the H flag is set for a router as a network router, you must specify the -net option for the route command.

In order to test if the router you join is used, check the USE domain in the second column increase during PING dialogue. 5.7.3 Running through the gateway In the previous section, I only describe the case where a host is set up on a single Ethernet. However, frequently, a person will encounter the network to connect to another network through the gateway. These gateways may simply connect two or more Ethernet networks, but may also provide an Internet connection to the external world. In order to use a gateway service, you must provide additional selection information on the network layer. For example, the Ethernet network of virtual winery and virtual winery is through such a gateway, that is, the host VLAGER, which is connected together. Suppose the VLAGER has already been configured, we only need to add another item in the VSTOUT selection, which tells the kernel, which can reach the VLAGER to all hosts on the winery network. The appropriate Route "spell" shows the following; the keyword GW tells ROUTE the next parameter represents a gateway. # Route Add Wine-Net GW VLAGER Of course, any host on the winery network you want conversations must have a corresponding circuit of a winery network, otherwise, you will only send data from VStout to VBardolino, but Any response to the latter will be lost (Go Into the Great Bit BugT). This example only describes a gateway that switches the packet between two isolated Ethernet. Now, it is assumed that the VLAGER also has a connection to the Internet (eg, through an additional SLIP connection). Then we hope to reach the datagram to the brewery, the Datashers reaching any other network will be handled by the VLAGER. This can be done by making the VLAGER into a vStout default router. # Route Add Default GW VLAGER Network Name Default is an abbreviation of 0.0.0.0, which represents the default router. You don't have to add this name to / etc / networks because it is built in ROUTE. When you look at a high package loss rate when you ping a host, it may mean that the network is very crowded. Package loss is not primarily reason, such as due to the temporary overload operation of the forwarding host, makes them delayed even lost the input data report. 5.7.4 Configuring a gateway Configure a machine to exchange the packet between the two Ethernets is very straightforward. Suppose we go back to VLAGER, it is equipped with two Ethernet cards, and each network card is connected to a network. All you have to do is configure these two interfaces, give their respective IP addresses, and these! It is very useful to add the information of the two interfaces to the HOSTS file as follows. We also have a name: 191.72.1.1 Vlager Vlager.vbrew.com 191.72.1.1 Vlager-if1 191.72.2.1 Vlager-if2 settings these two The command sequence of the interface is also: # ifconfig eth0 VLAGER-IF1 # ifconfig eth1 VLAGER-IF2 # Route Add Brew-Net # Route Add Wine-Net 5.7.5 PLIP Interface When using a PLIP link to connect two machines, things Some of the slightly different from the use of Ethernet. The former is the so-called point-to-point link because they only include two hosts ("points") relative to the communication network. As an example, we consider a laptop (laptop) of a employee of a virtual winery, which is connected to the VLAGER. The laptop itself is called VLITE and has only one parallel port. This port will be registered as PLIP1 during boot.

In order to activate this connection, you must use the following command to configure this PLIP1 interface: [6] # i ifig plip1 VLITE POINTOPOINT VLAGER # ROUTE Add Default GW VLAGER The first command configures this interface, tell the kernel This is a point-to-point link, while the far end The address is VLAGER. The second command installs the default router, and the VLAGER is used as a gateway. On the VLAGER, you need to activate the connection with a similar ifconfig command (the router is enabled): # ifconfig PLIP1 VLAGER POINTOPOINT VLITE This interesting point is that the PLIP1 interface on the VLAGER does not need to have a separate IP address, and the same It is address 192.72.1.1. [7] Now, we have configured routing from laptops to winery networks; it is still a way to route any host to VLITE. A particularly stupid method is to add a special to VLITE routing item in the selected routing table of each host of the gateway. # Route Add Vlite GW VLAGER A better choice in the face of temporary routing is to use dynamic routes. One way to do this is to use Gated, a routing background service, which requires you to install on each host on the network to dynamically publish selection information. However, the easiest way is to use the ARP ARP (Address Resolution Protocol), using the agent ARP, and the VLAGER will respond to any ARP request to the VLite by issuing its own Ethernet address. This role is to send all VLITE packets to the VLAger, then the VLAGER forwards the packet to the laptop. We will discuss the agent ARP in "Checking the ARP Table" section. The NET-3 released later will contain a tool called PLIPCONFIG, which allows you to set the IRQ of the printer port used. In the future, this will be replaced by a more common ifconfig command. 5.7.6 SLIP and PPP Interface Although SLIP and PPP links are just simple to connect like PLIP, there are many discussions to them. Typically, a SLIP connection includes dialing to a remote site via Modem and sets the serial line into SLIP mode. PPP uses the same way. The tools required to set up SLIP or PPP will be described in Chapter VII and Chapter VII. 5.7.7 DUMMY DUMMY The dumb interface is really special, but it is very useful. Its main benefit is that for independent hosts and only IP network connections are machines that are talented by dialing. In fact, the latter is also an independent host most of the time. To make the independent host into the Valley is that they only have a network device being activated, the loopback interface, which is usually assigned address 127.0.0.1. However, in some cases, you need to send data to "formally" local host IP address. For example, consider laptop VLITE, assume that it does not connect to any network. An application on VLITE may now need to send some data to another application of the same host. View VLITE in / etc / hosts, find its IP address is 191.72.1.65, so this application tries to send data to this address. Since the return interface is the only interface currently uniquely active on the machine, the kernel does not know that the address is actually its own! As a result, the kernel will discard this datagram and return an error message to the application. Here is where dumb equipment needs to work. It solves this problem by simply simply as a close friend of the return interface. For VLITE, you only have to simply give its address 191.72.1.65 and join a host route to it.

At this point, each datastum to 191.72.1.65 will be delivered locally. The correct call is: # ifconfig Dummy Vlite # Route Add Vlite 5.8 About ifconfig ifconfig has more parameters we have discussed above. It usually calls: ifconfig interface [[-net | -host] address [parameters]] interface is an interface name, and address is an IP address assigned to the interface. It can be an IP address represented by a point division; or an ifconfig can be checked in / etc / hosts and / etc / networks. -net and -host options respectively forced IFConfig to treat the address as a network number or host address. If the ifconfig is called only one interface name, it shows the configuration of the interface. When you do not call any parameters, it displays the configuration of all interfaces you currently set; -A option forces ifconfig also displays inactive interfaces. A call sample for Ethernet interface Eth0 may look like this: # ifconfig eth0 eth0 link Encap 10Mbps Ethernet Hwaddr 00:00: C0: 90: B3: 42 inet addr 191.72.1.2 Bcast 191.72.1.255 mask 255.255.255.0 Up Broadcast Running MTU 1500 Metric 0 RX Packets 3136 ERRORS 217 DROPPED 7 OVERRUN 26 TX Packets 1752 ERRORS 25 DROPPED 0 OVERRUN 0 MTU and metrics show current MTUs and metrics of the interface. Traditionally, the metric is used for the cost of calculating routing in certain operating systems. Linux has not yet used this value, but it defines it for compatibility. RX and TX lines show how many packages have been received and sent, how many errors have occurred, how many packages are lost (usually because of insufficient memory), how many packages are lost due to overrun . The receiver overrun occurrence is usually due to the rate of arrival of the package, the response to the last interrupt. The flag value printed by ifconfig is more or less corresponds to the name of its command line option; they will explain it below. Below is a list of parameters that IFConfig can identify, and the corresponding flag name is given in parentheses. Simply open a feature is also possible to close this feature before adding a short (-) in front of this option. UP This marks an interface as "UP", which can also access the IP layer. This option is implied when an address is given on the command line. It can also be used to re-enable interfaces that are temporarily shut down by the DOWN option. (This option corresponds to the flag UP Running.) Down This marks an interface as "down", which is not accessible to the IP layer. This effectively prohibits any communication through this interface. Note that this does not delete all the routes that automatically use the interface. If you want to stop this interface forever, you should delete these routes and provide possible other channels. Netmask Mask This assigned a subnet mask for that interface. It can be given in front of a percentage of a percentage of hexadecimal 32 bits, or given a number of four sets of decimal numbers. Pointopoint This option is only used to include a point-to-point IP link to both hosts. For example, this option needs to be used for the configuration of the SLIP or PLIP interface. (If a point-to-point address is set, ifconfig displays the PointOPoint flag.) The Broadcast addRess broadcast address is usually generated by bits all bit bit position bits of the host part of the network number. Some IP implementations use a different solution; this option is used to adapt to those special environments. (If a broadcast address is set, ifconfig displays an Broadcast flag.

This option can be used to assign a measure value for the code entry established for an interface. This metric is used for Route Information Protocol RIP to establish selection routes for the network. [8] The default metric used by ifconfig is zero. If you don't run a RIP background program, you don't need this option at all; if you use it, you rarely need to change the value of the measure. MTU Bytes This sets the maximum transport unit (Maximum Transmission Unit), which is the number of maximum 8-bit groups that interfaces can be processed in one transmission. For Ethernet, the default value of the MTU is 1500; for the SLIP interface, it is 296. ARP This option is especially used in broadcasting networks such as Ethernet or radio. It launches the use of ARP, address resolution protocols to detect the physical address of the host connected to the network. For the broadcast network, it is always default. -arp disables the use of ARP on this interface. Promisc places the interface as a mixed mode. In a broadcast network, this allows the interface to receive all the packages regardless of whether they are packets to other hosts. This makes it possible to analyze network traffic flow, also known as Ethernet listening. Usually, this is a good technique that detects a network problem that is difficult to overcome with other methods. On the other hand, this also makes the attacker get a password from your network traffic and do other dirty things. A protection measures for such attacks do not let anyone can insert their computer into your Ethernet. Another option is to use the secure authentication protocols such as Kerberos, or SRA login components. [9] (This option corresponds to the logo promisc.) -Promisc disables the mixing mode. AllMulti Multicast [Multiple Access Communication, Multi-Distance] address is the broadcast of a group of hosts that do not need to be on one subnet. Currently, the kernel does not support multicast addresses. (This option corresponds to the flag allmulti.) -Allmulti prohibits multicast addresses. 5.9 Using NetStat Check the following, we turn over to discuss a tool for checking network configuration and behavior. It is called NetStat and is actually a summary of several tools. We will discuss each of its features in the following sections. 5.9.1 Display Routing NetStat When using the -R flag to call NetStat, it displays the kernel selection routing in a manner we have ever used in Route. In vstout, it generates: # netstat -nr Kernel routing table Destination Gateway Genmask Flags Metric Ref Use 127.0.0.1 * 255.255.255.255 UH 1 0 191.72.1.0 * 255.255.255.0 U 1 0 191.72.2.0 191.72.1.1 255.255.255.0 UGN 1 0 -n option makes NetStat print out the address in a point of four groups of IP, rather than using hostnames or network names. This is especially useful when you want to find addresses on the web (for example, for a DNS or NIS server). The second column of the NetStat output shows the gateway pointing to the selection option. If you don't use the gateway, you only print an asterisk. Column 3 shows the "generality" of the route. When a given IP address is to find out the appropriate route, the kernel query all items of the routing table are compared to the Genmask before comparing the destination address with the route. The fourth column shows various signs describing routing: g routing uses a gateway. U The interface used is started.

II can only reach a single host through routing, for example, LoopBack item 127.0.0.1 is this. D If the entry is generated by an ICMP redirection message, set the flag (see Section 2.5). M If the table is modified by an ICMP redirection message, set the flag. The Ref column of NetStat output shows the reference to this route, i.e., how many other routes (eg, through the gateway) depend on this route. The last two columns show the number of times the code entry has been used, and the datagram passes the interface that is distributed. 5.9.2 Display Interface Statistics When the -i flag is called, NetStat will display statistics for the currently configured network interface. If another -a flag is added, it will print all interfaces existing in the kernel, not only those currently configured. On VSTOUT, NetStat's output looks like this: $ netstat -i kernel interface Table IFACE MTU MET RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flags LO 0 0 3185 0 0 0 0 3185 0 0 0 BLRU ETH0 1500 0 972633 17 20 120 628711 217 0 0 0 The current MTU and metrics of the interface of the BRU MTU and MET domain. The RX and TX columns show how many packets are unlikely received and transmitted (RX-OK / TX-OK), error (RX-DRP / TX-DRP) ), And how many packages are lost due to over-limit (RX-OVR / TX-OVR). The last column shows the flags set by the interface. These are a character version of the long flag name configured with the ifconfig display interface. B A broadcast address has been set. L This interface is a loopback interface. M All packages will be received (mixed mode). N avoids the end of the package. O For this interface, ARP is disabled. P This is a point-to-point connection. The R interface is running. The U interface is used. 5.9.3 Displaying the connection status NetStat supports a set of options to show your active or passive socket. Options -t, -u, -w and -x displays active TCP, UDP, RAW, and UNIX socket connections. If you add -A logo, then, the socket is also displayed (for example, listening). This will give a list of all servers currently running on your system. Netstat-TA generated in VLAGER: $ NetStat -ta Active Internet Connections Proto Recv-q send-q local address foreign address (state) TCP 0 0 *: domain *: * listen TCP 0 0 *: Time *: * listen TCP 0 0 *: SMTP *: * Listen TCP 0 0 VLAGER: SMTP VStout: 1040 ESTABLISHED TCP 0 0 *: Telnet *: * listen TCP 0 0 localhost: 1046 VBARDOLINO: Telnet Established TCP 0 0 *: Chargen *: * listen TCP 0 0 *: daytime *: * listen TCP 0 0 *: Discard *: * listen TCP 0 0 *: Echo *: * listen TCP 0 0 *: shell *: * listen TCP 0 0 *: login *: * listen This shows that most of the servers are simply simply waiting for input.

However, the fourth line shows an SMTP connection from VSTOUT, and the sixth line tells you that there is an output to VBardolino Telnet connection. [10] Use the -a logo will display all of all sockets. 5.10 Checking the ARP table In some cases, it is useful to observe the content of the ARP table that changes the kernel, for example, when you suspect the reusable Internet address is why some intermittent network issues. ARP tools are prepared for such things. Its command line option is arp [-v] [-t hwtype] -a [hostname] arp [-v] [-t hwtype] -s hostname hwaddr arp [-v] -d hostname [Hostname ...] The HostName parameter can be a symbol host name or an IP address represented by a point four groups. The first call displays the ARP item that specifies the IP address or host, or the ARP item of all known hosts is displayed if HostName is not given. For example, executing ARP on VLAGER will generate # ARP -A IP Address HW Type HW Address 191.72.1.3 10Mbps Ethernet 00: 00: C0: 5A: 42: C1 191.72.1.2 10Mbps Ethernet 00: 00: C0: 90: B3: 42 191.72.2.4 10Mbps Ethernet 00: 00: C0: 04: 69: AA It shows the Ethernet address of VLAGER, VSTOUT, and VALE. Use the -t option you can limit display information to the specified hardware type. This can be Ether, AX25, or PRONET, representing Ethernet, AMPR-AX.25, and IEEE-802.5 token ring network, respectively. The -s option is used to permanently add HostName's Ethernet address to the ARP table. The HWADDR parameter specifies the hardware address, which defaults to the Ethernet address, specified by the six hexadecimal bytes separated by the colon. Use the -t option, you can also set the hardware address for other types of hardware. There is a problem, it may need you to add an IP address to the ARP table, is when some reason failed to the far-end host, for example, its ARP driver is wrong or on the network. Another host is incorrectly used the IP address of the host. The hard-configured IP address in the ARP table is also a (very strong) method to protect you from other hosts on your Ethernet. Use the -D switch to call the ARP will delete all ARP items related to the given host. This can be used to force the interface to re-attempt the Ethernet address of the IP address in the process. This is useful when the error configured system has broadcast the wrong ARP information (of course, you must first reconfigure this error host). Options -s can also be used to implement a proxy (Proxy) ARP. This is a special technology, here a host, such as Gate, by pretending the two addresses to reference the same host GATE, and a gateway that is called FNORD. It is an ARP item that is published by FNORD that pointing to ourselves (GATE) Ethernet interface. Now, when a host issues an ARP request for FNORD, Gate will return a response that contains its own Ethernet address. At this point, the host that issues a request will send all the datagrams to Gate, Gate will be forwarded to these data to FNORD. These strap processes are sometimes needed, for example, when you want to access fnord from a DOS machine that cannot be well understood by the TCP implementation. When you use the agent ARP, for the DOS machine, FNORD seems to be found on the local net, so it doesn't need to know how the route passes through a gateway. Another very useful application of Agent ARP is that when your host is just a gateway for some hosts, for example, by a dial-up link.

In the previous example, we have already encountered an occasional PLIP? / TD> source:

Linux free pigeon

转载请注明原文地址:https://www.9cbs.com/read-3662.html

New Post(0)