вторник, 14 июля 2020 г.

Настройка сети на ПК с LUBUNTU

Настройка сети на ПК с LUBUNTU

Проверка названия интерфейсов:
$ ip a                                                                                                             
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000                                 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00                                                                   
    inet 127.0.0.1/8 scope host lo                                                                                          
       valid_lft forever preferred_lft forever                                                                              
    inet6 ::1/128 scope host                                                                                                
       valid_lft forever preferred_lft forever                                                                              
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000                       
    link/ether c8:cb:b8:1a:58:01 brd ff:ff:ff:ff:ff:ff                                                                      
    inet 10.10.49.226/24 brd 10.10.49.255 scope global noprefixroute enp1s0                                                 
       valid_lft forever preferred_lft forever                                                                              
    inet6 fe80::cacb:b8ff:fe1a:5801/64 scope link
       valid_lft forever preferred_lft forever


Проверка наличия в системе сетевых адаптеров:
$ lshw -C network
WARNING: you should run this program as super-user.
  *-network                
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: enp1s0
       version: 0c
       serial: c8:cb:b8:1a:58:01
       size: 100Mbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 ip=10.10.49.226 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
       resources: irq:31 ioport:e000(size=256) memory:fea00000-fea00fff memory:d0800000-d0803fff
  *-network
       description: Network controller
       product: BCM43228 802.11a/b/g/n
       vendor: Broadcom Inc. and subsidiaries
       physical id: 0
       bus info: pci@0000:02:00.0
       version: 00
       width: 64 bits                                                                                                       
       clock: 33MHz                                                                                                         
       capabilities: bus_master cap_list                                                                                    
       configuration: driver=bcma-pci-bridge latency=0                                                                      
       resources: irq:33 memory:fe900000-fe903fff                                                                           
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.        


Для прописывания статического IP адреса на интерфейсе в UBUNTU используется утилита netplan
Файл конфигурации находиться в директории /etc/netplan/. Он может иметь разное имя, у меня назывался так: 01-network-manager-all.yaml
# nano /etc/netplan/01-network-manager-all.yaml
Пример файла конфигурации для статического интерфейса:
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp1s0:
      addresses: [10.10.49.226/24]
      gateway4: 10.10.49.254
      dhcp4: no
      dhcp6: no
      nameservers:
        addresses: [10.10.50.2,46.20.64.1]


Проверка конфигурации netplan, выполняется командой:
# netplan try
Если в файле конфигурации есть ошибки, утилита покажет место ошибки, если ошибок нет, то выдаст предупреждение с обратным отсчетом применения. Для применения настроек нужно нажать ENTER.
Do you want to keep these settings?
Press ENTER before the timeout to accept the new configuration
Changes will revert in 117 seconds
Configuration accepted.




Комментариев нет:

Отправить комментарий