team / 网桥 / IPV6

来源:互联网 发布:股票泛微网络复牌时间 编辑:程序博客网 时间:2024/06/07 08:38

                                            < 一 > team

1. team 接口

  (1)基础信息 
   team也是链路聚合的一种方式
   team 和 bond 功能类似
   team 不需要手动加载相应的内核模块
   team 相比 bond 有更强的拓展性
   team 可以支持 8 块网卡
  (2)team 的种类
   broadcast        广播容错
   roundrobin       轮询
   activebackup     主备
   loadbalance      负载均衡
2.配置

[root@localhost ~]# nmcli connection add con-name team0 ifname team0 type teamconfig '{"runner":{"name":"activebackup"}}' ip4172.25.254.178/24            ###添加team0
[root@localhost ~]# nmcli connection add con-name eth0 ifname eth0 typeteam-slave master team0 ###通过设置使得 eth0 给 team0 工作
[root@localhost ~]# nmcli connection add con-name eth1 ifname eth1 typeteam-slave master team0 ###通过设置使得 eth1 给 team0 工作

3.测试

(1)在一个 shall 里监控 team0 的状态
[root@localhost ~]# watch -n 1 teamdctl team0 stat
(2)在另外一个 shall 里 ping 查看网络状态
[root@localhost ~]# ping 172.25.254.78
(3)重新打开一个 shall 作动作 进行实验
[root@localhost ~]#ifconfig eth0 down
[root@localhost ~]#ifconfig eth0 up








                                              < 二> 网桥

1.配置

[root@foundation78 ~]# cd /etc/sysconfig/network-scripts/
[root@foundation78 network-scripts]# vim ifcfg-enp0s25

DEVICE=enp0s25                                            ##设备名称
ONBOOT=yes                                               ##开启服务设备自动激活
BOOTPROTO=none                                            ##网卡工作状态
BRIDGE=br0                                               ##网卡开启的网桥接口
~  

