team + DHCP

How can we help?

Навигация

на r1:

[root@r1 ~]# yum install teamd -y
[root@r1 ~]# cd /etc/sysconfig/network-scripts 
[root@r1 network-scripts]# vi ifcfg-team0
DEVICE=team0
DEVICETYPE=Team
BOOTPROTO=dhcp
ONBOOT=yes
NM_CONTROLLED=no
TEAM_CONFIG='{"runner": {"name": "loadbalance"}, "link_watch": {"name":"ethtool"}}'

[root@r1 network-scripts]# vi ifcfg-team-slave-enp0s8
NAME=team-slave-enp0s8
DEVICE=enp0s8
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort
TEAM_PORT_CONFIG='{"prio": 100}'

[root@r1 network-scripts]# vi ifcfg-team-slave-enp0s9
NAME=team-slave-enp0s9
DEVICE=enp0s9
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort
TEAM_PORT_CONFIG='{"prio": 100}'

[root@r1 network-scripts]# systemctl restart network
[root@r1 network-scripts]# teamdctl team0 state
setup:
  runner: loadbalance
ports:
  enp0s8
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
  enp0s9
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0


на r2:

[root@r2 ~]# yum install teamd -y
[root@r2 ~]# cd /etc/sysconfig/network-scripts 
[root@r2 network-scripts]# vi ifcfg-team0
DEVICE=team0
DEVICETYPE=Team
BOOTPROTO=dhcp
ONBOOT=yes
NM_CONTROLLED=no
TEAM_CONFIG='{"runner": {"name": "loadbalance"}, "link_watch": {"name":"ethtool"}}'

[root@r2 network-scripts]# vi ifcfg-team-slave-enp0s8
NAME=team-slave-enp0s8
DEVICE=enp0s8
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort

[root@r2 network-scripts]# vi ifcfg-team-slave-enp0s9
NAME=team-slave-enp0s9
DEVICE=enp0s9
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort

[root@r2 network-scripts]# systemctl restart network
[root@r2 network-scripts]# teamdctl team0 state
setup:
  runner: loadbalance
ports:
  enp0s8
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
  enp0s9
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0

[root@r2 ~]# yum install dhcp
[root@r2 ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
[root@r2 ~]# sed s/^/#/ /etc/dhcp/dhcpd.conf | tee /etc/dhcp/dhcpd.conf2         # комментируем все строчки в файле
[root@r2 ~]# cp /etc/dhcp/dhcpd.conf2 /etc/dhcp/dhcpd.conf
[root@r2 ~]# vi /etc/dhcp/dhcpd.conf              # оставляем только следующее:
subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.200 192.168.1.210;
  option domain-name-servers ns1.internal.example.org;
  option domain-name "internal.example.org";
  option routers 192.168.1.102;
  option broadcast-address 192.168.1.255;
  option ms-classless-static-routes 32, 4, 4, 4, 4, 192, 168, 12, 2, 32, 5, 5, 5, 5, 192, 168, 12, 2;
  default-lease-time 600;
  max-lease-time 7200;
}

[root@r2 ~]# vi /etc/sysconfig/dhcpd
DHCPDARGS=team0

[root@r2 ~]# dhcpd -t -cf /etc/dhcp/dhcpd.conf
Internet Systems Consortium DHCP Server 4.2.5
Copyright 2004-2013 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file

[root@r2 ~]# systemctl restart dhcpd
[root@r2 ~]# systemctl status dhcpd
● dhcpd.service - DHCPv4 Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Вт 2022-07-12 08:34:27 MSK; 6s ago
     Docs: man:dhcpd(8)
           man:dhcpd.conf(5)
 Main PID: 6818 (dhcpd)
   Status: "Dispatching packets..."
   CGroup: /system.slice/dhcpd.service
           └─6818 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid

июл 12 08:34:27 r2 dhcpd[6818]: No subnet declaration for enp0s8 (no IPv4 addresses).
июл 12 08:34:27 r2 dhcpd[6818]: ** Ignoring requests on enp0s8.  If this is not what
июл 12 08:34:27 r2 dhcpd[6818]:    you want, please write a subnet declaration
июл 12 08:34:27 r2 dhcpd[6818]:    in your dhcpd.conf file for the network segment
июл 12 08:34:27 r2 dhcpd[6818]:    to which interface enp0s8 is attached. **
июл 12 08:34:27 r2 dhcpd[6818]:
июл 12 08:34:27 r2 dhcpd[6818]: Listening on LPF/enp0s3/08:00:27:ed:73:77/192.168.1.0/24
июл 12 08:34:27 r2 dhcpd[6818]: Sending on   LPF/enp0s3/08:00:27:ed:73:77/192.168.1.0/24
июл 12 08:34:27 r2 dhcpd[6818]: Sending on   Socket/fallback/fallback-net
июл 12 08:34:27 r2 systemd[1]: Started DHCPv4 Server Daemon.
[root@r2 ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5