Linux wifi из командной строки с wpa_supplicant

Caveats when using bridging and vlan

#/etc/network/interfaces
auto eth0 bri0
iface eth0 inet static
        address 192.168.1.1
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
iface eth0.110 inet manual
        vlan-raw-device eth0
iface bri0 inet static
        address 192.168.110.1
        network 192.168.110.0
        netmask 255.255.255.0
        broadcast 192.168.110.255
        bridge_ports eth0.110
        bridge_stp on
        bridge_maxwait 10

If you are using a brigded VLAN setup, which is probably useful for networking in virtualization environments, take care to only attach either a bridge device or VLAN devices to an underlying physical device — like shown above. Attaching the physical interface (eth0) to a bridge (eg. bri1) while using the same physical interface on apparently different VLANs will result in all packets to remain tagged. (Kernel newer than 2.6.37 and older than 3.2).

Configurazione di esempio

# 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

#INTERFACCE FISICHE
auto eth0
iface eth0 inet manual

auto eth1
iface eth1 inet manual

auto eth2
iface eth2 inet manual

#BONDING e VLAN
auto bond0
iface bond0 inet manual
   bond-mode 4
   bond-miimon 100
   bond-lacp-rate fast
   bond-slaves eth0 eth1

auto bond0.75
iface bond0.75 inet manual
   vlan-raw-device bond0

auto bond0.139
iface bond0.139 inet manual
   vlan-raw-device bond0

auto bond0.283
iface bond0.283 inet manual
   vlan-raw-device bond0

auto bond0.287
iface bond0.287 inet manual
   vlan-raw-device bond0

#BRIDGES
auto br0
iface br0 inet static
   address 192.9.200.55
   netmask 255.255.255.0
   gateway 192.9.200.180
   bridge_ports bond0
   bridge_stp off
   bridge_fd 0

auto br75
iface br75 inet static
   address 10.11.16.22
   netmask 255.255.248.0
   gateway 10.11.16.1
   bridge_ports bond0.75
   bridge_stp off
   bridge_fd 0          # no forwarding delay
   bridge_waitport 0    # no delay before a port becomes available

auto br139
iface br139 inet static
   address 10.11.33.239
   netmask 255.255.224.0
   gateway 10.11.32.1
   bridge_ports bond0.139
   bridge_stp off
   bridge_fd 0

#FAKEBRIDGES
auto br283
iface br283 inet manual
   bridge_ports bond0.283
   bridge_stp off
   bridge_fd 0

auto br287
iface br287 inet manual
   bridge_ports bond0.287
   bridge_stp off
   bridge_fd 0

A questo punto potrò assegnare le diverse vlan alle macchine virtuali guest che ospiterò sull’hypervisor KVM, utilizzando come «shared device name» della rete i vari bridge e fakebridge definiti nel file di configurazione

Ho definito ‘fakebridge’ dei normali bridge ma attivati in modalità manuale e senza indirizzo di rete assegnato (ad esempio per assegnare ai vari guest VLAN su cui l’hypervisor non ha indirizzi, come adesempio vlan segregate)

A titolo di esempio incollo anche la configurazione funzionante del portchannel sullo switch Cathalyst Cisco in uso.

!
interface Port-channel5
 description KVMx4150
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 1,75,139,283,287
 switchport mode trunk
!
...
!
interface GigabitEthernet3/0/3
 description x4150
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 1,75,139,283,287
 switchport mode trunk
 no cdp enable
 channel-protocol lacp
 channel-group 5 mode active
!
!
interface GigabitEthernet3/0/4
 description x4150
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 1,75,139,283,287
 switchport mode trunk
 no cdp enable
 channel-protocol lacp
 channel-group 5 mode active
!

!

CategoryNetwork CategorySystemAdministration

Kabelgebundene Netzwerke werden nicht verwaltet.

Ab Debian 6.0 «Squeeze» verwaltet der NetworkManager standardmäßig keine in /etc/network/interfaces definierte Schnittstelle.

