系统管理指南:IP 服务

Procedure如何配置 VLAN

如果使用的是 Solaris 10 3/05,则应使用如何配置静态 VLAN(仅适用于 Solaris 10 3/05)中的过程。

  1. 承担主管理员角色,或成为超级用户。

    主管理员角色拥有主管理员配置文件。有关如何创建该角色并将其指定给用户,请参见《系统管理指南:基本管理》中的第 2  章 “使用 Solaris Management Console(任务)”

  2. 确定正在系统上使用的接口的类型。


    # dladm show-link
    

    以下输出显示可用的接口类型:


    ce0             type: legacy    mtu: 1500       device: ce0
     ce1             type: legacy    mtu: 1500       device: ce1
     bge0            type: non-vlan  mtu: 1500       device: bge0
     bge1            type: non-vlan  mtu: 1500       device: bge1
     bge2            type: non-vlan  mtu: 1500       device: bge2
  3. 将接口配置为 VLAN 的一部分。


    # ifconfig interface-PPA plumb IP-address up
    

    例如,可以使用以下命令,将新 IP 地址为 10.0.0.2 的接口 ce1 配置到 VID 为 123 的 VLAN 中:


    # ifconfig ce123001 plumb 10.0.0.2
    up
    

    注 –

    您可以将 IPv4 和 IPv6 地址指定给 VLAN,就像您对其他接口所执行的那样。


  4. (可选)要使 VLAN 设置在重新引导后继续存在,请为配置为 VLAN 的一部分的每个接口创建 hostname.interface-PPA 文件。


    # cat hostname.interface-PPA
    IPv4-address
    
  5. 在交换机上,设置 VLAN 标记和 VLAN 端口,使之与在系统上设置的 VLAN 相对应。


示例 6–3 配置 VLAN

此示例说明如何将设备 bge1bge2 配置到 VID 为 123 的 VLAN 中。


# dladm show-link
ce0            type: legacy    mtu: 1500       device: ce0
ce1            type: legacy    mtu: 1500       device: ce1
bge0           type: non-vlan  mtu: 1500       device: bge0 
bge1           type: non-vlan  mtu: 1500       device: bge1 
bge2           type: non-vlan  mtu: 1500       device: bge2
# ifconfig bge123001 plumb 10.0.0.1 up
# ifconfig bge123002 plumb 10.0.0.2 up  
# cat hostname.bge123001   10.0.0.1
# cat hostname.bge123002   10.0.0.2
# ifconfig -a
 lo0: flags=2001000849 <UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
         inet 127.0.0.1 netmask ff000000  
 bge123001: flags=201000803<UP,BROADCAST,MULTICAST,IPv4,CoS> mtu 1500 index 2
         inet 10.0.0.1 netmask ff000000 broadcast 10.255.255.255
         ether 0:3:ba:7:84:5e  
bge123002:flags=201000803 <UP,BROADCAST,MULTICAST,IPv4,CoS> mtu 1500 index 3
         inet 10.0.0.2 netmask ff000000 broadcast 10.255.255.255
         ether 0:3:ba:7:84:5e  
ce0: flags=1000843 <UP,BROADCAST,RUNNING,MULTICAST,IPv4>mtu 1500 index 4
         inet 192.168.84.253 netmask ffffff00 broadcast 192.168.84.255
         ether 0:3:ba:7:84:5e
# dladm show-link
ce0             type: legacy    mtu: 1500       device: ce0
ce1             type: legacy    mtu: 1500       device: ce1
bge0            type: non-vlan  mtu: 1500       device: bge0 
bge1            type: non-vlan  mtu: 1500       device: bge1 
bge2            type: non-vlan  mtu: 1500       device: bge2
bge123001       type: vlan 123  mtu: 1500       device: bge1 
bge123002       type: vlan 123  mtu: 1500       device: bge2