Install and configure the network interfaces on the debian & ubuntu

Today we will talk about how to configure our network cards, suppose we missed at the time of installation, configuration of network interfaces, and we need to quickly pick them up.
And so begin the same!

Installation of network card

First of all, make sure that the network cards installed and if they are integrated into the motherboard, then included in the BIOS, as well as connect the network cables. Check whether the system sees our Ethernet cards (interfaces). To do this, see kernel messages issued during boot:
# dmesg | grep eth

The command grep we wrote eth. In the Linux kernel networking interfaces as eth0, eth1, and so on. You can also display a list of devices with the following command:
# lspci | grep Ether

Make sure that the system sees the network interfaces. If at this point you get blank rows or error messages, it means that the equipment: either not connected or not properly or is not compatible. In the first case we check the correctness of the inclusion once again of the network card, BIOS support, and so on in the second and third case produce replacements. If the problem occurred after you build your kernel, check the kernel. This information is beyond the scope of this article, but in future articles we will look at the Assembly, testing and configuring the kernel.

To configure a static IP address

And so, our equipment is functioning properly. We need to configure a static IP address with the following settings: IP address 192.168.1.11, subnet mask 255.255.255.0, gateway 192.168.1.1.
First see the ifconfig command output:

# ifconfig

or

$ sudo ifconfig

The second variant of the command I posted for those who install prohibited the entry of root. The remainder of this article I will not duplicate the team, just remember: If there is an icon at the beginning of the code #, then the command is run as root. Those who prohibited the entry into the system as root execute it by using sudo.
If everything has been configured correctly during the installation of the system, we will see the following:
eth0
Link encap: Ethernet HWaddr 08:00:27: f1: d9: 29

INET addr: 192.168.1.11 Bcast: 192.168.1.255 Mask: 255.255.255.0

inet6 addr: fe80: a00: 27ff: fef1: d929/64 Scope: Link

UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1

RX packets: 6 errors: 0 dropped: 0 overruns: 0 frame: 0

TX packets: 12 errors: 0 dropped: 0 overruns: 0 carrier: 0

collisions: 0 txqueuelen: 1000

RX bytes: 720 (720.0 B) TX bytes: 852 (852.0 B)

Interrupt: 10 Base address: 0xd020

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: 8 errors: 0 dropped: 0 overruns: 0 frame: 0

TX packets: 8 errors: 0 dropped: 0 overruns: 0 carrier: 0

collisions: 0 txqueuelen: 0

RX bytes: 560 (560.0 B) TX bytes: 560 (560.0 B)

In the first line we see connection type and mac address (physical address is different). In the second line of the ip address, subnet mask, and broadcast address. The third line refers to the sixth version of the TCP/IP protocol stack, but this conversation will go in one of the following articles. When we see RUNNING in the fourth line, it means that the network cable is connected. Further statistical information. If the network configuration failed during installation, then at best we will see only the configured local interface:

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: 8 errors: 0 dropped: 0 overruns: 0 frame: 0

TX packets: 8 errors: 0 dropped: 0 overruns: 0 carrier: 0

collisions: 0 txqueuelen: 0

RX bytes: 560 (560.0 B) TX bytes: 560 (560.0 B)

And will not see any information. In General, for testing or troubleshooting, you can configure the network interfaces with ifconfig and route commands. This will be written below in this article. Until then, let’s begin editing configuration files. In General, before editing the configuration files for network network interface must be stopped. This is done as follows:

# ifdown eth0

But in our case the eth0 interface has not been configured and we get an error message:

interface eth0 not configured

Then, for a start, check the file/ If it does not exist, create it if there is, then let’s edit text editor:

# nano/etc

For a server with a single network interface, we should be the following:

# 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 static
address 192.168.1.11
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
Gateway 192.168.123.1
# dns-* options are implemented by the resolvconf package, if installed
DNS-nameservers 192.168.1.11

Now you need to activate a network interface:

