应用管理-综合串讲

  • 网络参数设置

    • nmtui设置:dns服务器、ip地址、子网掩码、网关、主机
    • 永久设置主机名,配置文件/etc/hostname(默认不存在)
    • [root@localhost ~]# echo ‘Server’ > /etc/hostname
      [root@localhost ~]# cat /etc/hostname
      Server
    • nmcli永久设置
    • 查看
    • [root@localhost ~]# nmcli connection show
      NAME UUID TYPE DEVICE
      System eth0 84a4d039-0c51-4767-928b-ad563f300f07 ethernet eth0 //网卡名称System eth0
      virbr0 77032656-17ba-40d3-a121-a979389b7386 bridge virbr0
    • 更改
    • [root@localhost ~]# nmcli connection modify ‘System eth0’ ipv4.method manual ipv4.addresses 10.211.55.21/24 ipv4.gateway 10.211.55.1 connection.autoconnect yes
    • 激活
    • [root@localhost ~]# nmcli connection up ‘System eth0’
  • dns服务器

    • 配置文件/etc/resolv.conf
    • [root@localhost ~]# echo ‘nameserver 223.5.5.5’ > /etc/resolv.conf
      [root@localhost ~]# cat /etc/resolv.conf
      nameserver 223.5.5.5
  • 查看网关

    • route
    • [root@localhost ~]# route
      Kernel IP routing table
      Destination Gateway Genmask Flags Metric Ref Use Iface
      default gateway 0.0.0.0 UG 100 0 0 eth0
      10.211.55.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
      192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
  • 链路聚合

    • 备份网卡,提高可靠性
    • 作用
      1. 轮询式(roundrobin)的流量负载均衡
      1. 热备份(activebackup)连接冗余
    • 操作步骤:
      1. 虚拟新网卡team0
    • [root@Server ~]# nmcli connection add type team ifname team0 con-name team0 autoconnect yes config ‘{“runner”:{“name”:“activebackup”}}’
      连接 “team0” (02b45fd8-410c-4920-aea0-f0d3dd5ffa2c) 已成功添加。
      1. 添加成员
    • [root@Server ~]# nmcli connection add type team-slave ifname eth1 con-name team0-1 master team0
      连接 “team0-1” (e3a9017d-3c2b-4474-b134-1ce7ac2a9d62) 已成功添加。
      [root@Server ~]# nmcli connection add type team-slave ifname eth2 con-name team0-2 master team0
      连接 “team0-2” (399703ff-ed17-4dab-9172-d02caae65bb7) 已成功添加。
      1. 配置team0并激活
    • [root@Server ~]# nmcli connection modify team0 ipv4.method manual ipv4.addresses 10.211.55.55/24 autoconnect yes
      [root@Server ~]# nmcli connection up team0
      连接已成功激活(master waiting for slaves)(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/10)
    • 如果配置错误可以删除
    • nmcli connection delete team0
    • nmcli connection delete team0-1
    • nmcli connection delete team0-2
      1. 查看team0状态
    • [root@Server ~]# teamdctl team0 state
      setup:
      runner: activebackup
      ports:
      eth1
      link watches:
      link summary: up
      instance[link_watch_0]:
      name: ethtool
      link: up
      down count: 0
      eth2
      link watches:
      link summary: up
      instance[link_watch_0]:
      name: ethtool
      link: up
      down count: 0
      runner:
      active port: eth1
      1. 测试切换
    • [root@Server ~]# ifconfig eth1 down
      [root@Server ~]# teamdctl team0 state
      setup:
      runner: activebackup
      ports:
      eth1
      link watches:
      link summary: down
      instance[link_watch_0]:
      name: ethtool
      link: down
      down count: 1
      eth2
      link watches:
      link summary: up
      instance[link_watch_0]:
      name: ethtool
      link: up
      down count: 0
      runner:
      active port: eth2
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值