„Nicht verwaltete Geräte“ bedeutet, dass NetworkManager diese Netzwerkgeräte nicht verwaltet. Dies tritt auf, wenn zwei Bedingungen erfüllt sind:

  1. Die Datei /etc/network/interfaces irgendetwas über die Schnittstelle enthält, wenn auch nur:

    allow-hotplug eth0
    iface eth0 inet dhcp
  2. und /etc/NetworkManager/NetworkManager.conf enthält:

    plugins=ifupdown,keyfile
    
    
    managed=false

Seit network-manager Version 0.8.1-4, werden die kabelgebundenen/kabellosen Verbindungen in /etc/network/interfaces mit einem #NetworkManager# Präfix während der Paketinstallation deaktiviert. Dann, wenn das Network-Manager Paket gelöscht wird, werden sie wieder aktiviert (Debian bug ).

Вход в систему

Автологин в консоли с mingetty

Устанавливаем Mingetty: — упрощённый вариант стандартной программы agetty, в задачи которой входит управление доступом к физическим и виртуальным терминалам.:

# aptitude install mingetty

Далее меняем строку настроек в консоли по-умолчанию, вместо root можно указать другой логин.

sed -i '/:2345/s/^/\#/; /:2345/a 1:2345:respawn:\/sbin\/mingetty --autologin root --noclear tty1' /etc/inittab

или вручную

nano /etc/inittab

#1:2345:respawn:/sbin/getty 38400 tty1
1:2345:respawn:/sbin/mingetty --autologin root tty1 linux
2:23:respawn:/sbin/getty 38400 tty2

Автологин в консоли с стандартным agetty

Стандартный менеджер входа agetty (util-linux) начиная с v.2.20 содержит функциональность mingetty

Далее настраиваем вход, вместо root пишем нужный логин

nano /etc/inittab

#1:2345:respawn:/sbin/getty 38400 tty2
1:2345:respawn:/sbin/getty --autologin root tty1 linux
2:23:respawn:/sbin/getty 38400 tty2

Legacy method

This /etc/network/interfaces text assigns three IP addresses to eth0.

auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.42/24
    gateway 192.168.1.1

auto eth0:0
allow-hotplug eth0:0
iface eth0:0 inet static
    address 192.168.1.43/24

auto eth0:1
allow-hotplug eth0:1
iface eth0:1 inet static
    address 192.168.1.44/24

An alias interface should not have «gateway» or «dns-nameservers»; dynamic IP assignment is permissible.

The above configuration is the previous traditional method that reflects the traditional use of ifconfig to configure network devices. ifconfig has introduced the concept of aliased or virtual interfaces. Those types of virtual interfaces have names of the form interface:integer and ifconfig treats them very similarly to real interfaces.

Nowadays ifupdown uses the ip utility from the iproute2 package instead of ifconfig. The newer ip utility does not use the same concept of aliases or virtual interfaces. However, it supports assigning arbitrary names to the interfaces (they’re called labels). ifupdown uses this feature to support aliased interfaces while using ip.

wpa_supplicant

wpa_supplicant — WPA-клиент и IEEE 802.1X supplicant.

Пакет wpasupplicant предоставляет wpa-* ifupdown опции для /etc/network/interfaces. Если эти опции определены, wpa_supplicant запускается в фоне, когда ваша сеть работает и останавливается в случае её остановки.

Пользователям GNOME и KDE не стоит настраивать wpa_supplicant вручную. Используйте !NetworkManager.

Установите пакет wpasupplicant:

$ su -l
# aptitude update
# aptitude install wpasupplicant

WPA-PSK и WPA2-PSK

Также известные как «WPA Personal» и «WPA2 Personal» соответственно.

  1. Ограничьте права пользователей на файл /etc/network/interfaces для защиты ключа (pre-shared key) (PSK):

    # chmod 0600 /etc/network/interfaces
  2. Откройте файл /etc/network/interfaces в текстовом редакторе:

    # sensible-editor /etc/network/interfaces
  3. Задайте соответствующие данные для беспроводного интерфейса вместе с SSID и PSK. Например:

    auto wlan0
    iface wlan0 inet dhcp
        wpa-ssid mynetworkname
        wpa-psk mysecretpassphrase

    «auto» подключит интерфейс wlan0 при запуске системы. Если этого не требуется, удалите или закомментируйте эту строку.

  4. Сохраните файл и выйдите из редактора.
  5. «Поднимите» интерфейс. При этом включится wpa_supplicant как фоновый процесс.

    # ifup wlan0

