条件:
R1为DHCP配置网关,S1为二层交换机
要求:
PC1获取到vlan10地址,PC2获取vlan10地址,PC3获取vlan20地址
方法1:
S1正常配置vlan10,20,配置与R1相连的1口为trunk口
R1的1口,配置单臂路由,终结vlan10、20
AR1的配置:
dhcp enable
#
ip pool 1
gateway-list 10.10.10.1
network 10.10.10.0 mask 255.255.255.0
excluded-ip-address 10.10.10.2
#
ip pool 2
gateway-list 10.20.20.1
network 10.20.20.0 mask 255.255.255.0
#
interface GigabitEthernet 0/0/1.1
dot1q termination vid 2
ip address 10.10.10.1 24
arp broadcast enable
#
interface GigabitEthernet 0/0/1.2
dot1q termination vid 3
ip address 10.20.20.1 24
arp broadcast enable
#
方法2:
将R1的1口配置为二层的trunk口,配置vlan10、20的vlanif网关为dhcp网关
interface GigabitEthernet0/0/1
portswitch
port link-type trunk
port trunk allow-pass vlan 10 20
#
int vlanif 10
ip addr 10.10.10.1 24
dhcp select interface
#int vlanif 20
ip addr 10.20.20.1 24
dhcp select interface