linux 给team网卡配置vlan
1 |
# yum install teamd |
Using the console command nmcli and NetworkManager and a json-config file with the default config for the team, filename team-master-conf.json:
1 2 3 4 5 6 7 8 9 10 |
{ "runner": { "active": true, "fast_rate": true, "name": "lacp", "tx_hash": [ "eth", "ipv4" ] }, "tx_balancer": { "name": "basic" }, "link_watch": { "name": "ethtool" } } |
1 2 3 |
# nmcli con add type team con-name team0 ifname team0 config team-master-conf.json # nmcli con add type team-slave con-name team0-em1 ifname em1 master team0 # nmcli con add type team-slave con-name team0-em2 ifname em2 master team0 |
I have not added an IP-address to the new team since I will add that on the VLAN interface.
Check the status of the team
1 2 3 4 5 |
# nmcli con status NAME UUID TYPE DEVICE team0 7f0c0038-b8c1-45bb-a286-501d02304700 team team0 team0-em1 0394e2ae-6610-4997-92db-775876866d0d 802-3-ethernet em1 team0-em2 7050d641-83bb-497a-ae23-6af029386117 802-3-ethernet em2 |
Check the state of the team
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# teamdctl team0 state setup: runner: lacp ports: em1 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up down count: 1 runner: aggregator ID: 12, Selected selected: yes state: current em2 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up down count: 0 runner: aggregator ID: 12, Selected selected: yes state: current runner: active: yes fast rate: yes |
Add a VLAN to the network team
1 |
# nmcli con add type vlan con-name team0-vlan12 dev team0 id 12 ip4 10.1.0.20/24 gw4 10.1.0.1 |
The new config looks like this
1 2 3 4 5 |
# nmcli con s | grep team team0 7f0c0038-b8c1-45bb-a286-501d02304700 team team0 team0-vlan12 d5de0d83-d490-4535-915c-4cbdcf39830b vlan team0.12 team0-em1 0394e2ae-6610-4997-92db-775876866d0d 802-3-ethernet em1 team0-em2 7050d641-83bb-497a-ae23-6af029386117 802-3-ethernet em2 |
转:https://pario.no/2018/03/02/configure-vlan-network-team-using-nmcli-networkmanager/