Дополнительные wpa-* опции описаны в файле /usr/share/doc/wpasupplicant/README.modes.gz. Вам стоит прочитать эту инструкцию, если вы подключаетесь к «скрытой» сети (не распространяющей свой SSID)

Для общей информации о /etc/network/interfaces смотрите man-инструкцию [5/interfaces|interfaces(5)]].

WPA-EAP

Для настройки сетей, использующих EAP-TLS, вам необходимо создать файл конфигурации wpa_supplicant и обеспечить сертификат клиента. Пример конфигурации WPA2-EAP находится в файле /usr/share/doc/wpasupplicant/examples/wpa2-eap-ccmp.conf.

После этого укажите ваш конфигурационный файл в /etc/network/interfaces. Например:

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Больше информации может быть найдено в man-инструкции wpa_supplicant.conf(5). Полностью комментированный пример конфигурационного файла wpa_supplicant находится здесь: /usr/share/doc/wpasupplicant/README.wpa_supplicant.conf.gz.

Configuration de réseau avec script init

Ajoutez cette ligne au fichier /etc/modules :

8021q

Dans la section iface du fichier /etc/network/interfaces ajoutez le paramètre :

        vlan-raw-device eth0

Le nom de l’interface devrait être le nom brut de l’interface (le même qui est spécifié par vlan-raw-device) suivi d’un point et de l’ID du VLAN, par exemple eth0.100. Il peut plutôt être «vlan» suivi de l’ID du VLAN, par exemple vlan100. Dans les deux cas, l’ID du VLAN est à la fin, et c’est le seul endroit où il est configuré.

Note : Si vous nommez votre interface VLAN ethX.YYY, il n’y a pas besoin de spécifier le vlan-raw-device, parce que le nom brut du périphérique peut être trouvé à partir du nom de l’interface.

Par exemple :

auto eth0.222
iface eth0.222 inet static
        address 10.10.10.1/24
        vlan-raw-device eth0

Wicd

wicd (Démon de connexion pour interfaces sans fil — en anglais, Wireless Interface Connection Daemon) est une alternative légère à NetworkManager. Il fonctionne indépendamment de l’environnement graphique avec tous les environnements de bureau : GNOME, Xfce, LXDE, Fluxbox… Comme pour NetworkManager, des interfaces graphiques sont disponibles pour configurer wicd. Votre interface sans fil ne devrait pas être référencée dans le fichier Debian /etc/network/interfaces.

  1. Mettez à jour la liste de paquets disponibles et installez le paquet wicd :

    $ su -l
    # aptitude update
    # aptitude install wicd
  2. Modifiez le fichier/etc/network/interfaces pour qu’il ne contienne que les lignes suivantes :

    # Ce fichier sert à paramétrer et activer les interfaces réseaux de votre système.
    # Pour plus d'informations voir : interfaces(5).
    
    # The loopback network interface  (Connexion à l'ordinateur local : boucle de retour)
    auto lo
    iface lo inet loopback

Note : à partir de Wheezy, c’est une bonne chose de placer l’interface de votre réseau sans fil dans /etc/network/interfaces, mais pas obligatoire. Vous pouvez configurer l’interface du réseau sans fil (par exemple wlan0) dans les préférences du client wicd.

  1. Si ce n’est pas fait, ajoutez votre compte utilisateur au groupe netdev et rechargez DBus:

    # adduser nom_utilisateur netdev
    # /etc/init.d/dbus reload
  2. Démarrez le démon wicd :

    # /etc/init.d/wicd start
  3. Démarrez wicd dans votre compte utilisateur:

    # exit
    $ wicd-client -n

Voir aussi la FAQ de wicd.

Предпосылки

  • wireless-tools, инструменты для манипулирования беспроводными расширенями Linux (установлены по умолчанию на ПК и ноутбуках)

  • Для систем с графическим окружением:
    1. NetworkManager (установлен на ПК и ноутбуках использующих граф. окружение Gnome)

    2. wicd, проводной и беспроводной менеджер, рекомендуемый для других графических окружений (без зависимостей GNOME), таких как XFCE, Fluxbox, Openbox, Enlightenment.

  • wpasupplicant, поддержка клиентов для WPA и WPA2 сетей

