Cisco IOS 软件 [Everest],ISR 4331。Vlan+Vrf+Dhcp

网络工程 路由 局域网 dhcp 虚拟现实 cisco-isr
2022-03-03 10:27:53

我正在考虑使用具有该目标的设置:

  1. 在接口 GigabitEthernet0/0/1 上创建子接口
  2. 创建一个 Vlan 并将其分配给该子接口
  3. 创建一个 vrrf 并将其分配给该子接口
  4. 声明一个 dhcp 服务器并将其附加到该子接口。4)从vlan路由到wan。

这个想法是有一个第 2 层和第 3 层独立的隔离虚拟网络。

网站 a 正在阅读:

https://www.mustbegeek.com/configure-vrf-in-cisco-ios-router/

https://www.cisco.com/c/en/us/support/docs/multiprotocol-label-switching-mpls/mpls/24508-internet-access-mpls-vpn.html

https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cucme/vrf/design/guide/vrfDesignGuide.html#wp998688

https://learningnetwork.cisco.com/s/question/0D53i00000Kt2zbCAB/how-to-configure-vlans-on-cisco-router

https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipaddr_dhcp/configuration/xe-16/dhcp-xe-16-book/config-dhcp-server-xe。 html#GUID-0C4F21C0-650F-4652-A621-9FB49202767C

我制作的代码是:

enable
configure terminal
ip cef
ip dhcp database disk0:router-dhcp timeout 60
ip dhcp database disk0:router-dhcp write-delay 60
ip dhcp bootp ignore
end


enable
configure terminal
ip vrf VRF200
RD 68686:200
route-target export 68686:200
route-target import 68686:200
ip route vrf VRF200 0.0.0.0 0.0.0.0 192.168.20.1
ip dhcp excluded-address 192.168.20.1 192.168.20.110
ip dhcp excluded-address 192.168.20.210 192.168.20.255
ip dhcp pool VLAN200
   network 192.168.20.0 255.255.255.0
   default-router 192.168.20.1 
   class VLAN200
   dns-server 8.26.56.26
   dns-server 198.153.192.1
   domain-name localdomain
   lease infinite
   vrf VRF200
   excluded-address 192.168.20.1 192.168.20.110
   excluded-address 192.168.20.210 192.168.20.255
end

interface GigabitEthernet0/0/1.200
description VLAN200
encapsulation dot1q 200
ip address 192.168.20.1 255.255.255.0
no shutdown
vrf forwarding VLAN200
duplex auto
speed auto
exit

只是一个概念证明,我在 cisco 上没有经验,显然这段代码不起作用。我从带有 vlan200 标记的 PC 将一个接口连接到 GigabitEthernet0/0/1,并且没有 ping 到 GigabitEthernet0/0/1.200,也没有 dhcp。

任何指南都将受到欢迎。

是的,这张卡可以发送标记帧。以前用过很多次。我有一个路由器 mikrotik,如果我将电线插入其中,我可以毫无问题地使用 vlan200。

1.出现:

#show interface GI0/0/1.200
GigabitEthernet0/0/1.200 is up, line protocol is up
  Hardware is ISR4331-3x1GE, address is 00a3.d1ab.d5dc (bia 00a3.d1ab.d5dc)
  Description: VLAN200
  Internet address is 192.168.20.1/24
  MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation 802.1Q Virtual LAN, Vlan ID  200.
  ARP type: ARPA, ARP Timeout 04:00:00
  Keepalive not supported
  Last clearing of "show interface" counters never

我没有设置生成树,所以最后的命令不适用。

经过几次测试后,我再次逐步进行配置和测试。vlan好像没问题,手动设置ip后可以ping通...

#ping 192.168.20.111
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.111, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

他们我设置了 DHCP 服务器,看起来也不错:

#Show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address      Client-ID/              Lease expiration        Type       State      Interface
                Hardware address/
                User name
192.168.20.111  0118.31bf.d040.62       Infinite                Automatic  Active     GigabitEthernet0/0/1.200

所以我的设置问题必须与 VRF 有关。

感谢您的帮助。

1个回答

编辑:

这里有几件事要检查:

您的 PC 真的可以发送标记帧吗(大多数 PC 不能)?

  1. 您的 VRF 名为VRF200,但您的配置显示 VLAN200
  2. 确保您输入

vrf forwarding VRF200

输入 IP 地址之前

ip address 192.168.20.1 255.255.255.0