• 用nmcli命令配置VLAN

    发布时间:2019-10-08 09:15:19
    作者:ynkulusi
  • 如果在绑定bond接口上配置VLAN,绑定的所有slave接口都必须UP,绑定模式接口不支持配置fail_over_mac=follow选项,因为虚拟设备不能更改MAC地址来匹配父接口新的MAC地址
    查看可用的网络接口
    # ip address show
    创建一个名为vlan10VLAN接口,该接口使用enp1s0作为其父接口并标记VLAN ID10
    # nmcli connection add type vlan con-name vlan10 ifname vlan10 vlan.parent enp1s0 vlan.id 10
    默认情况下,VLAN从父级继承最大传输单位(MTU,默认1500),(可选)设置其他MTU
    # nmcli connection modify vlan10 802-3-ethernet.mtu 2000
    vlan10配置ipv4地址信息
    # nmcli connection modify vlan10 ipv4.addresses '192.0.2.1/24'
    # nmcli connection modify vlan10 ipv4.gateway '192.0.2.254'
    # nmcli connection modify vlan10 ipv4.dns '192.0.2.253'
    # nmcli connection modify vlan10 ipv4.method manual
    vlan10配置ipv6地址信息
    # nmcli connection modify vlan10 ipv6.addresses '2001:db8::1/32'
    # nmcli connection modify vlan10 ipv6.gateway '2001:db8::fffe'
    # nmcli connection modify vlan10 ipv6.dns '2001:db8::fffd'
    # nmcli connection modify vlan10 ipv6.method manual
    确认配置信息
    # ip -d addr show vlan10
    4: vlan10@enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
    state UP group default qlen 1000
        link/ether 52:54:00:d5:e0:fb brd ff:ff:ff:ff:ff:ff promiscuity 0
        vlan protocol 802.1Q id 10 <REORDER_HDR> numtxqueues 1 numrxqueues 1
    gso_max_size 65536 gso_max_segs 65535
        inet 192.0.2.1/24 brd 192.0.2.255 scope global noprefixroute vlan10
           valid_lft forever preferred_lft forever
        inet6 fe80::8dd7:9030:6f8e:89e6/64 scope link noprefixroute
           valid_lft forever preferred_lft forever
     
  • 分类:network
    标签: rhel8 centos8
    评论数:0 阅读数:833