Если они отсутствуют, вы можете установить их с помощью команды:

aptitude install wireless-tools

…и аналогчиные

/etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto bond0
iface bond0 inet manual
        up ifconfig bond0 0.0.0.0 up
        slaves eth1 eth0
auto vlan10
iface vlan10 inet static
        address 10.10.10.12
        netmask 255.255.0.0
        network 10.10.0.0
        broadcast 10.10.255.255
        vlan-raw-device bond0
        gateway 10.10.0.1
        dns-search hup.hu
        dns-nameservers 10.10.0.2
auto vlan20
iface vlan20 inet static
        address 10.20.10.12
        netmask 255.255.0.0
        network 10.20.0.0
        broadcast 10.20.255.255
        vlan-raw-device bond0
auto vlan30
iface vlan30 inet static
        address 10.30.10.12
        netmask 255.255.0.0
        network 10.30.0.0
        broadcast 10.30.255.255
        vlan-raw-device bond0

Multiple IP addresses on One Interface

Interface aliasing allows one interface to have multiple IP addresses. This is useful when more than one server is to be visible via the Internet. Note that virtual hosts can support multiple Apache servers with a single IP address. Apache responds to the domain name supplied by the client in the HTTP header. In many other situations, one external IP is needed for each server using a port.

This /etc/network/interfaces text assigns three IP addresses to eth0.

auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.42
    netmask 255.255.255.0
    gateway 192.168.1.1

auto eth0:0
allow-hotplug eth0:0
iface eth0:0 inet static
    address 192.168.1.43
    netmask 255.255.255.0

auto eth0:1
allow-hotplug eth0:1
iface eth0:1 inet static
    address 192.168.1.44
    netmask 255.255.255.0

An alias interface should not have «gateway» or «dns-nameservers»; dynamic IP assignment is permissible.

The above configuration is the previous traditional method that reflects the traditional use of ifconfig to configure network devices. ifconfig has introduced the concept of aliased or virtual interfaces. Those types of virtual interfaces have names of the form interface:integer and ifconfig treats them very similarly to real interfaces.

Nowadays ifupdown uses ip utility from the iproute2 package instead of ifconfig. The newer ip utility does not use the same concept of aliases or virtual interfaces. However, it supports assigning arbitrary names to the interfaces (they’re called labels). ifupdown uses this feature to support aliased interfaces while using ip.

Also, ifupdown supports specifying multiple interfaces by repeating iface sections with the same interface name. The key difference from the method described above is that all such sections are treated by ifupdown as just one interface, so user can’t add or remove them individually. However, up/down commands, as well as scripts, are called for every section as it used to be.

This /etc/network/interfaces text assigns three IP addresses to eth0.

auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.42
    netmask 255.255.255.0
    gateway 192.168.1.1

iface eth0 inet static
    address 192.168.1.43
    netmask 255.255.255.0

iface eth0 inet static
    address 192.168.1.44
    netmask 255.255.255.0

Additional information can be found on the http://www.shorewall.net/Shorewall_and_Aliased_Interfaces.html page.

Автоматическое обновление

Устанавливаем unattended-upgrades (wiki.debian.org/UnattendedUpgrades):

# aptitude install unattended-upgrades

Правим общие настройки обновления:

nano /etc/apt/apt.conf.d/50unattended-upgrades 

// Выбираем все источники обновлений
Unattended-Upgrade::Allowed-Origins {
        "${distro_id} stable";
        "${distro_id} ${distro_codename}-security";
        "${distro_id} ${distro_codename}-updates";
        "${distro_id} ${distro_codename}-proposed-updates";
};
// Список пакетов, которые не должны обновляться, у меня таких нет.
Unattended-Upgrade::Package-Blacklist {
//      "vim";
};
// Возможность оповещения об обновлении на почту пока отключаем.
//Unattended-Upgrade::Mail "root@localhost";
// Удаляем не нужные пакеты
Unattended-Upgrade::Remove-Unused-Dependencies "true";
// Автоматически перезагружаем систему, включаем
Unattended-Upgrade::Automatic-Reboot "true";
// Можно ограничить скорость загрузки к примеру в 70 кб в сек., отключаем
//Acquire::http::Dl-Limit "70";

