【简 介】 近期看到有些朋友问交换机划 VLAN 后接路由器如何配置访问外网,其实这是个比较简单,也比较典型的配置。网上也很容易找到,但都不系统很零散。 |
|
|
|
|
RA:
nat address-group 0 59.61.94.145 59.61.94.150 #配置NAT 地址池,也即 ISP分配的地址段。(如果外网接口类型为广播,则最好把这些地址配置给 LOOPBACK接口,否则可能不同,但此例是点对点接口,无此问题)
acl number 2000 #配置 NAT 用的 ACL列表
rule 0 permit source 172.16.0.0 0.0.0.255
rule 1 permit source 172.16.1.0 0.0.0.255
rule 2 permit source 10.0.0.0 0.0.0.3
interface Ethernet0/0 #配置内网口
ip address 10.0.0.1 255.255.255.252
interface Serial0/0 #配置外网口
link-protocol ppp
ip address 10.0.1.2 255.255.255.252
nat outbound 2000 address-group 0 #做 NAT,采用先前配置的地址池。
ip route-static 0.0.0.0 0.0.0.0 10.0.1.1 preference 60 配置默认路由
SW1:
gvrp #启用 GVRP 注册协议,用于动态创建 SW2的 VLAN,实现 VLAN 的集中管理。
vlan 2 #创建各 VLAN
vlan 3
vlan 24#因为S3526 不支持被路由接口,因此将 E0/24 划到 VLAN24,给 VLAN24 配置虚接口 IP用于路由。(cisco 则可以在 e0/24接口用 no switchport 配置为被路由接口,直接配置 IP即可)
interface Vlan-interface2 #配置 VLAN 虚接口 IP
ip address 172.16.0.254 255.255.255.0
interface Vlan-interface3 配置 VLAN 虚接口 IP
ip address 172.16.1.254 255.255.255.0
interface Vlan-interface24 配置 VLAN 虚接口 IP
ip address 10.0.0.2 255.255.255.252
interface Ethernet0/1 #划分接口到 VLAN
port access vlan 2
interface Ethernet0/10 #配置和 SW2 互联的 E0/10接口为 Trunk 接口,并启用 GVRP协议。
port link-type trunk
port trunk permit vlan 2 to 3
gvrp registration fixed
gvrp
interface Ethernet0/24 #划分接口到 VLAN
port access vlan 24
SW2:
gvrp#启用 GVRP 协议,接收 SW1 配置的 VLAN
interface Ethernet0/1 #给 VLAN划接口
port access vlan 3
interface Ethernet0/10 #配置和 SW1 相连的 Trunk口,并启用 GVRP
port link-type trunk
port trunk permit vlan 1 to 3
gvrp
|
|
|
焦点文章
| | |
|
|
相关文章
|