目录
5,按照图示配置 IP 地址,其中只有SW1需要配置三层vlan地址,电脑设备为DHCP获取地址
6,在sw1配置DHCP动态地址池塘,DNS为114.114.114.114
7,各台电脑通过交换机划分不同的vlan来控制电脑不同网关的获取。
拓扑下载连接:(csdn月夜行舟博主)
图1-1
注:如无特别说明,描述中的R1或SW1对应拓扑中设备名称末尾数字为1的设备,R2或SW2对应拓扑中设备名称末尾数字为2的设备,以此类推
按照图示配置 IP 地址,其中只有SW1需要配置三层vlan地址,电脑设备为DHCP获取地址
在sw1配置DHCP动态地址池塘
各台电脑通过交换机划分不同的vlan来控制电脑不同网关的获取。
最后查看电脑已经获取相对应vlan的地址
R1
- [H3C]sysn sw1
- [sw1]vlan 10
- [sw1-vlan10]int vlan 10
- [sw1-Vlan-interface10]ip add 192.168.10.1 24
- [sw1-Vlan-interface10]vlan 20
- [sw1-vlan20]int vlan 20
- [sw1-Vlan-interface20]ip add 192.168.20.1 24
- [sw1-Vlan-interface20]vlan 30
- [sw1-vlan30]int vlan 30
- [sw1-Vlan-interface30]ip add 192.168.30.1 24
-
PC5-PC7均为动态获取
SW1
- [sw1]dhcp en
- [sw1]dhcp ser ip vlan10
- [sw1-dhcp-pool-vlan10]netw 192.168.10.0 ma 255.255.255.0
- [sw1-dhcp-pool-vlan10]gat 192.168.10.1
- [sw1-dhcp-pool-vlan10]dns 114.114.114.114
- [sw1-dhcp-pool-vlan10]dhcp ser ip vlan20
- [sw1-dhcp-pool-vlan20]netw 192.168.20.0 ma 255.255.255.0
- [sw1-dhcp-pool-vlan20]gat 192.168.20.1
- [sw1-dhcp-pool-vlan20]dns 114.114.114.114
- [sw1-dhcp-pool-vlan20]dhcp ser ip vlan30
- [sw1-dhcp-pool-vlan30]netw 192.168.30.0 ma 255.255.255.0
- [sw1-dhcp-pool-vlan30]gat 192.168.30.1
- [sw1-dhcp-pool-vlan30]dns 114.114.114.114
sw1
- [sw1]int ran g1/0/1 to g1/0/3
- [sw1-if-range]port link-ty tr
- [sw1-if-range]port tr pe vlan 10 20 30
-
sw2
- sys
- System View: return to User View with Ctrl+Z.
- [H3C]sysn sw2
- [sw2]vlan 10
- [sw2-vlan10]vlan 20
- [sw2-vlan20]vlan 30
- [sw2-vlan30]int g1/0/2
- [sw2-GigabitEthernet1/0/2]port link-ty tr
- [sw2-GigabitEthernet1/0/2]port tr pe vlan all
- [sw2-GigabitEthernet1/0/2]int g1/0/1
- [sw2-GigabitEthernet1/0/1]port link-ty ac
- [sw2-GigabitEthernet1/0/1]port ac vlan 10
-
sw3
- sys
- System View: return to User View with Ctrl+Z.
- [H3C]sysn sw3
- [sw3]vlan 10
- [sw3-vlan10]vlan 20
- [sw3-vlan20]vlan 30
- [sw3-vlan30]int g1/0/1
- [sw3-GigabitEthernet1/0/1]port link-ty tr
- [sw3-GigabitEthernet1/0/1]port tr pe vlan all
- [sw3-GigabitEthernet1/0/1]int g1/0/2
- [sw3-GigabitEthernet1/0/2]port link-ty ac
- [sw3-GigabitEthernet1/0/2]port ac vlan 20
-
sw4
- sys
- System View: return to User View with Ctrl+Z.
- [H3C]sysn sw4
- [sw4]vlan 10
- [sw4-vlan10]vlan 20
- [sw4-vlan20]vlan 30
- [sw4-vlan30]int g1/0/1
- [sw4-GigabitEthernet1/0/1]port link-ty tr
- [sw4-GigabitEthernet1/0/1]port tr pe vlan all
- [sw4-GigabitEthernet1/0/1]int g1/0/2
- [sw4-GigabitEthernet1/0/2]port link-ty ac
- [sw4-GigabitEthernet1/0/2]port ac vlan 30
PC5
PC6
PC7