Правим настройки периодичности обновления

nano /etc/apt/apt.conf.d/02periodic

// Включаем обновление
APT::Periodic::Enable "1";
// Проверяем обновления каждый 1 день
APT::Periodic::Update-Package-Lists "1";
// Отключаем загрузку пакетов без установки
APT::Periodic::Download-Upgradeable-Packages "0";
// Применяем обновления каждый 1 день
APT::Periodic::Unattended-Upgrade "1";
// Удаляем устаревшие установочные пакеты каждые 7 дней
APT::Periodic::AutocleanInterval "7";

Логи обновления смотрим тут — /var/log/unattended-upgrades/unattended-upgrades.log.

Указываем время выполнения обновления. Например каждый день в 6:25 утра:

nano /etc/сrontab

25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

Перезапускаем cron:

/etc/init.d/cron restart

Avertissement sur l’utilisation d’un relais (bridging) et d’un réseau local virtuel (vlan)

#/etc/network/interfaces
auto eth0 bri0
iface eth0 inet static
        address 192.168.1.1/24
iface eth0.110 inet manual
        vlan-raw-device eth0
iface bri0 inet static
        address 192.168.110.1/24
        bridge_ports eth0.110
        bridge_stp on
        bridge_maxwait 10

Si vous utilisez une configuration VLAN brigde qui est probablement utile pour un réseau dans des environnements de virtualisation, veillez à attacher un seul dispositif bridge ou VLAN à un dispositif physique – comme on l’a montré plus haut. Attacher une interface physique (eth0) à un bridge (par exemple bri1), alors que vous utilisez la même interface physique sur des VLAN apparemment différents, aura comme résultat que tous les paquets resteront balisés (avec des noyaux supérieurs à 2.6.37 et antérieurs à 3.2).

Comment créer une connexion tolérante aux pannes avec un vlan (dans Etch jusqu’à Stretch)

Comment configurer un des serveurs ci-dessus en backup actif connectant 3 vlan {vlan10,vlan20,vlan30} dans un réseau Debian sans SPOF et sans vlan natif.

aptitude install vlan ifenslave-2.6

Supported Devices

The page HowToIdentifyADevice/PCI explains how to identify a PCI device.

The following list is based on the alias fields of modinfo iwlwifi in Debian 3.16 (3.16.7-ckt9-2) kernel images.

