VLAN实验

 

sw1:
[sw1]vlan batch 2 to 3     创建vlan2和vlan3

[sw1]port-group group-member GigabitEthernet 0/0/2 to GigabitEthernet 0/0/3 同时进入2号与3号                                                                                                                                  接口进行操作

[sw1-port-group]port link-type access      先定义该接口为接入模式

[sw1-port-group]port default vlan 2          将2号与3号接口划分到vlan2  

[sw1]port-group group-member GigabitEthernet 0/0/4 to GigabitEthernet 0/0/5

[sw1-port-group]port link-type access      

[sw1-port-group]port default vlan 3          将4号与5号接口划分到vlan3

[sw1]interface GigabitEthernet0/0/6                                  (与sw2建立trunk干道)

[sw1-GigabitEthernet0/0/6]port link-type trunk                       先定义为trunk模式

[sw1-GigabitEthernet0/0/6]port trunk allow-pass vlan 2 to 3  定义其可以允许通过的vla为2和3

  

[sw1]interface GigabitEthernet0/0/1                                     (与路由器建立trunk干道)

[sw1-GigabitEthernet0/0/1]port link-type trunk                       先定义为trunk模式

[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 3  定义其可以允许通过的vla为2和3

sw2:
[sw2]vlan batch 2 to 3     创建vlan2和vlan3

[sw2]interface GigabitEthernet0/0/2

[sw2-GigabitEthernet0/0/2]port link-type access      

[sw2-GigabitEthernet0/0/2]port default vlan 2          将2号接口划分到vlan2

[sw2]interface GigabitEthernet0/0/3

[sw2-GigabitEthernet0/0/3]port link-type access      

[sw2-GigabitEthernet0/0/3]port default vlan 3          将3号接口划分到vlan3

[sw1]interface GigabitEthernet0/0/1

[sw1-GigabitEthernet0/0/1]port link-type trunk                       先定义为trunk模式

[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 3  定义其可以允许通过的vla为2和3

r1:
[r1]int g0/0/0.1                                                                创建子接口 
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2        定义管理vlan编号
[r1-GigabitEthernet0/0/0.1]ip add 192.168.1.254 24      配置IP地址
[r1-GigabitEthernet0/0/0.1]arp broadcast  enable          开启子接口ARP
 

[r1]int g0/0/0.2  
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 3
[r1-GigabitEthernet0/0/0.1]ip add 192.168.2.254 24  
[r1-GigabitEthernet0/0/0.1]arp broadcast  enable  

   
[r1]dhcp enable                                                      开启dhcp服务
[r1]ip pool 1                                                            建立1号地址池
[r1-ip-pool-1]network 192.168.1.0 m 24                 设置管理网段
[r1-ip-pool-1]gateway-list 192.168.1.254                设置网关IP
[r1-ip-pool-1]dns-list 114.114.114.114                     设置dns服务器

[r1-GigabitEthernet0/0/0.1]dhcp select global         在对应接口开启DHCP功能

[r1]dhcp enable                                                      开启dhcp服务
[r1]ip pool 2                                                            建立2号地址池
[r1-ip-pool-2]network 192.168.2.0 m 24                 设置管理网段
[r1-ip-pool-2]gateway-list 192.168.2.254                设置网关IP
[r1-ip-pool-2]dns-list 114.114.114.114                     设置dns服务器

[r1-GigabitEthernet0/0/0.2]dhcp select global         在对应接口开启DHCP功能

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值