Network

From TheLinuxVault

(Redirected from Networking)
Jump to: navigation, search


Linux Basics

Networking refers to everything that has to do with communication between computers, including the Internet, smaller LAN networks, and wireless networks. Linux provides a great deal of support for networking with a wide range of network devices, as well as tools and applications to help configure and debug network problems.

Contents

[edit] Overview

The first and most important part of networking in Linux is the driver. The driver is software that runs as a kernel module and controls the networking hardware. There is support for nearly all wired network interface devices, and most wireless devices. See Wireless Drivers for more information on options for non-supported devices. The driver is needed to implement the lowest layers of the OSI stack networking model.

[edit] Terms

[edit] LAN

Local Area Network: A small network connected by network hubs, such as routers or servers, often connected to the internet.

[edit] DHCP

Dynamic Host Configuration Protocol: A common protocol used to connect the computers in a LAN to the network hubs. It gives each computer an IP on the network, separate from the internet. For example, a computer on a LAN configured by DHCP may have an IP of 192.168.0.2 to connect to the router, while the router then sends the computer's traffic over the internet IP of 101.102.103.104.

[edit] Internet

Main article: Internet

The Internet is a publicly accessible network of computer networks, interconnected by standard open protocols across the globe. Data is sent across the Internet by packet switching using the standard Internet protocols (IP) and Transmission Control Protocol (TCP). A number of application protocols, such as Hypertext Transfer Protocol (HTTP) and e-mail (POP3, SMTP, IMAP) are layered on top of the these.

The HTTP protocol also known as the World Wide Web, is often mistakenly regarded as a synonym for the Internet. It was created by Tim Berners-Lee, he is now the head of the World Wide Web consortium (W3C).

[edit] World Wide Web

Main article: World Wide Web

World Wide Web, also known as the WWW or simply "the Web" is the large system of interlinked hypertext documents that is accessed using the Internet. It was created by Sir Tim Berners-Lee in 1989, when he created the first web server, first web browser, first hypertext documents written in HTML, and the first URLs.

[edit] Server

Main article: Server

A server is an application or device that performs services in which data is delivered to clients to be translated into information. File servers and web servers are very common; a number of servers which are used for the same purpose is called a server farm.

[edit] FTP

File Transfer Protocol is a protocol used to transfer files over the internet or other network. It is supported by many file browsers and web browsers, and some programs such as FileZilla.

[edit] Command Line Networking Tools

While Linux distributions will vary on their level and style of GUI networking features, almost all Linux systems will have the same basic command line tools to configure and fix networking problems. Since this is a non-distribution specific reference, this section will explain some of the networking tools the all distributions have in common.

[edit] ifconfig

The most basic command to help configure a network is ifconfig. Using this command, a user can list active network interfaces, and configure how they are to be used. A typical usage of this command looks like this:

user@hostname:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:18:F8:0B:1D:20
          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::218:f8ff:fe0b:1d20/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:134400 errors:0 dropped:0 overruns:0 frame:0
          TX packets:176807 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:56573611 (53.9 MiB)  TX bytes:175331813 (167.2 MiB)
          Interrupt:20 Base address:0x8000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:78 errors:0 dropped:0 overruns:0 frame:0
          TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5924 (5.7 KiB)  TX bytes:5924 (5.7 KiB)

From this we can tell that there are two network interfaces running. The first one is eth0, and means that this is the first ethernet device. If you have multiple ethernet devices running on your system, they will appear as eth1, eth2, etc... . The second interface listed is lo, which is software interface called the loopback interface. This is a way for a computer to connect to itself without actually using a network adapter. You can turn on and off network interfaces by calling ifconfig with a parameter specifying the interface, and whether you want to bring it up or take it down.

user@hostname:~$ ifconfig eth0 up
user@hostname:~$ ifconfig eth0 down

To set an interface to a specific IP address, you would call:

ifconfig <interface> <ipaddr>

Such as:

user@hostname:~$ ifconfig eth0 192.168.1.100

There are a wide variety of things that can be configured using ifconfig, and you can learn more about them by consulting the manual page by entering:

user@hostname:~$ man ifconfig

[edit] iwconfig

The command iwconfig is much like ifconfig, except it is used for configuring the wireless aspects of wireless interfaces. Using iwconfig does not replace the need to use ifconfig, but instead provides additional configuration to wireless specific settings. To learn more about iwconfig, consult the manual page by typing:

user@hostname:~$ man iwconfig

[edit] dhclient and dhcpcd

Many home networks use dhcp on their routers to assign and manage the IP addresses on their networks. The command line utilities dhclient and dhcpcd are useful for requesting IP addresses on dhcp enabled networks. On occasion, a distribution's network manager fails to obtain and IP address for some reason, mostly because of issues when connecting wirelessly using ndiswrapper. When this occurs, it is often possible to obtain an IP using the dhclient or dhcpcd commands. Usually these commands must be run using root privileges, so either log in as root, or use sudo to run them. The command dhcpcd can be run just by typing the command, but dhclient needs to be given the interface that is requesting the new IP address. They are used as such:

user@hostname:~$ sudo dhcpcd
user@hostname:~$ sudo dhclient eth0

[edit] netstat

The netstat utility is used to list networking ports, and tell what (if anything) is running on them. This can be useful to help debug issues of specific programs, or to make sure only ports you want open are open.

[edit] Network Managers

Since configuring a network connection via the command line is confusing and difficult for many users, distributions usually create their own GUI for configuring networking. For more information, see your specific distribution's documentation.

[edit] See Also:

Wireless Networking in Ubuntu

Personal tools