PCI: 8086:0082 Intel Corporation Centrino Advanced-N 6205
PCI: 8086:0083 Intel Corporation Centrino Wireless-N 1000
PCI: 8086:0084 Intel Corporation Centrino Wireless-N 1000
PCI: 8086:0085 Intel Corporation Centrino Advanced-N 6205
PCI: 8086:0087 Intel Corporation Centrino Advanced-N + WiMAX 6250
PCI: 8086:0089 Intel Corporation Centrino Advanced-N + WiMAX 6250
PCI: 8086:008A Intel Corporation Centrino Wireless-N 1030
PCI: 8086:008B Intel Corporation Centrino Wireless-N 1030
PCI: 8086:0090 Intel Corporation Centrino Advanced-N 6230
PCI: 8086:0091 Intel Corporation Centrino Advanced-N 6230
PCI: 8086:0885 Intel Corporation Centrino Wireless-N + WiMAX 6150
PCI: 8086:0886 Intel Corporation Centrino Wireless-N + WiMAX 6150
PCI: 8086:0887 Intel Corporation Centrino Wireless-N 2230
PCI: 8086:0888 Intel Corporation Centrino Wireless-N 2230
PCI: 8086:088E Intel Corporation Centrino Advanced-N 6235
PCI: 8086:088F Intel Corporation Centrino Advanced-N 6235
PCI: 8086:0890 Intel Corporation Centrino Wireless-N 2200
PCI: 8086:0891 Intel Corporation Centrino Wireless-N 2200
PCI: 8086:0892 Intel Corporation Centrino Wireless-N 135
PCI: 8086:0893 Intel Corporation Centrino Wireless-N 135
PCI: 8086:0894 Intel Corporation Centrino Wireless-N 105
PCI: 8086:0895 Intel Corporation Centrino Wireless-N 105
PCI: 8086:0896 Intel Corporation Centrino Wireless-N 130
PCI: 8086:0897 Intel Corporation Centrino Wireless-N 130
PCI: 8086:08AE Intel Corporation Centrino Wireless-N 100
PCI: 8086:08AF Intel Corporation Centrino Wireless-N 100
PCI: 8086:08B1 Intel Corporation Wireless 7260
PCI: 8086:08B2 Intel Corporation Wireless 7260
PCI: 8086:08B3 Intel Corporation Wireless 3160
PCI: 8086:08B4 Intel Corporation Wireless 3160
PCI: 8086:095A Intel Corporation Wireless 7265
PCI: 8086:095B Intel Corporation Wireless 7265
PCI: 8086:24F3 Intel Corporation Wireless 8260
PCI: 8086:24F4 Intel Corporation Wireless 8260
PCI: 8086:422B Intel Corporation Centrino Ultimate-N 6300
PCI: 8086:422C Intel Corporation Centrino Advanced-N 6200
PCI: 8086:4232 Intel Corporation WiFi Link 5100
PCI: 8086:4235 Intel Corporation Ultimate N WiFi Link 5300
PCI: 8086:4236 Intel Corporation Ultimate N WiFi Link 5300
PCI: 8086:4237 Intel Corporation PRO/Wireless 5100 AGN Network Connection
PCI: 8086:4238 Intel Corporation Centrino Ultimate-N 6300
PCI: 8086:4239 Intel Corporation Centrino Advanced-N 6200
PCI: 8086:423A Intel Corporation PRO/Wireless 5350 AGN Network Connection
PCI: 8086:423B Intel Corporation PRO/Wireless 5350 AGN Network Connection
PCI: 8086:423C Intel Corporation WiMAX/WiFi Link 5150
PCI: 8086:423D Intel Corporation WiMAX/WiFi Link 5150

DHCP Client Configuration

Setting additional DNS Servers

Example: dhclient3 uses /etc/dhcp/dhclient.conf. The setting you want is

supersede domain-name-servers 12.34.56.78, 12.34.56.79;

or perhaps

prepend domain-name-servers 12.34.56.78, 12.34.56.79;

Setting additional search domains

adding search domains for VPNs or local virtual networks:

append domain-name " virt vpn";

Note the leading space since the string is literally appended to the search domain provided by other configurations.

See the dhclient.conf(5) manual page for details.

Bridging

Bridging puts multiple interfaces into the same network segment. This is very popular when connecting a server to multiple switches for high availability or with virtualization. In the latter case it is usually used to create a bridge in the host (eg. dom0) and put the virtual interfaces of the guests (domU) into the bridge.

Example: Connect a server to 2 switches (via eth0 and eth1) by defining bridge 0 and give the server an IP address in this subnet:

auto br0
iface br0 inet static
        address 10.10.0.15/24
        gateway 10.10.0.1
        bridge_ports eth0 eth1
        up /usr/sbin/brctl stp br0 on

If a server is connected to multiple switches then you usually need to run the spanning tree protocol to avoid loops. Therefore STP must be turned on via an «up» command as shown above.

Example: Bridge setup without IP address configuration (use «manual» instead of «static») to «forward» an interface to a guest VM. (The static bridge config contains only 1 physical interface. The virtual interface will be added to the bridge when the VM is started.)

auto br1
iface br1 inet manual
        bridge_ports eth4
        up /usr/sbin/brctl setageing br1 0
        up /usr/sbin/brctl stp br1 off

Note: The Linux bridge supports only STP, no RSTP (Rapid Spanning Tree). Therefore it supports only the old STP Costs, not the new RSTP Costs (see ). This is usually fine with Cisco Switches, but eg. Juniper switches use the RSTP costs and therefore this may lead to different spanning tree calculations and loop problems. This can be fixed by settings the costs manually, either on the switch or on the server. Setting the cost on the switch is preferred as Linux switches back to the default costs whenever an interface does down/up.

Настройка скорости и дуплекса

