Introduction to Linux networking

Материал из Home wiki
Версия от 22:38, 30 августа 2018; KOleg (обсуждение | вклад) (Новая страница: «A Linux system can be connected to a network or the Internet in several different ways - for example, via an Ethernet network card, a wireless network or a PPP (P…»)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к навигации Перейти к поиску

A Linux system can be connected to a network or the Internet in several different ways - for example, via an Ethernet network card, a wireless network or a PPP (Point-to-Point Protocol) connection over a dial-up or DSL modem. If your system is never connected to a network, then this chapter is not for you. However, if you do need to set up network connections (especially to a local area network), then read on.

Every Ethernet network card, PPP connection, wireless card or other device in your system that can be used for networking is known as an interface. Interfaces are usually associated with a piece of hardware (like a etwork card), but they can also be dynamically created (like PPP connections). For an interface to be used, it must first have an IP address assigned, which may be fixed and set from a configuration file on your system, or dynamically assigned by a server. An Ethernet interface for a desktop PC on a company or home network would usually have a fixed address, whereas a PPP connection interface to an ISP would have its address dynamically assigned by a server at the other end.

PPP interfaces are configured in a very different way to Ethernet and other fixed hardware interfaces. Before one can be activated, a modem must be used to dial an ISP on a particular phone number and login with a username and password. Only after the login is successful will the PPP interface have an IP address assigned by the ISP's access server. Other network settings on your system such as the DNS server addresses and default gateway will be assigned by the ISP as well. An Ethernet interface however can have an IP address set and start working at any time, and a system connected via Ethernet usually uses fixed DNS server and gateway addresses.

Sometimes, an Ethernet interface will have its addresses dynamically assigned as well. If so configured, the system will broadcast a request for an address using the DHCP (Dynamic Host Configuration) protocol when the interface is activated at boot time. This will be answered by a DHCP server, which supplies the IP address and possibly default gateway and DNS server addresses as well. DHCP is often used on large networks with many systems that frequently connect and disconnect (such as laptops), in order to avoid manually configuring each system with a fixed IP address.

One special network interface that is always available is the loopback interface. It always has the IP address 127.0.0.1, which is mapped to the hostname localhost. This interface cannot be used to communicate with other systems, just your own - for example, running the command telnet localhost will bring up the login prompt of your own system (assuming a telnet server is active).

Every interface has a name, like eth1 or ppp0. All Ethernet interfaces start with eth, PPP interfaces with ppp, loopback with lo and token ring with tr. The number tells you which network card of that type the interface is related to - if your system had two Ethernet cards the first would be eth0 and the second eth1.

If your system is connected to a network any bigger than a small home LAN, one of the computers on the network will be the gateway. This is a server (or more likely a router) that knows how to route traffic to other networks or the internet, perhaps by a PPP link, broadband connection or other network card. For your system to communicate with those other networks, it must be configured with the IP address of the gateway.

All communication on an IP network is done using IP addresses, like 192.168.1.10 or 210.23.128.117. Because addresses like this are not too easy for the average person to remember, they can have names associated with then as well, like server.foo.com. Any time a system needs to lookup an IP address for a hostname (or vice versa) it queries a DNS server which will supply the needed information, either from its own records or by querying other DNS servers on the network or Internet. For your system to be able to query a DNS server, it needs to be configured with the IP address or addresses of nearby servers and a default domain name to append to any hostnames.

Not all IP addresses are looked up from a DNS server though - some are stored in the /etc/hosts file on your system so that they can be found even when networking is not active. Typically the IP addresses for localhost and your system's hostname will be stored in this file, because they rarely change.

As would be expected, the Network Configuration module can be found under the Networking category in Webmin. The main page shows one icons for each of the four configuration categories - Network Interfaces, Routing and Gateways, DNS Client and Host Addresses. All the editable forms and options in the module are under one of those four categories.

This module was designed mainly for configuring networking on systems with permanent network connections, such as Ethernet or token ring cards. If your system has only a dial-up PPP connection to the internet, it will not be much use to you. Instead, you should use one of the PPP configuration tools that comes with most Linux distributions and allows you to set phone numbers, usernames and passwords for dial-up connections.

The forms in this module only allow you to set up your system as a DNS and DHCP client. See also BIND DNS Server and DHCP Server for configuration of the corresponding servers.

See also:

Network Configuration