[root@foundation3 network-scripts]# vim ifcfg-br0
DEVICE=br0                                                ##设备名称
ONBOOT=yes
BOOTPROTO=none                                            ##网卡为静态
IPADDR=172.25.254.78                                     ##ID
NETMASK=255.255.255.0                                     ##子网衍码
TYPE=Bridge                                               ##网络接口类型是桥接
~                                                                             
~        
[root@foundation3 network-scripts]# systemctl stop NetworkManager.service    ##关闭网络记录
[root@foundation3 network-scripts]# systemctl restart network                ##重启网络
[root@foundation3 network-scripts]# systemctl start NetworkManager.service   ##开启网络记录
[root@foundation3 network-scripts]# ifconfig                                 ##查看网络
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.25.254.3  netmask 255.255.255.0  broadcast 172.25.254.255
        inet6fe80::221:ccff:fec9:b64d  prefixlen64  scopeid 0x20<link>
        ether 00:21:cc:c9:b6:4d  txqueuelen 0 (Ethernet)
        RX packets 173  bytes 18546 (18.1 KiB)
        RX errors 0  dropped 0 overruns 0  frame 0
        TX packets 25  bytes 3293 (3.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::221:ccff:fec9:b64d  prefixlen 64 scopeid 0x20<link>
        ether 00:21:cc:c9:b6:4d  txqueuelen 1000  (Ethernet)
        RX packets 165307  bytes 140245107 (133.7 MiB)
        RX errors 0  dropped 0 overruns 0  frame 0
        TX packets 71261  bytes 5200009 (4.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0
        device interrupt 20  memory 0xf1500000-f1520000 

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128 scopeid 0x10<host>
        loop  txqueuelen 0 (Local Loopback)
        RX packets 465604  bytes 8532242142 (7.9 GiB)
        RX errors 0  dropped 0 overruns 0  frame 0
        TX packets 465604  bytes 8532242142 (7.9 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:f5:f8:e7  txqueuelen 0 (Ethernet)
        RX packets 18  bytes 1558 (1.5 KiB)
        RX errors 0  dropped 0 overruns 0  frame 0
        TX packets 8  bytes 956 (956.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

virbr1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:14:88:ee  txqueuelen 0 (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0 overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

wlp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 8c:70:5a:99:da:04  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0 overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

2.命令管理方式

(1)添加:
[root@localhost ~]# systemctl stop NetworkManager                        ##关闭网络记录
[root@localhost ~]# brctl addbr br0                                      ##添加br0模块
[root@localhost ~]# brctl show                                          ##查看br0状态
bridge name bridge id       STP enabled interfaces
br0     8000.000000000000   no
[root@localhost ~]# ifconfig br0 172.25.254.178 network 255.255.255.0    ##给 br0一个IP
[root@localhost ~]# brctl addif br0 eth0                                 ##使得eth0给br0工作
[root@localhost ~]# ping 172.25.254.78                                   ##测试网络通不通

(2)删除:
[root@localhost ~]# ifconfig br0 down                                    ##先 down 掉br0
[root@localhost ~]# brctl delif br0 eth0                                 ##把eth0 去除
[root@localhost ~]# brctl delbr br0                                      ##再删除 br0 模块
[root@localhost ~]# brctl show











                                            < 三 > ipv6

1.基础信息:

    全称: InternetProtocol Version 6
    定义:IPv6 是 IETF (和互联网工程任务组)设计的用与替代现行版本 IP 协议的下一代 IP 协议。
    特点:
       (1)IPV6地址长度为128比特,地址空间增大了2的96次方倍
       (2)IPV6简化了报文头部格式,字段只有7个,加快报文转发,提高了吞吐量
       (3)提高安全性,身份认证和隐私权是IPV6的关键特性
       (4)支持更多的服务类型
       (6)允许协议继续演变,增加新的功能
    方式:为方便操作, ipv6被换算成 8x16 进制的一串数字
          –2000:0000:0000:0000:0000:0000:0000:0001
          – 2000:0:0:0:0:0:0:1
         任意位数的 0 可以用 :: 来表示
          –2000:0000:0000:0000:0000:0000:0000:0001
          – 2000::1
    区别:ipv4 32/2 地址枯竭 子网掩码24 16 8
         ipv6 128/2 子网16 32 48 64 80

2.配置

[root@localhost ~]# cd /etc/sysconfig/network-scripts/                ##切换工作目录
[root@localhost network-scripts]# ls                                  ##显示目录内容
ifcfg-eth0   ifdown-ppp       ifup-eth     ifup-sit
ifcfg-lo     ifdown-routes    ifup-ippp   ifup-Team
ifdown       ifdown-sit       ifup-ipv6    ifup-TeamPort
ifdown-bnep  ifdown-Team      ifup-isdn    ifup-tunnel
ifdown-eth   ifdown-TeamPort  ifup-plip   ifup-wireless
ifdown-ippp  ifdown-tunnel    ifup-plusb  init.ipv6-global
ifdown-ipv6  ifup             ifup-post    network-functions
ifdown-isdn  ifup-aliases     ifup-ppp     network-functions-ipv6
ifdown-post  ifup-bnep        ifup-routes
[root@localhost network-scripts]# vim ifcfg-eth0                      ##编写eth0的配置文件

DEVICE=eth0
BOOTPROTO=none
IPADDR=172.25.254.178
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERDNS=yes
IPV6INIT=yes                                                         ##打开IPV6
IPV6_AUTOCONF=no
IPV6ADDR=2017::8/64                                                   ##设定IPV6的ip地址
PERSISTENT_DHCLIENT=1

[root@localhost network-scripts]# systemctl restart network           ##重启网络 是更改后的配置文件生效
[root@localhost network-scripts]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.25.254.178  netmask 255.255.255.0  broadcast 172.25.254.255
        inet6 2017::8  prefixlen 64 scopeid 0x0<global>             ##我们设定的IPV6地址
        inet6fe80::5054:ff:fe00:4e0a  prefixlen64  scopeid 0x20<link>
        ether 52:54:00:00:4e:0a  txqueuelen 1000  (Ethernet)
        RX packets 427  bytes 37101 (36.2 KiB)
        RX errors 0  dropped 0 overruns 0  frame 0
        TX packets 588  bytes 56841 (55.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 52:54:00:e2:ef:df  txqueuelen 1000  (Ethernet)
        RX packets 428  bytes 29387 (28.6 KiB)
        RX errors 0  dropped 0 overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128 scopeid 0x10<host>
        loop  txqueuelen 0 (Local Loopback)
       RX packets 191  bytes 17584 (17.1KiB)
        RX errors 0  dropped 0 overruns 0  frame 0
        TX packets 191  bytes 17584 (17.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

[root@localhost network-scripts]#



 

原创粉丝点击