Частые ошибки автоматического согласования режимов работы, свидетельствуют о проблемах с кабелем. Следует проверить физическое состояние кабельного оборудования (отсутствие повреждений итп), прежде чем предполагать несовместимость алгоритмов автосогласования. Если Вы выключите автосогласование и установите скорость и дуплекс вручную, то интерфейс на другом конце кабеля будет считать что автосогласование не поддерживается и установит скорость 10Mbs и полудуплексный режим передачи. Для того чтобы не было ошибок в работе, при ручной настройки Вам необходимо убедиться что оба интерфейса работают на одинаковых скоростях и установлен одинаковый режим дуплекса.

Если Вы хотите вручную установить скорость и режим дуплекса интерфейса. Здесь описаны основные шаги:

  • установите пакеты ethtool и net-tools, так вы получите программы ethtool и mii-tool. Одна или обе из них могут работать с Вашим интерфейсом.

  • Убедитесь что у Вас есть запасной вариант доступа к системе, на случай если сеть перестанет работать и ?ssh соединение будет не доступно.

  • Определите интерфейс, который Вы будете настраивать (чаше всего это eth0) и замените в следующих командах eth0 на Ваш интерфейс.
  • Попробуйте определить текущую скорость и режим дуплекса.
    • Для начала выполните, как root ethtool eth0, и Вы увидите строчки «Speed:» и «Duplex:», если нет то ethtool возможно не поддерживает Ваше устройство.

    • Попробуйте выполнить как root mii-tool -v eth0 и убедиться, что вывод выглядит правильно. Если нет, то mii-tool не поддерживает ваше устройство

    • Если ни одна из них не поддерживается, то Вы можете попробовать установить параметры напрямую в модуле драйвера ядра. Определить какой драйвер у Вас используется можно из вывода команд dmesg и lsmod. Вы можете попробовать выполнить modinfo MODULENAME что бы узнать возможные параметры. (можно использовать modinfo даже если модуль не загружен) ToDo: where does one set kernel module parameters?

  • Дальше, попробуйте изменить настройки используемого интерфейса. Вам необходимо быть root:
    • ethtool -s eth0 autoneg off speed 100 duplex full (задаёт 100 Mbps и full duplex)

    • mii-tool -F 100baseTx-FD eth0 (same assumption)

В каждом случае, перепроверьте применились ли настройки которые Вы изменили, затем попробуйте отправить какие-нибудь данные из системы, чтобы убедиться что NIC работает правильно.

Если одна из этих команд успешно настроила Вашу сетевую карту, можно добавить эти параметры в /etc/network/interfaces чтобы они применялись во время загрузки при поднятии интерфейса. Однако, перед этим Вам следует понять что некоторые драйвера отличаются от других. Когда модуль драйвера загружен, сетевая карта может начать автосогласование, без какого либо способа остановить его (особенно с драйверами которые не принимают параметры). Параметры из файла interfaces могут применяются в момент, когда автосогласование уже наполовину выполнено. Что бы избежать этого можно добавить задержку выполнения команд ethtool и mii-tool. Например :

iface eth0 inet static
       address ...
       netmask ...
       gateway ...
       up sleep 5; ethtool -s eth0 ...
  • Или аналоги команды mii-tool.

  • Перезагрузите компьютер чтобы убедится что всё работает правильно, и приготовитесь вмешаться (Ctrl-Alt-Del и затем загрузиться в однопользовательском режиме через LILO или GRUB) если что-то не работает.

Установим VirtualBox 6.1

Я уже описывал установку и настройку VirtualBox. Список статей можно посмотреть на странице поиска по ключевому слову — virtual. Вот пример — здесь.

А в этой статье опишу установку применительно к версии 6.1.

Добавляем в sources.list репозиторий VirtualBox

1. Открываем sources.list для редактирования

sudo nano /etc/apt/sources.list

2. Вставляем в конец файла строку

deb https://download.virtualbox.org/virtualbox/debian buster contrib

 Далее в терминале выполняем комплексную команду:

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - && wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - && sudo apt update && sudo apt install virtualbox-6.1

VirtualBox 6.1 установлен.

Можно настроить пользователя, скачать VirtualBox Extension Pack и установить.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Adblock
detector