Инструменты пользователя

Инструменты сайта


linux_network

Настройка сети в Linux

Получение списка сетевых устройств

ls /sys/class/net

Управление сетевыми интерфейсами

В последних версиях для всех манипуляций с сетевыми интерфейсами используется команда ip.

Установка статических параметров интерфейса (https://wiki.archlinux.org/index.php/%D0%A1%D1%82%D0%B0%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9_IP_%D0%B8_DHCP):

Вы можете назначить статический IP в консоли:

ip addr add <ip>/<netmask> dev <interface>

Например:

ip addr add 192.168.1.2/24 dev enp1s0

«Поднятие» интерфейса:

ip link set enp1s0 up

Добавить шлюз вот так:

ip route add default via <ip>

Например:

ip route add default via 192.168.1.1

Имена сетевых интерфейсов

http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

With systemd 197 we have added native support for a number of different naming policies into systemd/udevd proper and made a scheme similar to biosdevname's (but generally more powerful, and closer to kernel-internal device identification schemes) the default. The following different naming schemes for network interfaces are now supported by udev natively:

  1. Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: eno1)
  2. Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ens1)
  3. Names incorporating physical/geographical location of the connector of the hardware (example: enp2s0)
  4. Names incorporating the interfaces's MAC address (example: enx78e7d1ea46da)
  5. Classic, unpredictable kernel-native ethX naming (example: eth0)

By default, systemd v197 will now name interfaces following policy 1) if that information from the firmware is applicable and available, falling back to 2) if that information from the firmware is applicable and available, falling back to 3) if applicable, falling back to 5) in all other cases. Policy 4) is not used by default, but is available if the user chooses so.

This combined policy is only applied as last resort. That means, if the system has biosdevname installed, it will take precedence. If the user has added udev rules which change the name of the kernel devices these will take precedence too. Also, any distribution specific naming schemes generally take precedence.

linux_network.txt · Последние изменения: 2014/05/21 22:54 (внешнее изменение)