# ifup eth0

And restart network services:

#/e-the ping statistics–http://www.yandex.ru-
4 packets transmitted, 4 received, 0% packet loss, time 3016ms
RTT min/avg/max/mdev = 1.514/2.128/3.123/0.605 ms

In this setting a static IP address for a server with a single network interface is up.

Configuring a dynamic IP address

In some cases, the server can obtain a dynamic IP address. Most often this is a reserved address or psevdodinamičeskij. The DHCP Server binding a certain mac address to a specific ip address. This situation can occur in the network, but most often it occurs when the provider generates ip addresses dynamically. In this case, the file/is as follows:

# 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

That’s all there is to it! I hope my article on setting up a network in the system you will be useful

Installing the driver for the atheros debian ubuntu & 81xx
All manipulations must have to put extra packages apt-get install linux-headers’uname-r ‘ apt-get install resolvconf automake autoconf make gcc gcc-4.4
-Download driver AR81Family-linux-v1.0.1.14.tar.gz
AR81Family-linux-v1.0.1.14.tar.gz

-copy home directory-open the Terminal and run a couple of action

mkdir AR81Family
MV AR81Family-Linux-v1.0.1.14.tar.gz AR81Family
CD AR81Family
tar zxvf AR81Family-Linux-v1.0.1.14.tar.gz
make
make install
modprobe
atl1e
exit

That’s all.

Another option is installing a network card. RTL r8169Byl sad opyt′ in the wrong driver is installed, or not correctly identified her. And went to network problems. Drop it low speed and so on
Remove messages from dmesg dmesg | grep eth
2. the most beautiful way of lspci | grep Ethernet
Well, here is an example of what would be more obvious

root @ s ~ # lspci | grep Ethernet 06: 00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111 Gigabit Ethernet controller/8168B PCI
Express Gigabit Ethernet controller (rev 02) root @ s ~ #

From the output you can see that the network card we have implemented at the controller/8168B RTL8111 Gigabit Ethernet controller to determine which driver is used can be from listing lsmod, realezovan driver as a module in the kernel.
Well, physically the network decided, Debian calls network cards on behalf of eth and number and that if we have two network cards? by default, they will be called eth0 and eth1.
Note that this operating system permanently binds the MAC address of the interface to the eth. If you have a network card in a computer named eth0 and you changed it, then booting after replacement you will not see the expected eth0 and eth1 already see. So be sure you even need to look into the file/etc/udev/rules.d/70-persistent-net.rules that would look under maps, otherwise can get into nipriâtnuû the situation, configure the interface 1 and work physically will be quite another.

root @ s ~ # cat/etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the/lib/udev/write_net_rules # program, run by the
persistent-net .rules file rules generator. # # You can modify it, as long as you keep each rule on
a single # line, and change only the value of the NAME = key.
# PCI device 0x10ec: 0x8168 (r8169) SUBSYSTEM == net, ACTION == “add”,
DRIVERS = * = “?”, ATTR {address} == “6 c: 62: 6 d: 7a: e7: 2 c”, ATTR {dev_id} == “0x0”, ATTR {type} == “1”,
KERNEL == eth * “, NAME =” eth0 “root @ s ~ #

CD/usr/src # disable r8169 rmmod does not correct
wget r8168-8.032.00.tar.bz2
or wget ttp://www.sysadmin-komi.ru/download/drv/r8168-8.035.00.tar.bz2
tar jxvf r8168-8.032.00.tar.bz2
# already then the downloading for you! vsmotrite carefully!
CD r8168-8.032.00
make
clean the modules
make install depmod-a echo “blacklist r8169” > >/etc/modprobe.d/blacklist-network.conf
Update-initramfs-u modprobe r8168 # check

Restartuem Server
Next, check the

ethtool-i eth0

And see

driver: r8168 version: 8.032.00-NAPI firmware-version: bus-info: 00000000: 01: 00.0

All use! Work rules without falling and gripes